Skip to content

Commit

Permalink
Fix Parsing ActionCallDeltaMessageContent (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Dec 16, 2024
1 parent e2b8a8f commit c2f7bde
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Exception when calling `Structure.to_json()` after it has run.
- `Agent` unintentionally modifying `stream` for all Prompt Drivers.
- Exception when calling `Structure.to_json()` after it has run.
- `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 c2f7bde

Please sign in to comment.