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

feat: Allow transforming sse chunk response #568

Open
grafail opened this issue Apr 26, 2024 · 2 comments
Open

feat: Allow transforming sse chunk response #568

grafail opened this issue Apr 26, 2024 · 2 comments
Assignees

Comments

@grafail
Copy link

grafail commented Apr 26, 2024

Problem
Currently it is more complicated handling sse output from custom remote inference engines that do not follow the OpenAI spec

Success Criteria
Ability to transform the response similar to how "transformResponse" is used in non streaming cases

Additional context
Perhaps a function could be passed and used around this line to customise how an sse chunk is handled

https://github.com/janhq/jan/blob/0bad1a479f642c8c5183017641656d52c4b33c61/core/src/browser/extensions/engines/helpers/sse.ts#L74

@Van-QA Van-QA transferred this issue from janhq/jan May 15, 2024
@louis-jan
Copy link
Contributor

@grafail how do you see a transformResponse being embedded into a request? I see this as a client responsibility, where the SSE protocol is more or less just a communication method. We are working on client SDKs in both JS and Python, so integration could be easier in this case.

@louis-jan louis-jan self-assigned this Jun 6, 2024
@grafail
Copy link
Author

grafail commented Jun 7, 2024

I was thinking about this in the same way that transformResponse is used to make other LLMs compatible when not streaming (e.g. https://github.com/janhq/jan/blob/0cae7c97612ba4f6a3387f7f72c56e065711cacf/extensions/inference-anthropic-extension/src/index.ts#L87). Effectively a way to adjust the format of my sse response to the one Jan is expecting without having to rewrite the entire requestInference logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants