diff --git a/agents.tar b/agents.tar new file mode 100644 index 0000000..c2c13bf Binary files /dev/null and b/agents.tar differ diff --git a/k8s/curaflow-agent/deployment.yaml b/k8s/curaflow-agent/deployment.yaml index faf34e3..19e814e 100644 --- a/k8s/curaflow-agent/deployment.yaml +++ b/k8s/curaflow-agent/deployment.yaml @@ -30,10 +30,10 @@ spec: value: "default" - name: CURAFLOW_TASK_QUEUE value: "curaflow-tasks" - - name: OLLAMA_BASE_URL - value: "http://ollama.ai-core.svc.cluster.local:11434/v1" + - name: ANTHROPIC_API_KEY + value: "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" - name: LLM_MODEL - value: "qwen2.5:3b" + value: "claude-3-haiku-20240307" resources: limits: cpu: 500m diff --git a/requirements.txt b/requirements.txt index 1b59aee..0b58354 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ requests langchain langchain-openai +langchain-anthropic temporalio pydantic diff --git a/src/curaflow_agent/activities.py b/src/curaflow_agent/activities.py index 3a251e4..1aca744 100644 --- a/src/curaflow_agent/activities.py +++ b/src/curaflow_agent/activities.py @@ -2,23 +2,20 @@ import os import json from temporalio import activity from langchain_openai import ChatOpenAI +from langchain_anthropic import ChatAnthropic from langchain_core.prompts import PromptTemplate from pydantic import BaseModel, Field from .models import ClinicalNote, BillingCodesOutput from .lab_models import AnomalyReport -# In the cluster, Ollama provides an OpenAI-compatible endpoint. -# We fetch model/URL from env vars so it's easy to override for testing. -OLLAMA_BASE_URL = os.environ.get("OLLAMA_BASE_URL", "http://ollama.ai-core.svc.cluster.local:11434/v1") -LLM_MODEL = os.environ.get("LLM_MODEL", "qwen2.5:3b") +ANTHROPIC_API_KEY = os.environ.get("ANTHROPIC_API_KEY", "") +LLM_MODEL = os.environ.get("LLM_MODEL", "claude-3-haiku-20240307") def get_llm(): - return ChatOpenAI( + return ChatAnthropic( model=LLM_MODEL, - api_key="ollama", # Ollama doesn't strictly need an API key - base_url=OLLAMA_BASE_URL, + api_key=ANTHROPIC_API_KEY, temperature=0.1, - model_kwargs={"response_format": {"type": "json_object"}} ) @activity.defn @@ -187,6 +184,9 @@ async def parse_booking_intent_activity(chat_history: list[dict]) -> dict: "Analyze the conversation. Extract any appointment details (department, date, time).\n" "If they want to book an appointment but haven't specified department, date, and time, " "add those to missing_info and formulate a reply_message asking for them.\n" + "CRITICAL INSTRUCTIONS FOR ASKING:\n" + "- If the user hasn't specified a department, you MUST list the 4 available departments (Cardiology, General Medicine, Pediatrics, Orthopedics) so they know what to choose. Do not make them guess!\n" + "- If they haven't specified a time, suggest common intervals (e.g. 10:00 AM, 11:00 AM, 6:00 PM).\n" "If all details are present, set missing_info to empty and formulate a confirmation reply_message.\n" "Format output strictly as JSON matching the schema." )