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
feat: implement context_builder node with Primary LLM integration
- Add configuration from settings for OpenAI API key
- Implement enriched query construction combining paraphrased text and relevant chunks
- Add Primary LLM call with specialized system prompt for nutrition/culinary topics
- Update state with enriched_query, primary_response, and generated_response
- Add error handling and logging
- Set generated_response for guard_final compatibility (Nodo 7 Generator not yet implemented)
Please provide a comprehensive answer based on the context provided above. If the context does not contain enough information to answer the question, please indicate that clearly."""
64
+
65
+
# System prompt for the Primary LLM
66
+
system_content="""You are a helpful assistant specialized in providing accurate, context-based answers about nutrition and culinary topics.
48
67
49
-
# Call Primary LLM
50
-
response=llm.invoke(messages)
68
+
Your task is to:
69
+
1. Use the provided context to answer the user's question accurately
70
+
2. If the context contains relevant information, provide a comprehensive answer
71
+
3. If the context does not contain enough information, clearly state that you don't have sufficient information in the knowledge base
72
+
4. Always base your answer on the provided context - do not make up information
73
+
5. If the question is not related to the context, politely redirect the conversation
51
74
52
-
return {"messages": [response]}
75
+
Be concise, accurate, and helpful."""
76
+
77
+
# Prepare messages for LLM
78
+
messages_for_llm= [
79
+
SystemMessage(content=system_content),
80
+
HumanMessage(content=enriched_query)
81
+
]
82
+
83
+
try:
84
+
# Call Primary LLM
85
+
logger.info("Calling Primary LLM with enriched query")
0 commit comments