pyagentic-core 2.3.0a2__tar.gz → 2.3.0a4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyagentic_core-2.3.0a2/pyagentic_core.egg-info → pyagentic_core-2.3.0a4}/PKG-INFO +1 -1
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_agent/_agent.py +8 -3
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_utils/_image.py +1 -1
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/llm/_openai.py +6 -3
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/models/llm.py +3 -4
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/models/response.py +3 -1
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4/pyagentic_core.egg-info}/PKG-INFO +1 -1
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyproject.toml +1 -1
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/LICENSE +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/README.md +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/__init__.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/__init__.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_agent/__init__.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_agent/_agent_linking.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_agent/_agent_state.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_exceptions.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_info.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_metaclasses.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_ref.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_spec.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_state.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_tool.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_base/_validation.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_utils/_typing.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/_utils/_warnings.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/llm/__init__.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/llm/_anthropic.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/llm/_gemini.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/llm/_mock.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/llm/_openaiv1.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/llm/_provider.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/logging.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/models/tracing.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/policies/__init__.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/policies/_events.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/policies/_policy.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/tracing/__init__.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/tracing/_basic.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/tracing/_langfuse.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/tracing/_tracer.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic/updates.py +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic_core.egg-info/SOURCES.txt +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic_core.egg-info/dependency_links.txt +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic_core.egg-info/requires.txt +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic_core.egg-info/top_level.txt +0 -0
- {pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/setup.cfg +0 -0
|
@@ -38,7 +38,7 @@ from pyagentic.llm._provider import LLMProvider
|
|
|
38
38
|
from pyagentic.llm import LLMProviders
|
|
39
39
|
from pyagentic.tracing._tracer import AgentTracer, traced
|
|
40
40
|
from pyagentic.tracing import BasicTracer
|
|
41
|
-
|
|
41
|
+
from pyagentic._utils._image import _encode_image
|
|
42
42
|
|
|
43
43
|
logger = get_logger(__name__)
|
|
44
44
|
|
|
@@ -437,8 +437,11 @@ class BaseAgent(metaclass=AgentMeta):
|
|
|
437
437
|
stringified_result = f"[Image returned by {tool_call.name}]"
|
|
438
438
|
# Add tool result message
|
|
439
439
|
self.state._messages.append(
|
|
440
|
-
self.provider.to_tool_call_result_message(
|
|
440
|
+
self.provider.to_tool_call_result_message(
|
|
441
|
+
result=stringified_result, id_=tool_call.id
|
|
442
|
+
)
|
|
441
443
|
)
|
|
444
|
+
result = _encode_image(result)
|
|
442
445
|
# Add the image as a user message so the LLM can see it
|
|
443
446
|
self.state._messages.append(
|
|
444
447
|
Message(role="user", content=f"Image from {tool_call.name}:", image=result)
|
|
@@ -451,7 +454,9 @@ class BaseAgent(metaclass=AgentMeta):
|
|
|
451
454
|
)
|
|
452
455
|
# Add tool result to conversation history for LLM
|
|
453
456
|
self.state._messages.append(
|
|
454
|
-
self.provider.to_tool_call_result_message(
|
|
457
|
+
self.provider.to_tool_call_result_message(
|
|
458
|
+
result=stringified_result, id_=tool_call.id
|
|
459
|
+
)
|
|
455
460
|
)
|
|
456
461
|
|
|
457
462
|
if self.phases:
|
|
@@ -106,13 +106,16 @@ class OpenAIProvider(LLMProvider):
|
|
|
106
106
|
|
|
107
107
|
# If message has an image, convert to OpenAI's content array format
|
|
108
108
|
if message.image is not None:
|
|
109
|
-
image_url = _encode_image(message.image)
|
|
110
|
-
|
|
111
109
|
# Build content array with text and image
|
|
112
110
|
content = []
|
|
113
111
|
if message.content:
|
|
114
112
|
content.append({"type": "text", "text": message.content})
|
|
115
|
-
content.append(
|
|
113
|
+
content.append(
|
|
114
|
+
{
|
|
115
|
+
"type": "image_url",
|
|
116
|
+
"image_url": {"url": f"data:image/png;base64,{message.image}"},
|
|
117
|
+
}
|
|
118
|
+
)
|
|
116
119
|
|
|
117
120
|
msg_dict["content"] = content
|
|
118
121
|
# Remove the image field as it's now in content
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
from typing import Any, List, Optional
|
|
1
|
+
from typing import Any, List, Optional
|
|
2
2
|
from pydantic import BaseModel, ConfigDict
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from PIL.Image import Image
|
|
4
|
+
from PIL.Image import Image
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
class Message(BaseModel):
|
|
@@ -18,7 +17,7 @@ class Message(BaseModel):
|
|
|
18
17
|
type: Optional[str] = None
|
|
19
18
|
role: Optional[str] = None
|
|
20
19
|
content: Optional[str] = None
|
|
21
|
-
image: Optional[
|
|
20
|
+
image: Optional[str] = None
|
|
22
21
|
|
|
23
22
|
def to_dict(self, exclude_none: bool = True):
|
|
24
23
|
"""
|
|
@@ -69,8 +69,10 @@ class ToolResponse(BaseModel):
|
|
|
69
69
|
case _:
|
|
70
70
|
raise Exception(f"Unsupported type: {param_type}")
|
|
71
71
|
|
|
72
|
+
return_type = str if tool_def.return_type == Image else tool_def.return_type
|
|
73
|
+
|
|
72
74
|
return create_model(
|
|
73
|
-
f"ToolResponse[{tool_def.name}]", __base__=cls, output=
|
|
75
|
+
f"ToolResponse[{tool_def.name}]", __base__=cls, output=return_type, **fields
|
|
74
76
|
)
|
|
75
77
|
|
|
76
78
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyagentic_core-2.3.0a2 → pyagentic_core-2.3.0a4}/pyagentic_core.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|