Documentation
¶
Index ¶
- Constants
- func ApplyConfigDefaults(baseURL *string, textMaxChars *int, defaultTextMaxChars int)
- func ApplyEnv(apiKey, baseURL *string)
- func AuthHeaders(baseURL, apiKey string) map[string]string
- func Enabled(enabled *bool, apiKey string) bool
- func Endpoint(baseURL, path string) (string, error)
- func NewProvider[P any](enabled *bool, apiKey string, build func() P) P
- func PostAndDecodeJSON(ctx context.Context, baseURL, path, apiKey string, payload any, ...) error
- func PostJSON(ctx context.Context, baseURL, path, apiKey string, payload any, ...) ([]byte, error)
- func ShouldAttachBearerAuth(baseURL string) bool
Constants ¶
View Source
const DefaultBaseURL = "https://api.exa.ai"
DefaultBaseURL is the standard Exa API endpoint.
Variables ¶
This section is empty.
Functions ¶
func ApplyConfigDefaults ¶
func ApplyEnv ¶
func ApplyEnv(apiKey, baseURL *string)
ApplyEnv fills empty Exa credentials from standard environment variables.
func AuthHeaders ¶
AuthHeaders returns the standard Exa API authentication headers. For non-Exa base URLs, it also attaches a Bearer Authorization header.
func NewProvider ¶
func PostAndDecodeJSON ¶
func PostAndDecodeJSON(ctx context.Context, baseURL, path, apiKey string, payload any, timeoutSecs int, out any) error
PostAndDecodeJSON sends a JSON request and decodes the JSON response into out.
func PostJSON ¶
func PostJSON(ctx context.Context, baseURL, path, apiKey string, payload any, timeoutSecs int) ([]byte, error)
PostJSON sends a JSON request to the configured Exa endpoint with standard auth headers.
func ShouldAttachBearerAuth ¶
ShouldAttachBearerAuth returns true when the base URL is a non-Exa proxy that requires a standard Bearer token in addition to the x-api-key header.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.