Skip to content

feat(response): handle JSON Lines #37

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alphonseb
Copy link
Contributor

@alphonseb alphonseb commented Apr 25, 2025

What

A tentative way to parse both JSON and JSON lines API responses and send back a JSON string as the tool's response.

Why

Query Suggestions' API endpoint /1/logs responds with the logs in a JSON lines format, which will throw errors when calling response.json() (or JSON.parse).
Seeing as how valuable it could be to troubleshoot a Query Suggestions build with an LLM ("Why is {query} missing in my suggestions index" -> "It has less than 2 results"), I'm proposing this way of decoding all responses.

Tests

  • Tested with debugger
  • Added test
  • Test with LLM client (not done because out of credits)

@alphonseb alphonseb marked this pull request as ready for review April 25, 2025 17:56
@alphonseb alphonseb requested a review from kombucha April 25, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant