Skip to content

Commit 72a32e2

Browse files
committed
Fix solutions
1 parent a260209 commit 72a32e2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

.solutions/agent.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import pymongo
3-
import certifi
43
from google.adk.agents import Agent
54
from google import genai
65
from google.genai import types
@@ -12,12 +11,13 @@
1211
CARTS_COLLECTION_NAME = "carts"
1312

1413
genai_client = genai.Client()
15-
database_client = pymongo.MongoClient(CONNECTION_STRING, tlsCAFile=certifi.where())
14+
database_client = pymongo.MongoClient(CONNECTION_STRING)
1615

1716
def 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
}

0 commit comments

Comments
 (0)