Skip to content

Commit

Permalink
Update models (#208)
Browse files Browse the repository at this point in the history
* Update OpenAI models

* Add anthropic to .env.example

---------

Co-authored-by: Dan Orlando <daorlando@webmd.net>
  • Loading branch information
danorlando and Dan Orlando authored Sep 24, 2024
1 parent 05c65c0 commit a5af1bb
Show file tree
Hide file tree
Showing 10 changed files with 5,491 additions and 6,464 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,8 @@ GOOGLE_CLIENT_SECRET=<GOOGLE_CLIENT_SECRET>
OIDC_CLIENT_ID=<OIDC_CLIENT_ID>
OIDC_CLIENT_SECRET=<OIDC_CLIENT_SECRET>
OIDC_WELL_KNOWN_ENDPOINT=<OIDC_WELL_KNOWN_ENDPOINT>


# For Anthropic Claude API
ANTHROPIC_MODEL_NAME="claude-3-5-sonnet-20240620"
ANTHROPIC_API_KEY=""
8 changes: 4 additions & 4 deletions docs/assistants.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ The setup is unique in that it is meant to be easily modified as new agent archi
"type": "agent",
"type==agent/tools": [],
"type==agent/interupt_before_action": true,
"type==agent/agent_type": "GPT 3.5 Turbo",
"type==agent/agent_type": "GPT 4o Mini",
"type==agent/system_message": "You are a helpful assistant.",
"type==agent/retrieval_description": "Can be used to look up information.",
"type==chat_retrieval/system_message": "You are a helpful assistant.",
"type==chatbot/llm_type": "GPT 3.5 Turbo",
"type==chatbot/llm_type": "GPT 4o Mini",
"type==chatbot/system_message": "You are a helpful assistant.",
"type==chat_retrieval/llm_type": "GPT 3.5 Turbo"
"type==chat_retrieval/llm_type": "GPT 4o Mini"
}
}
```
Expand All @@ -39,7 +39,7 @@ In this example, there are three assistant architectures: agent, chatbot, and ch
"type": "agent",
"type==agent/tools": [],
"type==agent/interupt_before_action": true,
"type==agent/agent_type": "GPT 3.5 Turbo",
"type==agent/agent_type": "GPT 4o Mini",
"type==agent/system_message": "You are a helpful assistant.",
"type==agent/retrieval_description": "Can be used to look up information."
}
Expand Down
24 changes: 12 additions & 12 deletions stack/app/agents/configurable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@


def get_llm(llm_type: LLMType):
if llm_type == LLMType.GPT_35_TURBO:
if llm_type == LLMType.GPT_4O_MINI:
llm = get_openai_llm()
elif llm_type == LLMType.GPT_4:
llm = get_openai_llm(model="gpt-4-turbo")
elif llm_type == LLMType.GPT_4O:
llm = get_openai_llm(model="gpt-4o")
elif llm_type == LLMType.AZURE_OPENAI:
llm = get_openai_llm(azure=True)
elif llm_type == LLMType.CLAUDE2:
elif llm_type == LLMType.ANTHROPIC_CLAUDE:
llm = get_anthropic_llm()
elif llm_type == LLMType.BEDROCK_CLAUDE2:
elif llm_type == LLMType.BEDROCK_ANTHROPIC_CLAUDE:
llm = get_anthropic_llm(bedrock=True)
elif llm_type == LLMType.GEMINI:
llm = get_google_llm()
Expand All @@ -95,7 +95,7 @@ def get_agent_executor(
system_message: str,
interrupt_before_action: bool,
):
if agent == AgentType.GPT_35_TURBO:
if agent == AgentType.GPT_4O_MINI:
llm = get_openai_llm()
return get_tools_agent_executor(
tools, llm, system_message, interrupt_before_action, CHECKPOINTER
Expand All @@ -115,12 +115,12 @@ def get_agent_executor(
return get_tools_agent_executor(
tools, llm, system_message, interrupt_before_action, CHECKPOINTER
)
elif agent == AgentType.CLAUDE2:
elif agent == AgentType.ANTHROPIC_CLAUDE:
llm = get_anthropic_llm()
return get_tools_agent_executor(
tools, llm, system_message, interrupt_before_action, CHECKPOINTER
)
elif agent == AgentType.BEDROCK_CLAUDE2:
elif agent == AgentType.BEDROCK_ANTHROPIC_CLAUDE:
llm = get_anthropic_llm(bedrock=True)
return get_xml_agent_executor(
tools, llm, system_message, interrupt_before_action, CHECKPOINTER
Expand Down Expand Up @@ -154,7 +154,7 @@ def __init__(
self,
*,
tools: Sequence[Tool],
agent: AgentType = AgentType.GPT_35_TURBO,
agent: AgentType = AgentType.GPT_4O_MINI,
system_message: str = DEFAULT_SYSTEM_MESSAGE,
assistant_id: Optional[str] = None,
thread_id: Optional[str] = None,
Expand Down Expand Up @@ -216,7 +216,7 @@ class ConfigurableChatBot(RunnableBinding):
def __init__(
self,
*,
llm: LLMType = LLMType.GPT_35_TURBO,
llm: LLMType = LLMType.GPT_4O_MINI,
system_message: str = DEFAULT_SYSTEM_MESSAGE,
kwargs: Optional[Mapping[str, Any]] = None,
config: Optional[Mapping[str, Any]] = None,
Expand All @@ -235,7 +235,7 @@ def __init__(


chatbot = (
ConfigurableChatBot(llm=LLMType.GPT_35_TURBO, checkpoint=CHECKPOINTER)
ConfigurableChatBot(llm=LLMType.GPT_4O_MINI, checkpoint=CHECKPOINTER)
.configurable_fields(
llm=ConfigurableField(id="llm_type", name="LLM Type"),
system_message=ConfigurableField(id="system_message", name="Instructions"),
Expand All @@ -257,7 +257,7 @@ class ConfigurableRetrieval(RunnableBinding):
def __init__(
self,
*,
llm_type: LLMType = LLMType.GPT_35_TURBO,
llm_type: LLMType = LLMType.GPT_4O_MINI,
system_message: str = DEFAULT_SYSTEM_MESSAGE,
assistant_id: Optional[str] = None,
thread_id: Optional[str] = None,
Expand All @@ -279,7 +279,7 @@ def __init__(


chat_retrieval = (
ConfigurableRetrieval(llm_type=LLMType.GPT_35_TURBO, checkpoint=CHECKPOINTER)
ConfigurableRetrieval(llm_type=LLMType.GPT_4O_MINI, checkpoint=CHECKPOINTER)
.configurable_fields(
llm_type=ConfigurableField(id="llm_type", name="LLM Type"),
system_message=ConfigurableField(id="system_message", name="Instructions"),
Expand All @@ -297,7 +297,7 @@ def __init__(

agent: Pregel = (
ConfigurableAgent(
agent=AgentType.GPT_35_TURBO,
agent=AgentType.GPT_4O_MINI,
tools=[],
system_message=DEFAULT_SYSTEM_MESSAGE,
retrieval_description=RETRIEVAL_DESCRIPTION,
Expand Down
16 changes: 8 additions & 8 deletions stack/app/schema/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ class BotType(str, Enum):


class AgentType(str, Enum):
GPT_35_TURBO = "GPT 3.5 Turbo"
GPT_4O_MINI = "GPT 4o Mini"
GPT_4 = "GPT 4 Turbo"
GPT_4O = "GPT 4o"
AZURE_OPENAI = "GPT 4 (Azure OpenAI)"
CLAUDE2 = "Claude 2"
BEDROCK_CLAUDE2 = "Claude 2 (Amazon Bedrock)"
ANTHROPIC_CLAUDE = "Anthropic Claude"
BEDROCK_ANTHROPIC_CLAUDE = "Anthropic Claude (Amazon Bedrock)"
GEMINI = "GEMINI"
OLLAMA = "Ollama"


class LLMType(str, Enum):
GPT_35_TURBO = "GPT 3.5 Turbo"
GPT_4O_MINI = "GPT 4o Mini"
GPT_4 = "GPT 4"
GPT_4O = "GPT 4o"
AZURE_OPENAI = "GPT 4 (Azure OpenAI)"
CLAUDE2 = "Claude 2"
BEDROCK_CLAUDE2 = "Claude 2 (Amazon Bedrock)"
ANTHROPIC_CLAUDE = "Anthropic Claude"
BEDROCK_ANTHROPIC_CLAUDE = "Anthropic Claude (Amazon Bedrock)"
GEMINI = "GEMINI"
MIXTRAL = "Mixtral"
OLLAMA = "Ollama"
Expand Down Expand Up @@ -63,7 +63,7 @@ class Configurable(BaseModel):
default="agent", title="Bot Type", description="The type of bot."
)
agent_type: AgentType = Field(
default="GPT 3.5 Turbo",
default="GPT 4o Mini",
title="Agent Type",
description="The type of agent, applicable if the bot type is 'agent'.",
)
Expand All @@ -86,7 +86,7 @@ class Configurable(BaseModel):
default=[], title="Tools", description="List of tools available for the agent."
)
llm_type: Optional[LLMType] = Field(
default="GPT 3.5 Turbo",
default="GPT 4o Mini",
title="LLM Type",
description="The type of language model, applicable if the bot type is 'chat_retrieval' or 'chatbot'.",
)
Expand Down
Loading

0 comments on commit a5af1bb

Please sign in to comment.