Skip to content

Commit

Permalink
callback for vectorStore tool
Browse files Browse the repository at this point in the history
  • Loading branch information
minump committed Nov 22, 2023
1 parent e725235 commit a6d2ebd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ai_ta_backend/agents/vector_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
langchain.debug = False
VERBOSE = True

def get_vectorstore_retriever_tool(course_name: str, name: str, description: str, openai_model_name='gpt-3.5-turbo-16k', temperature=0.1, top_k=8) -> VectorStoreQATool:
def get_vectorstore_retriever_tool(course_name: str, name: str, description: str,
openai_model_name='gpt-3.5-turbo-16k', temperature=0.1, top_k=8,
callbacks=None) -> VectorStoreQATool:
"""
course name str: Name of course on uiuc-chat as appears in URL-bar; yes it's case sensitive.
callbacks: list of callbacks to pass to the LLM. See ai_ta_backend/agents/customcallbacks.py for an example.
Usage:
```
Expand Down Expand Up @@ -49,7 +52,8 @@ def get_vectorstore_retriever_tool(course_name: str, name: str, description: str
llm=ChatOpenAI(model_name=openai_model_name, temperature=temperature), # type: ignore
name=name,
description=description,
retriever_kwargs={'filter': {'course_name': course_name, 'k': top_k}}
retriever_kwargs={'filter': {'course_name': course_name, 'k': top_k}},
callbacks=callbacks
)
except Exception as e:
# return full traceback to front end
Expand Down

0 comments on commit a6d2ebd

Please sign in to comment.