-
Notifications
You must be signed in to change notification settings - Fork 491
Closed
Labels
Description
Describe the bug
This is duplicate of #719.
I have recently stumble upon same exact issue where local Ollama request to thinking model fails with timeout error.
2025/09/06 00:20:09 ERROR request end err="failed to send request: Post \"http://127.0.0.1:11434/api/chat\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"
Issue #719 was resolved by #1040, but main
branch still have timeout hardcoded here.
To Reproduce
package main
import (
"context"
"errors"
"fmt"
"strconv"
"github.com/firebase/genkit/go/ai"
"github.com/firebase/genkit/go/core"
"github.com/firebase/genkit/go/genkit"
"github.com/firebase/genkit/go/plugins/ollama"
)
const (
modelName = "deepseek-r1:8b"
)
func main() {
ctx := context.Background()
ollamaPlugin := ollama.Ollama{ServerAddress: "http://127.0.0.1:11434"}
g := genkit.Init(
ctx,
genkit.WithPlugins(&ollamaPlugin),
)
model := ollamaPlugin.DefineModel(
g,
ollama.ModelDefinition{
Name: modelName,
Type: "chat",
},
nil,
)
type MenuItem struct {
Name string `json:"name"`
Description string `json:"description"`
}
genkit.DefineFlow(g, "menuSuggestionFlowComplex",
func(ctx context.Context, theme string) (string, error) {
output, _, err := genkit.GenerateData[MenuItem](ctx, g,
ai.WithModel(model),
ai.WithPrompt("Invent a menu item for a %s themed restaurant.", theme),
)
if err != nil {
return nil, err
}
return fmt.Sprintf("**%s**: %s", item.Name, item.Description), nil
})
<-ctx.Done()
}
- Create
main.go
(code above) - Download
deepseek-r1:8b
and run Ollamaollama serve
- Run genkit
genkit start -- go run .
- Submit query to the flow and wait for model's response.
Expected behavior
Timeout present as one of the configuration options.
Screenshots
N/A
Runtime (please complete the following information):
- OS: MacOS
- Version 15.6.1
- Chip: Apple M2 Max
** Go version
- 1.25.0
Additional context
N/A
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done