This repository was archived by the owner on Sep 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
feat: add functions for parsing chat messages #853
Merged
mattjohnsonpint
merged 10 commits into
main
from
mjp/hyp-3397-model-message-state-reconstruction
May 22, 2025
Merged
feat: add functions for parsing chat messages #853
mattjohnsonpint
merged 10 commits into
main
from
mjp/hyp-3397-model-message-state-reconstruction
May 22, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces functions for parsing chat messages to enable message round-tripping without re-materializing the original message types. Key changes include:
- Adding a ParseMessages function and corresponding raw message types for both Go and AssemblyScript.
- Implementing unit tests in Go and AssemblyScript to verify the round-trip JSON representation.
- Updating the AssemblyScript test harness and build configuration for the new functionality.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sdk/go/pkg/models/openai/chat_test.go | Adds test coverage for the ParseMessages function in Go. |
| sdk/go/pkg/models/openai/chat.go | Implements the raw message type and ParseMessages function. |
| sdk/assemblyscript/src/tests/openai.run.ts | Updates the instantiation setup for AssemblyScript tests. |
| sdk/assemblyscript/src/models/openai/chat.ts | Introduces the RawMessage class and parseMessages function. |
| sdk/assemblyscript/src/assembly/tests/openai.spec.ts | Adds a round-trip test for chat messages in AssemblyScript. |
Comments suppressed due to low confidence (1)
sdk/go/pkg/models/openai/chat.go:1252
- The rawMessage implementation uses fmt.Errorf but there is no import for the 'fmt' package. Please add 'import "fmt"' to avoid compilation errors.
return nil, fmt.Errorf("missing data in message")
|
Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information. |
Contributor
Author
|
@JairusSW - please take a look at the json issue. Thanks. |
JairusSW
reviewed
May 22, 2025
JairusSW
reviewed
May 22, 2025
Contributor
Author
|
I have captured the JSON issue here: JairusSW/json-as#132 |
kevinmingtarja
approved these changes
May 22, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a
ParseMessagesfunction to the OpenAI model interface in the SDKs. These can be used for restoring chat messages in a conversation loop.When restored, the original message type is not used. Rather, a
RawMessagetype is used instead. This preserves the JSON contents of the message for replay/round-tripping, without the overhead of rematerializing the specific message object structures.Also updates all AssemblyScript projects to use
json-as1.0.8