You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/partners/robocorp
Bagatur 236e957abb
core,groq,openai,mistralai,robocorp,fireworks,anthropic[patch]: Update BaseModel subclass and instance checks to handle both v1 and proper namespaces (#24417)
After this PR chat models will correctly handle pydantic 2 with
bind_tools and with_structured_output.


```python
import pydantic
print(pydantic.__version__)
```
2.8.2

```python
from langchain_openai import ChatOpenAI
from pydantic import BaseModel, Field

class Add(BaseModel):
    x: int
    y: int

model = ChatOpenAI().bind_tools([Add])
print(model.invoke('2 + 5').tool_calls)

model = ChatOpenAI().with_structured_output(Add)
print(type(model.invoke('2 + 5')))
```

```
[{'name': 'Add', 'args': {'x': 2, 'y': 5}, 'id': 'call_PNUFa4pdfNOYXxIMHc6ps2Do', 'type': 'tool_call'}]
<class '__main__.Add'>
```


```python
from langchain_openai import ChatOpenAI
from pydantic.v1 import BaseModel, Field

class Add(BaseModel):
    x: int
    y: int

model = ChatOpenAI().bind_tools([Add])
print(model.invoke('2 + 5').tool_calls)

model = ChatOpenAI().with_structured_output(Add)
print(type(model.invoke('2 + 5')))
```

```python
[{'name': 'Add', 'args': {'x': 2, 'y': 5}, 'id': 'call_hhiHYP441cp14TtrHKx3Upg0', 'type': 'tool_call'}]
<class '__main__.Add'>
```

Addresses issues: https://github.com/langchain-ai/langchain/issues/22782

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2 months ago
..
langchain_robocorp core,groq,openai,mistralai,robocorp,fireworks,anthropic[patch]: Update BaseModel subclass and instance checks to handle both v1 and proper namespaces (#24417) 2 months ago
scripts infra: add print rule to ruff (#16221) 8 months ago
tests infra: update mypy 1.10, ruff 0.5 (#23721) 3 months ago
.gitignore robocorp[minor]: Add robocorp action server toolkit (#15766) 9 months ago
LICENSE robocorp[minor]: Add robocorp action server toolkit (#15766) 9 months ago
Makefile infra: update mypy 1.10, ruff 0.5 (#23721) 3 months ago
README.md robocorp: typo (#22509) 4 months ago
poetry.lock infra: update mypy 1.10, ruff 0.5 (#23721) 3 months ago
pyproject.toml infra: update mypy 1.10, ruff 0.5 (#23721) 3 months ago

README.md

langchain-robocorp

Note: this package is deprecated in favor of the renamed langchain-sema4 package (repo, package).

This package contains the LangChain integrations for Robocorp Action Server. Action Server enables an agent to execute actions in the real world.

Installation

pip install -U langchain-robocorp

Action Server Toolkit

See ActionServerToolkit for detailed documentation.