Skip to content

Commit

Permalink
api method update
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesun committed Nov 28, 2023
1 parent 0e7256e commit 4ebc9c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,14 @@ async def create_index(item: IndexItem, td: TokenData = Depends(verify_api_key))

@app.get("/knowledge/query", summary="query the knowledge base",
description="query the knowledge base for relevant content")
async def search_index(collection: Optional[str] = None, query: Optional[str] = None,
td: TokenData = Depends(verify_api_key)):
async def search_index(
collection: str = Query(..., description="The name of the collection to query"),
query: str = Query(..., description="The query string to search for in the collection"),
td: TokenData = Depends(verify_api_key)
):
"""Search the knowledge base to return relevant content"""
try:
log.info(f"search_index: {collection}")
log.info(f"search_index: collection={collection}, query={query}")
result = await qdrant.search(collection, query)
return RestResult(code=0, msg="ok", result=dict(data=result))
except Exception as e:
Expand Down

0 comments on commit 4ebc9c0

Please sign in to comment.