Skip to content

Commit

Permalink
Allow using configured GPT chat model (#292)
Browse files Browse the repository at this point in the history
My account doesn't have gpt-4 enabled and it wouldn't work as the default value was always used from extract_questions, where the caller could use the configured model.
  • Loading branch information
tjsousa authored Jul 10, 2023
1 parent 75ff871 commit 5b37e98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/khoj/routers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,15 @@ async def extract_references_and_questions(

# Initialize Variables
api_key = state.processor_config.conversation.openai_api_key
chat_model = state.processor_config.conversation.chat_model
conversation_type = "general" if q.startswith("@general") else "notes"
compiled_references = []
inferred_queries = []

if conversation_type == "notes":
# Infer search queries from user message
with timer("Extracting search queries took", logger):
inferred_queries = extract_questions(q, api_key=api_key, conversation_log=meta_log)
inferred_queries = extract_questions(q, model=chat_model, api_key=api_key, conversation_log=meta_log)

# Collate search results as context for GPT
with timer("Searching knowledge base took", logger):
Expand Down

0 comments on commit 5b37e98

Please sign in to comment.