mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add yet more debugging information to LLM test.
The current failures are consistent with a timeout when generating the first prompt, so increase a timeout that a past change forgot to increase for the first test. Otherwise, include server-side logs into error output to hopefully shed some light on what is happening. PiperOrigin-RevId: 599002718
This commit is contained in:
committed by
gVisor bot
parent
7aee3ecbba
commit
cce5bf7c64
@@ -356,7 +356,17 @@ type ConversationContext []int
|
||||
func (llm *Ollama) Prompt(ctx context.Context, prompt *Prompt) (*Response, error) {
|
||||
resp, err := jsonPost[PromptJSON, ResponseJSON](ctx, llm, "/api/generate", prompt.json())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if ctx.Err() != nil {
|
||||
return nil, fmt.Errorf("%w (+ context err: %v)", err, ctx.Err())
|
||||
}
|
||||
serverLogs, logsErr := llm.container.Logs(ctx)
|
||||
if logsErr != nil {
|
||||
return nil, fmt.Errorf("%w (could not get server logs: %v)", err, logsErr)
|
||||
}
|
||||
if serverLogs != "" {
|
||||
return nil, fmt.Errorf("%w; ollama server logs:\n%v\n(end of ollama server logs)", err, serverLogs)
|
||||
}
|
||||
return nil, fmt.Errorf("%w (server logs are empty)", err)
|
||||
}
|
||||
return &Response{data: resp}, nil
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ func TestLLM(t *testing.T) {
|
||||
"Hello World".
|
||||
`,
|
||||
}
|
||||
promptCtx, promptCancel := context.WithTimeout(ctx, time.Minute)
|
||||
promptCtx, promptCancel := context.WithTimeout(ctx, 3*time.Minute)
|
||||
response, err := llm.PromptUntil(promptCtx, &prompt, func(prompt *ollama.Prompt, response *ollama.Response) (*ollama.Prompt, error) {
|
||||
defer prompt.Model.RaiseTemperature()
|
||||
text := strings.TrimSpace(response.Text())
|
||||
|
||||
Reference in New Issue
Block a user