MCPcopy Create free account
hub / github.com/coder/coder / ActorHeadersAsOpenAIOpts

Function ActorHeadersAsOpenAIOpts

aibridge/intercept/actor_headers.go:30–44  ·  view source on GitHub ↗

ActorHeadersAsOpenAIOpts produces a slice of headers using OpenAI's RequestOption type.

(actor *context.Actor)

Source from the content-addressed store, hash-verified

28
29// ActorHeadersAsOpenAIOpts produces a slice of headers using OpenAI's RequestOption type.
30func ActorHeadersAsOpenAIOpts(actor *context.Actor) []oai_option.RequestOption {
31 var opts []oai_option.RequestOption
32
33 headers := headersFromActor(actor)
34 if len(headers) == 0 {
35 return nil
36 }
37
38 for k, v := range headers {
39 // [k] will be canonicalized, see [http.Header]'s [Add] method.
40 opts = append(opts, oai_option.WithHeaderAdd(k, v))
41 }
42
43 return opts
44}
45
46// ActorHeadersAsAnthropicOpts produces a slice of headers using Anthropic's RequestOption type.
47func ActorHeadersAsAnthropicOpts(actor *context.Actor) []ant_option.RequestOption {

Callers 7

TestNilActorFunction · 0.92
TestBasicFunction · 0.92
TestBasicAndMetadataFunction · 0.92
ProcessRequestMethod · 0.92
ProcessRequestMethod · 0.92
ProcessRequestMethod · 0.92
ProcessRequestMethod · 0.92

Calls 1

headersFromActorFunction · 0.85

Tested by 3

TestNilActorFunction · 0.74
TestBasicFunction · 0.74
TestBasicAndMetadataFunction · 0.74