-
-
Notifications
You must be signed in to change notification settings - Fork 735
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
WithStreamingFunc not working in latest version #642
Comments
maybe fixed by #639 |
@pnthang01 I try it, in version v0.1.5 don't work only v0.1.4 @Abirdcfly it isn't fixed in #699 code for test. package main
import (
"context"
"log"
"github.com/tmc/langchaingo/chains"
"github.com/tmc/langchaingo/llms/ollama"
"github.com/tmc/langchaingo/prompts"
)
func main() {
llm, err := ollama.New(ollama.WithModel("llama2"))
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
prompt := prompts.NewPromptTemplate(
"Translate the following text from {{.inputLanguage}} to {{.outputLanguage}}. {{.text}}",
[]string{"inputLanguage", "outputLanguage", "text"},
)
llmChain := chains.NewLLMChain(llm, prompt)
chainOptions := []chains.ChainCallOption{
chains.WithStreamingFunc(func(ctx context.Context, chuck []byte) error {
log.Println(string(chuck))
return nil
}),
}
_, err = chains.Call(ctx, llmChain, map[string]any{
"inputLanguage": "English",
"outputLanguage": "French",
"text": "I love programming.",
}, chainOptions...)
if err != nil {
log.Fatal(err)
}
} |
you can try main branch, v0.1.5 do not contains #639 .. |
Yes please try the current unreleased version (you can use @main to target to a pre-release version), I will be tagging and releasing v0.1.6 soon, and in the mean time I have created a pre-release tag called "v0.1.6-alpha.0" that you can point to. |
@pnthang01 I'm going to presume these instructions address your issue, please reopen if that is not the case and we'll get v0.1.6 tagged and released within a few days. |
Notice that my code didn't send data via WithStreamingFunc to client.
I checked code https://github.com/tmc/langchaingo/blob/e8498f5c2f097cd31c917d2e63b4f6f41c651bf2/chains/options.go in v0.1.5, it's no longer build options from ChainCallOption to CallOption.
Have to downgrade version to v0.1.4.
Or I'm missing something ?
The text was updated successfully, but these errors were encountered: