mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-14 15:16:21 +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 "
|
||||
"in tool calls."
|
||||
)
|
||||
system, messages = _format_messages(messages)
|
||||
if isinstance(system, str):
|
||||
formatted_system, formatted_messages = _format_messages(messages)
|
||||
if isinstance(formatted_system, str):
|
||||
response = self._client.beta.messages.count_tokens(
|
||||
betas=["token-counting-2024-11-01"],
|
||||
model=self.model,
|
||||
system=system,
|
||||
messages=messages,
|
||||
system=formatted_system,
|
||||
messages=formatted_messages, # type: ignore[arg-type]
|
||||
)
|
||||
else:
|
||||
response = self._client.beta.messages.count_tokens(
|
||||
betas=["token-counting-2024-11-01"],
|
||||
model=self.model,
|
||||
messages=messages,
|
||||
messages=formatted_messages, # type: ignore[arg-type]
|
||||
)
|
||||
return response.input_tokens
|
||||
|
||||
|
@ -317,7 +317,7 @@ async def test_anthropic_async_streaming_callback() -> None:
|
||||
def test_anthropic_multimodal() -> None:
|
||||
"""Test that multimodal inputs are handled correctly."""
|
||||
chat = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg]
|
||||
messages = [
|
||||
messages: list[BaseMessage] = [
|
||||
HumanMessage(
|
||||
content=[
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ def dummy_tool() -> BaseTool:
|
||||
arg1: int = Field(..., description="foo")
|
||||
arg2: Literal["bar", "baz"] = Field(..., description="one of 'bar', 'baz'")
|
||||
|
||||
class DummyFunction(BaseTool):
|
||||
class DummyFunction(BaseTool): # type: ignore[override]
|
||||
args_schema: Type[BaseModel] = Schema
|
||||
name: str = "dummy_function"
|
||||
description: str = "dummy function"
|
||||
|
Loading…
Reference in New Issue
Block a user