improve status message handling
This commit is contained in:
parent
57a2210d8d
commit
f463ce6694
10 changed files with 140 additions and 84 deletions
|
|
@ -149,8 +149,8 @@ func (a *anthropicProvider) StreamResponse(ctx context.Context, messages []messa
|
|||
|
||||
// Inform user we're retrying with attempt number
|
||||
eventChan <- ProviderEvent{
|
||||
Type: EventContentDelta,
|
||||
Content: fmt.Sprintf("\n\n[Retrying due to rate limit... attempt %d of %d]\n\n", attempts, maxRetries),
|
||||
Type: EventWarning,
|
||||
Info: fmt.Sprintf("[Retrying due to rate limit... attempt %d of %d]", attempts, maxRetries),
|
||||
}
|
||||
|
||||
// Calculate backoff with exponential backoff and jitter
|
||||
|
|
@ -380,4 +380,3 @@ func (a *anthropicProvider) convertToAnthropicMessages(messages []message.Messag
|
|||
|
||||
return anthropicMessages
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ const (
|
|||
EventContentStop EventType = "content_stop"
|
||||
EventComplete EventType = "complete"
|
||||
EventError EventType = "error"
|
||||
EventWarning EventType = "warning"
|
||||
EventInfo EventType = "info"
|
||||
)
|
||||
|
||||
type TokenUsage struct {
|
||||
|
|
@ -40,6 +42,9 @@ type ProviderEvent struct {
|
|||
ToolCall *message.ToolCall
|
||||
Error error
|
||||
Response *ProviderResponse
|
||||
|
||||
// Used for giving users info on e.x retry
|
||||
Info string
|
||||
}
|
||||
|
||||
type Provider interface {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue