Skip to content

Commit 4fd8e40

Browse files
authored
Merge pull request #1065 from parea-ai/fix-convert-tool-use-response
fix: convert output to tool use response
2 parents cf94179 + 0e998ea commit 4fd8e40

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

parea/schemas/log.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ def convert_to_jsonl_row_for_finetuning(self) -> dict:
8787
jsonl_row["functions"] = tools
8888
else:
8989
tool_calls = tool_calls if isinstance(tool_calls, List) else [tool_calls]
90-
for tool_call in tool_calls:
91-
tool_call["arguments"] = json.dumps(tool_call["arguments"])
90+
tool_calls = [
91+
{"id": tool["id"], "type": "function", "function": {"name": tool["function"]["name"], "arguments": json.dumps(tool["function"]["arguments"])}}
92+
for tool in tool_calls
93+
]
9294
assistant_response = {
9395
"role": "assistant",
9496
"tool_calls": tool_calls,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
66
[tool.poetry]
77
name = "parea-ai"
88
packages = [{ include = "parea" }]
9-
version = "0.2.208"
9+
version = "0.2.209"
1010
description = "Parea python sdk"
1111
readme = "README.md"
1212
authors = ["joel-parea-ai <[email protected]>"]

0 commit comments

Comments
 (0)