Skip to content

Commit

Permalink
core[patch]: add InjectedToolArg annotation (#24279)
Browse files Browse the repository at this point in the history
```python
from typing_extensions import Annotated
from langchain_core.tools import tool, InjectedToolArg
from langchain_anthropic import ChatAnthropic

@tool
def multiply(x: int, y: int, not_for_model: Annotated[dict, InjectedToolArg]) -> str:
    """multiply."""
    return x * y 

ChatAnthropic(model='claude-3-sonnet-20240229',).bind_tools([multiply]).invoke('5 times 3').tool_calls
'''
-> [{'name': 'multiply',
  'args': {'x': 5, 'y': 3},
  'id': 'toolu_01Y1QazYWhu4R8vF4hF4z9no',
  'type': 'tool_call'}]
'''
```

---------

Co-authored-by: Bagatur <[email protected]>
Co-authored-by: Bagatur <[email protected]>
  • Loading branch information
3 people authored Jul 17, 2024
1 parent 80f3d48 commit c5a07e2
Show file tree
Hide file tree
Showing 5 changed files with 651 additions and 127 deletions.
Loading

0 comments on commit c5a07e2

Please sign in to comment.