-
Notifications
You must be signed in to change notification settings - Fork 16.1k
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
Fixed streaming support using callback handler for Google genai #15459
Fixed streaming support using callback handler for Google genai #15459
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
@efriis Could you please look into this PR? Our current project has a large dependency on it. |
Hey @hasansustcse13 ! This isn't the interface to follow anymore. Instead, you should stream using Let me know if you have any other questions. Erick |
@efriis Streaming doesn't work if I don't use LangChain Expression Language (LCEL). In our project, we have used streaming using a Callback handler(on_llm_new_token) and different kinds of built-in chains. As Gemini is not implanted the same as OpenAI, it does not work with a callback handler (on_llm_new_token). To need to support streaming in Gemini along with other LLM we have to convert all the code to LCEL. I believe this will be faced by other users also. That's why I have made the Change in the PR. To understand the depth please see the Attached bug in the description. Is there any other way to support streaming without LCEL and with minimal changes?
|
@efriis I also agree with @hasansustcse13 that you are confused. One does not just invoke llm and a .stream() directly, but one can pass an llm with callback into something like load_qa_chain, then streaming is broken for gemini but not other models. Gemini wasn't always broken, it started with the recent changes that improved exception handling. |
Is there a version that I can import via pip |
* Gemini導入 * GeminiとOpenAIの呼び出しをfactoryで実装 * stream形式とLCELを両立させた書き方を実装 * langchain-ai/langchain#15459 (comment) * prompt, few-shot prompt修正 * codeのフォーマット
how to use map reduce chain type with gemini models using chatgooglegenerativeai and also get streaming responses at the same time using custom callback handler where I want token level streaming by appending in a queue |
try |
ChatGoogleGenerativeAI
which has been fixed in this PR.