Skip to content

Commit 5ee2ee0

Browse files
committed
fix: pydantic ai proper schema and events payload
1 parent d8fa474 commit 5ee2ee0

15 files changed

Lines changed: 855 additions & 132 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ All packages extend the [UiPath Python SDK](https://github.com/UiPath/uipath-pyt
1313
| [LlamaIndex](https://www.llamaindex.ai/) | [![PyPI](https://img.shields.io/pypi/v/uipath-llamaindex)](https://pypi.org/project/uipath-llamaindex/) | [![Downloads](https://img.shields.io/pypi/dm/uipath-llamaindex.svg)](https://pypi.org/project/uipath-llamaindex/) | [README](packages/uipath-llamaindex/README.md) · [Docs](https://uipath.github.io/uipath-python/llamaindex/quick_start/) · [Samples](packages/uipath-llamaindex/samples/) |
1414
| [Microsoft Agent Framework](https://github.com/microsoft/agent-framework) | [![PyPI](https://img.shields.io/pypi/v/uipath-agent-framework)](https://pypi.org/project/uipath-agent-framework/) | [![Downloads](https://img.shields.io/pypi/dm/uipath-agent-framework.svg)](https://pypi.org/project/uipath-agent-framework/) | [README](packages/uipath-agent-framework/README.md) · [Samples](packages/uipath-agent-framework/samples/) |
1515
| [OpenAI Agents](https://github.com/openai/openai-agents-python) | [![PyPI](https://img.shields.io/pypi/v/uipath-openai-agents)](https://pypi.org/project/uipath-openai-agents/) | [![Downloads](https://img.shields.io/pypi/dm/uipath-openai-agents.svg)](https://pypi.org/project/uipath-openai-agents/) | [README](packages/uipath-openai-agents/README.md) · [Docs](https://uipath.github.io/uipath-python/openai-agents/quick_start/) · [Samples](packages/uipath-openai-agents/samples/) |
16+
| [PydanticAI](https://github.com/pydantic/pydantic-ai) | [![PyPI](https://img.shields.io/pypi/v/uipath-pydantic-ai)](https://pypi.org/project/uipath-pydantic-ai/) | [![Downloads](https://img.shields.io/pypi/dm/uipath-pydantic-ai.svg)](https://pypi.org/project/uipath-pydantic-ai/) | [README](packages/uipath-pydantic-ai/README.md) · [Samples](packages/uipath-pydantic-ai/samples/) |
1617

1718

1819
## Structure
@@ -25,7 +26,8 @@ uipath-integrations-python/
2526
├── uipath-llamaindex/ # LlamaIndex runtime
2627
├── uipath-openai-agents/ # OpenAI Agents runtime
2728
├── uipath-google-adk/ # Google ADK runtime
28-
└── uipath-agent-framework/ # Microsoft Agent Framework runtime
29+
├── uipath-agent-framework/ # Microsoft Agent Framework runtime
30+
└── uipath-pydantic-ai/ # PydanticAI runtime
2931
```
3032

3133
## Development

packages/uipath-pydantic-ai/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-pydantic-ai"
3-
version = "0.0.1"
3+
version = "0.0.2"
44
description = "Python SDK that enables developers to build and deploy PydanticAI agents to the UiPath Cloud Platform"
55
readme = "README.md"
66
requires-python = ">=3.11"

packages/uipath-pydantic-ai/samples/graph-flow/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ flowchart TB
3434
## Run
3535

3636
```
37-
uipath run agent '{"messages": "Write a blog post about the future of AI agents"}'
37+
uipath run agent '{"messages": [{"contentParts": [{"data": {"inline": "Write a blog post about the future of AI agents"}}], "role": "user"}]}'
3838
```
3939

4040
## Debug

packages/uipath-pydantic-ai/samples/multi-agent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ flowchart TB
1919
## Run
2020

2121
```
22-
uipath run agent '{"messages": "Write a report about machine learning"}'
22+
uipath run agent '{"messages": [{"contentParts": [{"data": {"inline": "Write a report about machine learning"}}], "role": "user"}]}'
2323
```
2424

2525
## Debug

packages/uipath-pydantic-ai/samples/programmatic-handoff/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ flowchart TB
2424
## Run
2525

2626
```
27-
uipath run agent '{"messages": "I was charged twice for my subscription last month"}'
27+
uipath run agent '{"messages": [{"contentParts": [{"data": {"inline": "I was charged twice for my subscription last month"}}], "role": "user"}]}'
2828
```
2929

3030
## Debug

packages/uipath-pydantic-ai/samples/quickstart-agent/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ flowchart TB
1919
## Run
2020

2121
```
22-
uipath run agent '{"messages": "What is the weather in San Francisco?"}'
22+
uipath run agent '{"messages": [{"contentParts": [{"data": {"inline": "What is the weather in San Francisco?"}}], "role": "user"}]}'
2323
```
2424

2525
## Debug
2626

2727
```
28-
uipath dev web
28+
uipath dev
2929
```

packages/uipath-pydantic-ai/samples/quickstart-agent/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import httpx
2-
from pydantic_ai import Agent
2+
from pydantic_ai import Agent, RunContext
33

44
from uipath_pydantic_ai.chat import UiPathChatOpenAI
55

66

7-
def get_weather(ctx, location: str) -> str:
7+
def get_weather(ctx: RunContext[None], location: str) -> str:
88
"""Get the current weather for a location using the Open-Meteo API.
99
1010
Args:

packages/uipath-pydantic-ai/samples/quickstart-agent/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ requires-python = ">=3.11"
88
dependencies = [
99
"uipath",
1010
"uipath-pydantic-ai",
11-
"pydantic-ai>=0.1.0",
11+
"pydantic-ai>=1.63.0",
1212
]
1313

1414
[dependency-groups]

packages/uipath-pydantic-ai/src/uipath_pydantic_ai/chat/openai.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import httpx
77
from openai import AsyncOpenAI, OpenAI
8-
from pydantic_ai.models.openai import OpenAIModel
8+
from pydantic_ai.models.openai import OpenAIChatModel
99
from pydantic_ai.providers.openai import OpenAIProvider
1010
from uipath._utils._ssl_context import get_httpx_client_kwargs
1111
from uipath.utils import EndpointManager
@@ -74,7 +74,7 @@ class UiPathChatOpenAI:
7474
7575
This client wraps the OpenAI SDK and configures it to use UiPath's
7676
LLM Gateway endpoints with proper authentication and headers.
77-
Returns PydanticAI-compatible OpenAIModel instances.
77+
Returns PydanticAI-compatible OpenAIChatModel instances.
7878
7979
Example:
8080
```python
@@ -173,7 +173,7 @@ def __init__(
173173
)
174174

175175
# Create PydanticAI-compatible model
176-
self._model = OpenAIModel(
176+
self._model = OpenAIChatModel(
177177
self._model_name,
178178
provider=OpenAIProvider(openai_client=self._async_client),
179179
)
@@ -225,8 +225,8 @@ def _build_base_url(self) -> str:
225225
raise ValueError("UIPATH_URL environment variable is required")
226226

227227
@property
228-
def model(self) -> OpenAIModel:
229-
"""Get the PydanticAI-compatible OpenAIModel."""
228+
def model(self) -> OpenAIChatModel:
229+
"""Get the PydanticAI-compatible OpenAIChatModel."""
230230
return self._model
231231

232232
@property

packages/uipath-pydantic-ai/src/uipath_pydantic_ai/runtime/factory.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def _setup_instrumentation(self) -> None:
5858
self.context.trace_manager.add_span_processor(
5959
OpenInferenceSpanProcessor()
6060
)
61+
Agent.instrument_all()
6162
except Exception:
6263
pass
6364

0 commit comments

Comments
 (0)