You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def generate_llm_response(messages, processed_results) -> str:
SYSTEM_PROMPT = """You're an AI assistant that writes technical documentation. You can search a vector store for
information relevant to the user's query. Use the provided vector store results to inform your response, but don't
mention the vector store directly."""
vs_results = "\n=========\n".join(
[f"{result.get('chunk_text', 'No text available')}" for result in processed_results]
)
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
*messages,
{
"role": "system",
"content": f"User query: {messages[-1]['content']}\n\nRelevant information:\n{vs_results}",
},
]
return inference.completions(model="qwen2p5-72b-instruct", messages=messages, max_tokens=16000)
def generate_llm_response(messages, processed_results) -> str:
SYSTEM_PROMPT = """You're an AI assistant that writes technical documentation. You can search a vector store for
information relevant to the user's query. Use the provided vector store results to inform your response, but don't
mention the vector store directly."""
Get an LLM response using the vector store
search_query = "example search query"
client_config = ClientConfig(base_url=CONFIG.nearai_hub.base_url, auth=CONFIG.auth)
inference = InferenceRouter(client_config)
vector_results = inference.query_vector_store(vs.id, search_query)
processed_results = process_vector_results([vector_results])
llm_response = generate_llm_response(messages, processed_results)
print(llm_response["choices"][0]["message"]["content"])
The text was updated successfully, but these errors were encountered: