Skip to content
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

ai/core: support reason + "array" #2947

Open
bernaferrari opened this issue Sep 9, 2024 · 1 comment
Open

ai/core: support reason + "array" #2947

bernaferrari opened this issue Sep 9, 2024 · 1 comment
Labels
ai/core enhancement New feature or request

Comments

@bernaferrari
Copy link

bernaferrari commented Sep 9, 2024

Feature Description

Sequel to #1486.

I wish I could have a reason field before the array, so that if I had

z.object({
reason: z.string(),
arr: z.array(...)
})

The array would stream in chunks and work with array but still allow other fields that are not array. So, ideally,

  • if z.array => stream in chunks (current behavior)
  • else => stream naturally? Not sure.

Could also be like "if something is inside an array, wait for it to finish to stream, else stream naturally"

@lgrammel
Copy link
Collaborator

@bernaferrari I don't want to hardcode something like reasoning, but I'd love to figure out a more flexible way to support array streaming. One thought that I had is to use a validator schema for intermediate results (partial result would only be sent if they pass that schema), but this will not solve the "is-object-completed" issue. The "is-object-completed" detection is tricky, because it needs to be specified to which level it applies to. Lmk if you have ideas.

@lgrammel lgrammel added enhancement New feature or request ai/core labels Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants