* fix(llm): set request timeout
If the server is down, address don't resolve, or another myriad of
reasons, currently, it'll get stuck.
This makes it so it times out after 1 minute.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: remove log
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@@ -153,7 +153,6 @@ func (a *anthropicClient) convertMessages(messages []message.Message) (anthropic
}
if len(blocks) == 0 {
- slog.Warn("There is a message without content, investigate, this should not happen")
continue
}
anthropicMessages = append(anthropicMessages, anthropic.NewAssistantMessage(blocks...))
@@ -333,7 +332,7 @@ func (a *anthropicClient) stream(ctx context.Context, messages []message.Message
// Prepare messages on each attempt in case max_tokens was adjusted
preparedMessages := a.preparedMessages(a.convertMessages(messages), a.convertTools(tools))
- var opts []option.RequestOption
+ opts := []option.RequestOption{option.WithRequestTimeout(time.Minute)}
if a.isThinkingEnabled() {
opts = append(opts, option.WithHeaderAdd("anthropic-beta", "interleaved-thinking-2025-05-14"))
}