newMessageWithKey performs a single upstream call.
(ctx context.Context, svc anthropic.MessageService, extraOpts ...option.RequestOption)
| 354 | |
| 355 | // newMessageWithKey performs a single upstream call. |
| 356 | func (i *BlockingInterception) newMessageWithKey(ctx context.Context, svc anthropic.MessageService, extraOpts ...option.RequestOption) (_ *anthropic.Message, outErr error) { |
| 357 | _, span := i.tracer.Start(ctx, "Intercept.ProcessRequest.Upstream", trace.WithAttributes(tracing.InterceptionAttributesFromContext(ctx)...)) |
| 358 | defer tracing.EndSpanErr(span, &outErr) |
| 359 | |
| 360 | opts := append([]option.RequestOption{i.withBody()}, extraOpts...) |
| 361 | return svc.New(ctx, anthropic.MessageNewParams{}, opts...) |
| 362 | } |
| 363 | |
| 364 | // newMessageWithKeyFailover walks the centralized key pool, |
| 365 | // trying each key until one succeeds or the pool is exhausted. |
no test coverage detected