Configure cli
This commit is contained in:
@@ -52,7 +52,7 @@ async def conocimiento(ctx: RunContext[Deps], query: str) -> str:
|
||||
t_embed = time.perf_counter()
|
||||
|
||||
search_results = await ctx.deps.vector_search.async_run_query(
|
||||
deployed_index_id=settings.index_name,
|
||||
deployed_index_id=settings.index_deployed_id,
|
||||
query=list(query_embedding.embeddings[0]),
|
||||
limit=5,
|
||||
)
|
||||
@@ -82,3 +82,11 @@ async def conocimiento(ctx: RunContext[Deps], query: str) -> str:
|
||||
for i, result in enumerate(search_results, start=1)
|
||||
]
|
||||
return "\n".join(formatted_results)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
deps = Deps(
|
||||
vector_search=settings.vector_search,
|
||||
embedder=settings.embedder,
|
||||
)
|
||||
agent.to_cli_sync(deps=deps)
|
||||
|
||||
@@ -22,7 +22,7 @@ class Settings(BaseSettings):
|
||||
|
||||
project_id: str
|
||||
location: str
|
||||
service_account: str
|
||||
bucket: str
|
||||
|
||||
agent_name: str
|
||||
agent_instructions: str
|
||||
@@ -31,6 +31,7 @@ class Settings(BaseSettings):
|
||||
agent_thinking: int
|
||||
|
||||
index_name: str
|
||||
index_deployed_id: str
|
||||
index_endpoint: str
|
||||
index_dimensions: int
|
||||
index_machine_type: str = "e2-standard-16"
|
||||
@@ -38,14 +39,6 @@ class Settings(BaseSettings):
|
||||
index_destination: str
|
||||
index_chunk_limit: int
|
||||
|
||||
bigquery_dataset_id: str
|
||||
bigquery_project_id: str | None = None
|
||||
bigquery_table_ids: dict[str, str]
|
||||
|
||||
bucket: str
|
||||
base_image: str
|
||||
dialogflow_agent_id: str
|
||||
processing_image: str
|
||||
|
||||
model_config = SettingsConfigDict(yaml_file=CONFIG_FILE_PATH)
|
||||
|
||||
@@ -75,12 +68,14 @@ class Settings(BaseSettings):
|
||||
@cached_property
|
||||
def vector_search(self) -> GoogleCloudVectorSearch:
|
||||
"""Return a configured vector search client."""
|
||||
return GoogleCloudVectorSearch(
|
||||
vs = GoogleCloudVectorSearch(
|
||||
project_id=self.project_id,
|
||||
location=self.location,
|
||||
bucket=self.bucket,
|
||||
index_name=self.index_name,
|
||||
)
|
||||
vs.load_index_endpoint(self.index_endpoint)
|
||||
return vs
|
||||
|
||||
@cached_property
|
||||
def embedder(self) -> Embedder:
|
||||
|
||||
Reference in New Issue
Block a user