mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 05:39:12 +00:00
Add subqueries for internet-connected search results and update client-side code accordingly
- Add a wrapper method to help make direct queries to the LLM and determine any intermediate responses needed for handling the request
This commit is contained in:
@@ -100,6 +100,27 @@ def extract_questions(
|
||||
return questions
|
||||
|
||||
|
||||
def send_message_to_model(
|
||||
message,
|
||||
api_key,
|
||||
model,
|
||||
):
|
||||
"""
|
||||
Send message to model
|
||||
"""
|
||||
messages = [ChatMessage(content=message, role="assistant")]
|
||||
|
||||
# Get Response from GPT
|
||||
return completion_with_backoff(
|
||||
messages=messages,
|
||||
model_name=model,
|
||||
temperature=0,
|
||||
max_tokens=100,
|
||||
model_kwargs={"stop": ["A: ", "\n"]},
|
||||
openai_api_key=api_key,
|
||||
)
|
||||
|
||||
|
||||
def converse(
|
||||
references,
|
||||
online_results,
|
||||
|
||||
Reference in New Issue
Block a user