Refactor llm client timeout

This commit is contained in:
dwrz
2026-10-08 01:01:35 +00:00
parent 6d25f3d4ed
commit bee05be62d
3 changed files with 40 additions and 32 deletions
+5 -4
View File
@@ -5,6 +5,7 @@ import (
"log/slog"
"os"
"testing"
"time"
)
// testURL returns the LLM endpoint for integration tests.
@@ -41,7 +42,7 @@ func TestIntegration_ListModels(t *testing.T) {
cfg := Config{
URL: testURL(t),
Key: testKey(t),
Timeout: "30s",
Timeout: 30 * time.Second,
}
client, err := NewClient(cfg, slog.Default())
if err != nil {
@@ -67,7 +68,7 @@ func TestIntegration_Completions(t *testing.T) {
cfg := Config{
URL: testURL(t),
Key: testKey(t),
Timeout: "60s",
Timeout: 60 * time.Second,
}
client, err := NewClient(cfg, slog.Default())
if err != nil {
@@ -100,7 +101,7 @@ func TestIntegration_CompletionsStream(t *testing.T) {
cfg := Config{
URL: testURL(t),
Key: testKey(t),
Timeout: "60s",
Timeout: 60 * time.Second,
}
client, err := NewClient(cfg, slog.Default())
if err != nil {
@@ -140,7 +141,7 @@ func TestIntegration_ToolCalling(t *testing.T) {
client, err := NewClient(Config{
URL: testURL(t),
Key: testKey(t),
Timeout: "60s",
Timeout: 60 * time.Second,
}, slog.Default())
if err != nil {
t.Fatalf("NewClient: %v", err)