Add arbitrary metadata to message

This commit is contained in:
Mark Ceter
2023-05-17 18:37:22 +00:00
committed by GitHub
parent 20e988890d
commit 71013c381f
2 changed files with 6 additions and 3 deletions

View File

@@ -640,7 +640,7 @@ def chromadb_add_messages():
documents = [m['content'] for m in data['messages']]
ids = [m['id'] for m in data['messages']]
metadatas = [{'role': m['role'], 'date': m['date']} for m in data['messages']]
metadatas = [{'role': m['role'], 'date': m['date'], 'meta': m.get('meta', '')} for m in data['messages']]
collection.upsert(
ids=ids,
@@ -687,6 +687,7 @@ def chromadb_query():
'id': ids[i],
'date': metadatas[i]['date'],
'role': metadatas[i]['role'],
'meta': metadatas[i]['meta'],
'content': documents[i],
'distance': distances[i]
} for i in range(len(ids))