Skip to content

Commit

Permalink
set default model for Anthropic (#655)
Browse files Browse the repository at this point in the history
`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 <[email protected]>
  • Loading branch information
ccurme and eyurtsev authored May 21, 2024
1 parent 4be04bd commit bb74431
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions examples/llm/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

Expand Down
4 changes: 2 additions & 2 deletions examples/router/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

Expand Down

0 comments on commit bb74431

Please sign in to comment.