mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-14 23:26:34 +00:00
lint
This commit is contained in:
parent
caed4e4ce8
commit
5fc4ec6bc9
@ -1125,19 +1125,19 @@ class ChatAnthropic(BaseChatModel):
|
|||||||
"get_num_tokens_from_messages does not yet support counting tokens "
|
"get_num_tokens_from_messages does not yet support counting tokens "
|
||||||
"in tool calls."
|
"in tool calls."
|
||||||
)
|
)
|
||||||
system, messages = _format_messages(messages)
|
formatted_system, formatted_messages = _format_messages(messages)
|
||||||
if isinstance(system, str):
|
if isinstance(formatted_system, str):
|
||||||
response = self._client.beta.messages.count_tokens(
|
response = self._client.beta.messages.count_tokens(
|
||||||
betas=["token-counting-2024-11-01"],
|
betas=["token-counting-2024-11-01"],
|
||||||
model=self.model,
|
model=self.model,
|
||||||
system=system,
|
system=formatted_system,
|
||||||
messages=messages,
|
messages=formatted_messages, # type: ignore[arg-type]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
response = self._client.beta.messages.count_tokens(
|
response = self._client.beta.messages.count_tokens(
|
||||||
betas=["token-counting-2024-11-01"],
|
betas=["token-counting-2024-11-01"],
|
||||||
model=self.model,
|
model=self.model,
|
||||||
messages=messages,
|
messages=formatted_messages, # type: ignore[arg-type]
|
||||||
)
|
)
|
||||||
return response.input_tokens
|
return response.input_tokens
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ async def test_anthropic_async_streaming_callback() -> None:
|
|||||||
def test_anthropic_multimodal() -> None:
|
def test_anthropic_multimodal() -> None:
|
||||||
"""Test that multimodal inputs are handled correctly."""
|
"""Test that multimodal inputs are handled correctly."""
|
||||||
chat = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg]
|
chat = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg]
|
||||||
messages = [
|
messages: list[BaseMessage] = [
|
||||||
HumanMessage(
|
HumanMessage(
|
||||||
content=[
|
content=[
|
||||||
{
|
{
|
||||||
|
@ -331,7 +331,7 @@ def dummy_tool() -> BaseTool:
|
|||||||
arg1: int = Field(..., description="foo")
|
arg1: int = Field(..., description="foo")
|
||||||
arg2: Literal["bar", "baz"] = Field(..., description="one of 'bar', 'baz'")
|
arg2: Literal["bar", "baz"] = Field(..., description="one of 'bar', 'baz'")
|
||||||
|
|
||||||
class DummyFunction(BaseTool):
|
class DummyFunction(BaseTool): # type: ignore[override]
|
||||||
args_schema: Type[BaseModel] = Schema
|
args_schema: Type[BaseModel] = Schema
|
||||||
name: str = "dummy_function"
|
name: str = "dummy_function"
|
||||||
description: str = "dummy function"
|
description: str = "dummy function"
|
||||||
|
Loading…
Reference in New Issue
Block a user