From bb74431183277e5a640e4c343f0a134525eb6eef Mon Sep 17 00:00:00 2001 From: ccurme Date: Tue, 21 May 2024 10:41:21 -0700 Subject: [PATCH] set default model for Anthropic (#655) `ChatAnthropic()` raises ValidationError. Also set model for ChatOpenAI where it appears alongside anthropic. Best to be explicit about model, otherwise new defaults will cause unexpected changes. Co-authored-by: Eugene Yurtsev --- README.md | 6 +++--- examples/llm/server.py | 4 ++-- examples/router/server.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d8faf9e3..9c58320f 100644 --- a/README.md +++ b/README.md @@ -167,17 +167,17 @@ app = FastAPI( add_routes( app, - ChatOpenAI(), + ChatOpenAI(model="gpt-3.5-turbo-0125"), path="/openai", ) add_routes( app, - ChatAnthropic(), + ChatAnthropic(model="claude-3-haiku-20240307"), path="/anthropic", ) -model = ChatAnthropic() +model = ChatAnthropic(model="claude-3-haiku-20240307") prompt = ChatPromptTemplate.from_template("tell me a joke about {topic}") add_routes( app, diff --git a/examples/llm/server.py b/examples/llm/server.py index 81999f30..2a119ee0 100755 --- a/examples/llm/server.py +++ b/examples/llm/server.py @@ -15,12 +15,12 @@ add_routes( app, - ChatOpenAI(), + ChatOpenAI(model="gpt-3.5-turbo-0125"), path="/openai", ) add_routes( app, - ChatAnthropic(), + ChatAnthropic(model="claude-3-haiku-20240307"), path="/anthropic", ) diff --git a/examples/router/server.py b/examples/router/server.py index 985bea10..a235f6b5 100755 --- a/examples/router/server.py +++ b/examples/router/server.py @@ -21,13 +21,13 @@ # Invocations to this router will appear in trace logs as /models/openai add_routes( router, - ChatOpenAI(), + ChatOpenAI(model="gpt-3.5-turbo-0125"), path="/openai", ) # Invocations to this router will appear in trace logs as /models/anthropic add_routes( router, - ChatAnthropic(), + ChatAnthropic(model="claude-3-haiku-20240307"), path="/anthropic", )