Feat: Pulumi S3
This commit is contained in:
@@ -2,17 +2,16 @@ from langchain_core.messages import HumanMessage, AIMessage, SystemMessage
|
||||
from langfuse.langchain import CallbackHandler
|
||||
|
||||
from .config import REGION
|
||||
from .dynamo import langfuse, get_contexto
|
||||
from .agent_bedrock import create_agent
|
||||
from .tools import ReportTools
|
||||
from .tools import build_knowledge_base_tool
|
||||
|
||||
|
||||
def main(user_query, history, model, base):
|
||||
def main(user_query, history, model="anthropic.claude-sonnet-4-5-20250929-v1:0"):
|
||||
"""Main execution function."""
|
||||
report_tools = []
|
||||
report_tools = [build_knowledge_base_tool()]
|
||||
|
||||
|
||||
SYSTEM_PROMPT = """"""
|
||||
SYSTEM_PROMPT = """Você é um assistente de matrículas para o campus capivari do instituo federal de são paulo, tem acesso a uma tool que acessa uma knowledge base com informações sobre tanto a matricula dos alunos do técnico quanto superior do procedimento iterno, não responda perguntas sobre o meio de ingresso SISU."""
|
||||
langfuse_handler = CallbackHandler()
|
||||
agent = create_agent(model, REGION, tools=report_tools)
|
||||
|
||||
@@ -24,7 +23,7 @@ def main(user_query, history, model, base):
|
||||
"current_step": "init",
|
||||
}
|
||||
|
||||
config = {"callbacks": [langfuse_handler], "tags": [base]}
|
||||
config = {"callbacks": [langfuse_handler]}
|
||||
final_state = agent.invoke(initial_state, config=config)
|
||||
|
||||
total_input_tokens = 0
|
||||
@@ -33,8 +32,6 @@ def main(user_query, history, model, base):
|
||||
if isinstance(msg, AIMessage) and hasattr(msg, "usage_metadata") and msg.usage_metadata:
|
||||
total_input_tokens += msg.usage_metadata.get("input_tokens", 0)
|
||||
total_output_tokens += msg.usage_metadata.get("output_tokens", 0)
|
||||
|
||||
langfuse.flush()
|
||||
return {
|
||||
"response": final_state["messages"][-1].content,
|
||||
"input_tokens": total_input_tokens,
|
||||
|
||||
Reference in New Issue
Block a user