Skip to content

Add support for incomplete key and value strings #10

@prabirshrestha

Description

@prabirshrestha

Write now seems like both key and value handlers for JsonHigh gets called when it has ended based on the docs.

key: an object's key ended
value: a primitive JSON value ended.

Is it possible to have another handler that gives me incomplete key and value as string chunks similar to https://github.com/uhop/stream-json. Unfortunately stream-json doesn't work on the browser.

Token: {
  name: "stringChunk",
  value: "te",
}
Token: {
  name: "stringChunk",
  value: "st",
}

This can be very useful when working with LLMs with streamings large content of json key and values and the UX can be updated as we get the value.

For example if I have a json called { "country": "France", "description": "......." }. Here the country description can be several sentences and paragraph. As LLM streams, the description we can show the update in the UX.

Would be good to have another handler called which can be incomplete keys or values.

chunk?: (chunk: string | number | null | boolean) => Feedback,

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions