datadog

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package datadog provides a client wrapper for the Datadog AI proxy API that complies with the ai.Provider interface.

Index

Constants

View Source
const DefaultModel = "gpt-4o"

DefaultModel is the default model to use when making requests to the API.

View Source
const ErrInvalidRequest xerrors.Error = "invalid request: must provide either an image or text"

ErrInvalidRequest is returned when the request provided to the Datadog proxy API is missing both an image and text.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(req *ai.Request) openai.ChatCompletionRequest

NewTextRequest creates a chat completion request with streaming support for the Datadog API given the provided ai.Request object.

func NewRequestWithImage

func NewRequestWithImage(req *ai.Request) openai.ChatCompletionRequest

NewRequestWithImage creates a chat completion request with streaming support for the Datadog API given the provided ai.Request object. The req.Content field should be a base64-encoded image.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Datadog AI proxy API client that complies with the ai.Provider interface.

func NewClient

func NewClient(endpoint, email string) *Client

NewClient returns a new Client instance with the given email.

func (*Client) Do

func (c *Client) Do(ctx *cli.Context, request *ai.Request) error

Do performs a single API request to the Datadog API, returning a response for the provided Request and writing said response to ctx.App.Writer as a stream of strings.

func (*Client) Name

func (*Client) Name() string

Name returns the name of the provider.

type Transport

type Transport struct {
	// Email is the email address of the user.
	Email string
}

Transport is a custom http.RoundTripper that supports adding custom headers to the request to the Datadog AI proxy API.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the http.RoundTripper interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL