Skip to content

Commit

Permalink
anthropic[patch]: integration test update (#18823)
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis authored Mar 8, 2024
1 parent d1f5bc4 commit a8de6d1
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from langchain_anthropic.experimental import ChatAnthropicTools

MODEL_NAME = "claude-3-sonnet-20240229"
BIG_MODEL_NAME = "claude-3-opus-20240229"

#####################################
### Test Basic features, no tools ###
Expand Down Expand Up @@ -108,7 +109,9 @@ class Person(BaseModel):
name: str
age: int

llm = ChatAnthropicTools(model_name=MODEL_NAME).bind_tools([Person])
llm = ChatAnthropicTools(model_name=BIG_MODEL_NAME, temperature=0).bind_tools(
[Person]
)
result = llm.invoke("Erick is 27 years old")
assert result.content == "", f"content should be empty, not {result.content}"
assert "tool_calls" in result.additional_kwargs
Expand All @@ -126,7 +129,9 @@ class Person(BaseModel):
name: str
age: int

chain = ChatAnthropicTools(model_name=MODEL_NAME).with_structured_output(Person)
chain = ChatAnthropicTools(
model_name=BIG_MODEL_NAME, temperature=0
).with_structured_output(Person)
result = chain.invoke("Erick is 27 years old")
assert isinstance(result, Person)
assert result.name == "Erick"
Expand Down Expand Up @@ -167,7 +172,7 @@ class Email(BaseModel):
]
)

llm = ChatAnthropicTools(temperature=0, model_name="claude-3-sonnet-20240229")
llm = ChatAnthropicTools(temperature=0, model_name=BIG_MODEL_NAME)

extraction_chain = prompt | llm.with_structured_output(Email)

Expand Down

0 comments on commit a8de6d1

Please sign in to comment.