Mikeplockhart commited on
Commit
a2ee5aa
1 Parent(s): 61ad695

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +15 -11
utils.py CHANGED
@@ -25,21 +25,25 @@ def embedding_function(items_to_embed: list[str]):
25
  embedded_items = sentence_model.encode(
26
  items_to_embed
27
  )
 
 
 
28
  return embedded_items
29
 
30
  def chroma_upserting(collection, payload:list[dict]):
31
  print('upserting')
32
- for idx, item in enumerate(payload):
33
- print("printing item:")
34
- print(type(item))
35
- embedding = list(embedding_function(item['doc']))
36
- print(type(embedding))
37
- collection.add(
38
- documents=item['doc'],
39
- embeddings=[embedding],
40
- #metadatas=item,
41
- ids=f"id_{idx}"
42
- )
 
43
 
44
  def search_chroma(collection, query:str):
45
  results = collection.query(
 
25
  embedded_items = sentence_model.encode(
26
  items_to_embed
27
  )
28
+ print(len(embedded_items))
29
+ print(type(embedded_items[0]))
30
+ print(type(embedded items[0][0]))
31
  return embedded_items
32
 
33
  def chroma_upserting(collection, payload:list[dict]):
34
  print('upserting')
35
+
36
+ #for idx, item in enumerate(payload):
37
+ # print("printing item:")
38
+ # print(type(item))
39
+ embedding = list(embedding_function(item['doc']))
40
+ # print(type(embedding))
41
+ # collection.add(
42
+ # documents=item['doc'],
43
+ # embeddings=[embedding],
44
+ # #metadatas=item,
45
+ # ids=f"id_{idx}"
46
+ # )
47
 
48
  def search_chroma(collection, query:str):
49
  results = collection.query(