forked from va/knowledge-search-mcp
Update MCP defaults
This commit is contained in:
10
main.py
10
main.py
@@ -244,7 +244,10 @@ class GoogleCloudVectorSearch:
|
|||||||
json=payload,
|
json=payload,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
) as response:
|
) as response:
|
||||||
response.raise_for_status()
|
if not response.ok:
|
||||||
|
body = await response.text()
|
||||||
|
msg = f"findNeighbors returned {response.status}: {body}"
|
||||||
|
raise RuntimeError(msg)
|
||||||
data = await response.json()
|
data = await response.json()
|
||||||
|
|
||||||
neighbors = data.get("nearestNeighbors", [{}])[0].get("neighbors", [])
|
neighbors = data.get("nearestNeighbors", [{}])[0].get("neighbors", [])
|
||||||
@@ -281,6 +284,8 @@ class GoogleCloudVectorSearch:
|
|||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
"""Server configuration populated from environment variables."""
|
"""Server configuration populated from environment variables."""
|
||||||
|
|
||||||
|
model_config = {"env_file": ".env"}
|
||||||
|
|
||||||
project_id: str
|
project_id: str
|
||||||
location: str
|
location: str
|
||||||
bucket: str
|
bucket: str
|
||||||
@@ -288,7 +293,7 @@ class Settings(BaseSettings):
|
|||||||
deployed_index_id: str
|
deployed_index_id: str
|
||||||
endpoint_name: str
|
endpoint_name: str
|
||||||
endpoint_domain: str
|
endpoint_domain: str
|
||||||
embedding_model: str = "text-embedding-005"
|
embedding_model: str = "gemini-embedding-001"
|
||||||
search_limit: int = 10
|
search_limit: int = 10
|
||||||
|
|
||||||
|
|
||||||
@@ -359,6 +364,7 @@ async def knowledge_search(
|
|||||||
contents=query,
|
contents=query,
|
||||||
config=genai_types.EmbedContentConfig(
|
config=genai_types.EmbedContentConfig(
|
||||||
task_type="RETRIEVAL_QUERY",
|
task_type="RETRIEVAL_QUERY",
|
||||||
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
embedding = response.embeddings[0].values
|
embedding = response.embeddings[0].values
|
||||||
|
|||||||
Reference in New Issue
Block a user