Skip to content

Commit

Permalink
Fix Parsing ActionCallDeltaMessageContent (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter authored Dec 16, 2024
1 parent 1240b1c commit 6f3cbb9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Agent` unintentionally modifying `stream` for all Prompt Drivers.
- `StructureVisualizer.base_url` for setting the base URL on the url generated by `StructureVisualizer.to_url()`.
- `StructureVisualizer.query_params` for setting query parameters on the url generated by `StructureVisualizer.to_url()`.
- Parsing `ActionCallDeltaMessageContent`s with empty string `partial_input`s.

## [1.0.0] - 2024-12-09

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def from_deltas(cls, deltas: Sequence[BaseDeltaMessageContent]) -> ActionCallMes

if tag is not None and name is not None and path is not None:
try:
parsed_input = json.loads(json_input)
parsed_input = json.loads(json_input or "{}")
except json.JSONDecodeError as exc:
raise ValueError("Invalid JSON input for ToolAction") from exc
action = ToolAction(tag=tag, name=name, path=path, input=parsed_input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_from_deltas(self):
ActionCallDeltaMessageContent(tag="testtag"),
ActionCallDeltaMessageContent(name="TestName"),
ActionCallDeltaMessageContent(path="test_tag"),
ActionCallDeltaMessageContent(partial_input=""),
ActionCallDeltaMessageContent(partial_input='{"foo":'),
ActionCallDeltaMessageContent(partial_input='"bar"}'),
]
Expand Down

0 comments on commit 6f3cbb9

Please sign in to comment.