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

supported stream response? #60

Closed
kael-aiur opened this issue Jul 26, 2023 · 5 comments
Closed

supported stream response? #60

kael-aiur opened this issue Jul 26, 2023 · 5 comments

Comments

@kael-aiur
Copy link

I am using RetrievalQa chain to build a document-based conversational tool, but every time I ask a question about the content of the document, I have to wait for the large language model to complete the entire answer. Sometimes it takes a long time, and I am not sure if there is an error. Therefore, I am considering whether we can support a streaming response interface for this conversational chain.

@HamaWhiteGG
Copy link
Owner

Can you provide the code? I want to confirm whether it's not about vectorization or the time-consuming process of inserting text data into the vector database.

@kael-aiur
Copy link
Author

yes, It is not vectorization, It like async api in python, I'm try to defined in my fork project, and now without any implement for llm client, I just using in my private llm server, and implement by my private llm client for preview, I can commit a pull request to this project.

@HamaWhiteGG
Copy link
Owner

Good, looking forward to your pull request.

@ChildWangWorld
Copy link

great job

@HamaWhiteGG
Copy link
Owner

supported, see StreamOpenAIExample

@RunnableExample
public class StreamOpenAIExample {

    public static void main(String[] args) {

        var llm = OpenAI.builder()
                .maxTokens(1000)
                .temperature(0)
                .requestTimeout(120)
                .build()
                .init();

        var result = llm.asyncPredict("Introduce West Lake in Hangzhou, China.");
        result.doOnNext(System.out::print).blockLast();
    }
}

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

No branches or pull requests

3 participants