flowforge-sdk 0.2.2__tar.gz → 0.2.3__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.
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/PKG-INFO +1 -1
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/pyproject.toml +1 -1
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/integrations/fastapi.py +16 -1
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/steps.py +9 -1
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/.gitignore +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/README.md +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/__init__.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/agent.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/agent_def.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/ai/__init__.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/ai/providers.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/client.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/config.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/context.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/decorators.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/dev/__init__.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/dev/server.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/exceptions.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/execution.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/integrations/__init__.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/network.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/router.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/tools.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/triggers.py +0 -0
- {flowforge_sdk-0.2.2 → flowforge_sdk-0.2.3}/src/flowforge/worker.py +0 -0
|
@@ -13,6 +13,21 @@ if TYPE_CHECKING:
|
|
|
13
13
|
from flowforge.decorators import FlowForgeFunction
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
def _make_serializable(obj: Any) -> Any:
|
|
17
|
+
"""Recursively convert non-serializable objects to JSON-safe types."""
|
|
18
|
+
if isinstance(obj, dict):
|
|
19
|
+
return {k: _make_serializable(v) for k, v in obj.items()}
|
|
20
|
+
if isinstance(obj, list):
|
|
21
|
+
return [_make_serializable(item) for item in obj]
|
|
22
|
+
# Convert Tool objects to their OpenAI schema
|
|
23
|
+
if hasattr(obj, "to_openai_schema"):
|
|
24
|
+
return obj.to_openai_schema()
|
|
25
|
+
# Convert any dataclass-like objects with to_dict
|
|
26
|
+
if hasattr(obj, "to_dict") and callable(obj.to_dict):
|
|
27
|
+
return obj.to_dict()
|
|
28
|
+
return obj
|
|
29
|
+
|
|
30
|
+
|
|
16
31
|
async def _handle_invoke(
|
|
17
32
|
request: Request,
|
|
18
33
|
flowforge: "FlowForge",
|
|
@@ -90,7 +105,7 @@ async def _handle_invoke(
|
|
|
90
105
|
attempt=attempt,
|
|
91
106
|
)
|
|
92
107
|
|
|
93
|
-
return JSONResponse(content=result.to_dict())
|
|
108
|
+
return JSONResponse(content=_make_serializable(result.to_dict()))
|
|
94
109
|
|
|
95
110
|
|
|
96
111
|
async def _handle_register(
|
|
@@ -269,6 +269,14 @@ class StepManager:
|
|
|
269
269
|
if messages is None:
|
|
270
270
|
raise ValueError("Either 'prompt' or 'messages' must be provided")
|
|
271
271
|
|
|
272
|
+
# Convert Tool objects to JSON-serializable OpenAI schema dicts
|
|
273
|
+
tools_schema = None
|
|
274
|
+
if tools:
|
|
275
|
+
tools_schema = [
|
|
276
|
+
t.to_openai_schema() if isinstance(t, Tool) else t
|
|
277
|
+
for t in tools
|
|
278
|
+
]
|
|
279
|
+
|
|
272
280
|
# This will be executed by the server/executor with LLM client
|
|
273
281
|
ai_request = {
|
|
274
282
|
"type": "ai",
|
|
@@ -278,7 +286,7 @@ class StepManager:
|
|
|
278
286
|
"temperature": temperature,
|
|
279
287
|
"provider": provider,
|
|
280
288
|
"use_cache": use_cache,
|
|
281
|
-
"tools":
|
|
289
|
+
"tools": tools_schema,
|
|
282
290
|
"tool_choice": tool_choice,
|
|
283
291
|
"max_tool_calls": max_tool_calls,
|
|
284
292
|
**kwargs,
|
|
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
|