Skip to content

[Platform] Use JSON Path to convert responses #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: simplify-choice-handling
Choose a base branch
from

Conversation

chr-hertel
Copy link
Contributor

@chr-hertel chr-hertel commented Jul 15, 2025

Q A
Bug fix? no
New feature? yes
Docs? no
Issues
License MIT

This approach combines two ideas:

  1. having a central openai-based result converter which removes the need of duplication for some of our implementations
  2. introducing a jsonpath based abstraction for configuring the mechanism of data extraction

And of course those two things don't have to be coupled, but one thing led to the other somehow ...

  • This concept basically still needs proof for the second part by adopting it with Anthropic and Gemini.
  • Tests for streaming examples and customized text and tool call extraction

@chr-hertel chr-hertel added Platform Issues & PRs about the AI Platform component RFC RFC = Request For Comments (proposals about features that you want to be discussed) labels Jul 15, 2025
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch 3 times, most recently from ed6eaea to 7ec4f22 Compare July 15, 2025 23:52
@alexandre-daubois
Copy link
Member

alexandre-daubois commented Jul 16, 2025

I really like the idea! Know that if you manage to get a resource for the response, JsonPath uses JsonStreamer to optimize the part to actually decode. Just in case 🙂

Given that JsonPath is experimental, I'd suggest changing the composer constraint to 7.3.*. That's what we do in core because experimental components may not be compatible between their minor versions. I have no plan to change classes or signatures in the JsonPath component until it's stable release as I managed to make it RFC compliant lately with the exact same API. But better be safe than sorry!

@valtzu
Copy link
Contributor

valtzu commented Jul 16, 2025

Interesting approach!

Do we even need the platform-specific ResponseConverters if there's no platform-specific logic apart a custom json path? This path could be injected in PlatformFactory.


EDIT: ok hmm I guess the idea was to encapsulate the "protocol" in the converter to be reused in different platforms

@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch 2 times, most recently from 8b26c09 to 4387b79 Compare July 16, 2025 23:37
@chr-hertel
Copy link
Contributor Author

chr-hertel commented Jul 16, 2025

I'd suggest changing the composer constraint to 7.3.*

Thanks for that!

encapsulate the "protocol" in the converter to be reused in different platforms

exactly

@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch from 4387b79 to b820262 Compare July 16, 2025 23:44
@OskarStark
Copy link
Contributor

We just created some CHANGELOG.md files.
Please rebase your branch and add info to the appropriate CHANGELOG.md file.

Thanks

Base automatically changed from refactor-decouple-client-converter to main July 17, 2025 20:10
@chr-hertel chr-hertel self-assigned this Jul 19, 2025
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch 3 times, most recently from a5e2e28 to b4ef6f5 Compare July 26, 2025 09:33
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch 2 times, most recently from eee446f to a5d834a Compare July 27, 2025 21:07
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch 3 times, most recently from 2d2c547 to 459b7a3 Compare July 27, 2025 21:30
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch from 459b7a3 to afe308c Compare July 27, 2025 21:55
@chr-hertel chr-hertel changed the base branch from main to simplify-choice-handling July 27, 2025 21:55
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch 2 times, most recently from d927cce to abec2aa Compare July 28, 2025 20:23
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch 6 times, most recently from 708dd97 to 96f8c75 Compare July 29, 2025 21:19
@chr-hertel chr-hertel force-pushed the simplify-choice-handling branch 5 times, most recently from 9aedbf3 to 9a76a18 Compare July 29, 2025 21:40
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch 3 times, most recently from ba0fcd0 to 34e7852 Compare July 29, 2025 22:11
@chr-hertel chr-hertel force-pushed the refactor-json-path-converter branch from 34e7852 to eff76f7 Compare July 29, 2025 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Issues & PRs about the AI Platform component RFC RFC = Request For Comments (proposals about features that you want to be discussed)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants