File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 11import os
22import pymongo
3- import certifi
43from google .adk .agents import Agent
54from google import genai
65from google .genai import types
1211CARTS_COLLECTION_NAME = "carts"
1312
1413genai_client = genai .Client ()
15- database_client = pymongo .MongoClient (CONNECTION_STRING , tlsCAFile = certifi . where () )
14+ database_client = pymongo .MongoClient (CONNECTION_STRING )
1615
1716def generate_embeddings (query ):
1817 result = genai_client .models .embed_content (
1918 model = "gemini-embedding-001" ,
20- contents = query
19+ contents = query ,
20+ config = types .EmbedContentConfig (output_dimensionality = 768 )
2121 )
2222
2323 return result .embeddings [0 ].values
@@ -59,7 +59,6 @@ def find_similar_products(query: str) -> str:
5959 # Exclude the embedding and price fields from the results
6060 "$project" : {
6161 "_id" : 0 ,
62- "sale_price" : 0 ,
6362 "gemini_embedding" : 0
6463 }
6564 }
You can’t perform that action at this time.
0 commit comments