llama

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-llama-api

Go Reference CI version license imported by

Unofficial Go client for the Meta Llama API, generated with oapi-codegen from the OpenAPI document Meta publishes for its SDKs. I am not affiliated with Meta.

The package is llama, in the repository root. Everything in client.gen.go is generated. Don't edit it by hand, regenerate it.

Install

go get github.com/psyb0t/go-llama-api

Usage

Every endpoint in the spec has a typed method on ClientWithResponses. Responses decode into JSON200 and the other status fields.

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"

	"github.com/psyb0t/go-llama-api"
)

func main() {
	auth := llama.WithRequestEditorFn(func(_ context.Context, req *http.Request) error {
		req.Header.Set("Authorization", "Bearer "+os.Getenv("LLAMA_API_KEY"))

		return nil
	})

	client, err := llama.NewClientWithResponses("https://api.llama.com/v1", auth)
	if err != nil {
		panic(err)
	}

	res, err := client.ListModelsWithResponse(context.Background())
	if err != nil {
		panic(err)
	}

	if res.JSON200 == nil {
		panic(res.Status())
	}

	for _, model := range res.JSON200.Data {
		fmt.Println(model.Id)
	}
}

The same code is in example_test.go, so make test checks that it compiles.

The full API, with the spec's descriptions as doc comments, is in the Go reference and in go doc github.com/psyb0t/go-llama-api.

Chat messages are unions. Build one with the From... helpers, for example UserMessage_Content.FromUserMessageContent0("hello") for plain text and then Message.FromUserMessage(...), which also sets the role. Read the reply with CompletionMessage.Content.AsAssistantMessageContent0().

The chat endpoint can also stream server-sent events when stream is true. The generated client does not parse event streams; use CreateChatCompletion (without WithResponse) and read the *http.Response body yourself.

Auth

The Llama API takes an API key as a Bearer token in the Authorization header. Keys come from the API keys page of the Llama developer dashboard. The spec names a security requirement but does not define the scheme, so the client adds no auth by itself. Pass the request editor above to every client.

The base URL is https://api.llama.com/v1. The spec's servers entry lists http://api.llama.com without the version prefix, so always pass the base URL yourself.

Regenerating

The spec is not committed. make generate downloads the current OpenAPI document into the gitignored api/ directory and regenerates the client:

make generate

gen.go declares the steps, so make generate is just go generate ./...:

  • scripts/fetch-spec.sh reads openapi_spec_url from the .stats.yml of meta-llama/llama-api-python and downloads that URL to api/openapi.yaml. The spec is hosted by Stainless under a URL that changes with every update, so the script looks it up each time.
  • oapi-codegen runs with config.yaml. The config maps number to float64, because the spec gives temperatures and scores no format and oapi-codegen would otherwise use float32.

.github/workflows/regen.yml does the same every day in CI. When the new spec changes the client, it runs make lint, make test and make sec. If a check fails, Claude edits the code and the checks run again, up to three times, and a review step reads the result. A passing change is committed with a CHANGELOG entry and tagged as the next release: a patch version for fixes and additions, a minor version for breaking changes.

Agent integrations

The skill teaches a coding agent how to use go-llama-api when it writes Go. It works in any agent that reads .agents/skills/, and installs natively in the clients below.

Claude Code
claude plugin marketplace add psyb0t/agents
claude plugin install go-llama-api@psyb0t
Codex
codex plugin marketplace add psyb0t/agents
codex plugin add go-llama-api@psyb0t

Codex also picks the skill up with no install in any checkout of this repo.

OpenClaw

The skill is published to ClawHub on every release:

openclaw skills install @psyb0t/go-llama-api

Development

Every command runs in the Dockerfile.dev image. The host needs only Docker and Make.

make help      # list targets
make dep       # go mod tidy + vendor
make lint      # shellcheck, shfmt, go fix, golangci-lint
make test      # go test -race
make sec       # gitleaks, govulncheck, semgrep
make generate  # download the spec and regenerate

License

MIT. The generated code comes from the API specification Meta publishes for its SDKs. The specification itself is not redistributed here.

Documentation

Overview

Package llama provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Package llama is a Go client for the Meta Llama API, generated with oapi-codegen from the OpenAPI document Meta publishes.

Example

This is the README usage example. It talks to the live API, so it has no Output comment and only has to compile.

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"

	"github.com/psyb0t/go-llama-api"
)

func main() {
	auth := llama.WithRequestEditorFn(
		func(_ context.Context, req *http.Request) error {
			key := os.Getenv("LLAMA_API_KEY")
			req.Header.Set("Authorization", "Bearer "+key)

			return nil
		},
	)

	client, err := llama.NewClientWithResponses(
		"https://api.llama.com/v1",
		auth,
	)
	if err != nil {
		panic(err)
	}

	res, err := client.ListModelsWithResponse(context.Background())
	if err != nil {
		panic(err)
	}

	if res.JSON200 == nil {
		panic(res.Status())
	}

	for _, model := range res.JSON200.Data {
		fmt.Println(model.Id)
	}
}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreateChatCompletionRequest

func NewCreateChatCompletionRequest(server string, body CreateChatCompletionJSONRequestBody) (*http.Request, error)

NewCreateChatCompletionRequest calls the generic CreateChatCompletion builder with application/json body

func NewCreateChatCompletionRequestWithBody

func NewCreateChatCompletionRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCreateChatCompletionRequestWithBody constructs an http.Request for the CreateChatCompletion method, with any body, and a specified content type

func NewGetUploadsUploadIdRequest

func NewGetUploadsUploadIdRequest(server string, uploadId string, params *GetUploadsUploadIdParams) (*http.Request, error)

NewGetUploadsUploadIdRequest constructs an http.Request for the GetUploadsUploadId method

func NewListModelsRequest

func NewListModelsRequest(server string) (*http.Request, error)

NewListModelsRequest constructs an http.Request for the ListModels method

func NewModerationsRequest

func NewModerationsRequest(server string, body ModerationsJSONRequestBody) (*http.Request, error)

NewModerationsRequest calls the generic Moderations builder with application/json body

func NewModerationsRequestWithBody

func NewModerationsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewModerationsRequestWithBody constructs an http.Request for the Moderations method, with any body, and a specified content type

func NewPostUploadsRequest

func NewPostUploadsRequest(server string, params *PostUploadsParams, body PostUploadsJSONRequestBody) (*http.Request, error)

NewPostUploadsRequest calls the generic PostUploads builder with application/json body

func NewPostUploadsRequestWithBody

func NewPostUploadsRequestWithBody(server string, params *PostUploadsParams, contentType string, body io.Reader) (*http.Request, error)

NewPostUploadsRequestWithBody constructs an http.Request for the PostUploads method, with any body, and a specified content type

func NewPostUploadsUploadIdRequestWithBody

func NewPostUploadsUploadIdRequestWithBody(server string, uploadId string, params *PostUploadsUploadIdParams, contentType string, body io.Reader) (*http.Request, error)

NewPostUploadsUploadIdRequestWithBody constructs an http.Request for the PostUploadsUploadId method, with any body, and a specified content type

func NewRetrieveModelRequest

func NewRetrieveModelRequest(server string, model string) (*http.Request, error)

NewRetrieveModelRequest constructs an http.Request for the RetrieveModel method

Types

type AssistantMessage

type AssistantMessage struct {
	// Content The content of the model's response.
	Content *AssistantMessage_Content `json:"content,omitempty"`

	// Role Must be "assistant" to identify this as the model's response
	Role AssistantMessageRole `json:"role"`

	// StopReason The reason why we stopped. Options are: - "stop": The model reached a natural stopping point. - "tool_calls": The model finished generating and invoked a tool call. - "length": The model reached the maxinum number of tokens specified in the request.
	StopReason *AssistantMessageStopReason `json:"stop_reason,omitempty"`

	// ToolCalls The tool calls generated by the model, such as function calls.
	ToolCalls *MessageToolCalls `json:"tool_calls,omitempty"`
}

AssistantMessage A message containing the model's (assistant) response in a chat conversation.

type AssistantMessageContent0

type AssistantMessageContent0 = string

AssistantMessageContent0 defines model for AssistantMessage.Content.0.

type AssistantMessageContentItem

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

AssistantMessageContentItem defines model for AssistantMessageContentItem.

func (AssistantMessageContentItem) AsMessageTextContentItem

func (t AssistantMessageContentItem) AsMessageTextContentItem() (MessageTextContentItem, error)

AsMessageTextContentItem returns the union data inside the AssistantMessageContentItem as a MessageTextContentItem

func (AssistantMessageContentItem) Discriminator

func (t AssistantMessageContentItem) Discriminator() (string, error)

func (*AssistantMessageContentItem) FromMessageTextContentItem

func (t *AssistantMessageContentItem) FromMessageTextContentItem(v MessageTextContentItem) error

FromMessageTextContentItem overwrites any union data inside the AssistantMessageContentItem as the provided MessageTextContentItem

func (AssistantMessageContentItem) MarshalJSON

func (t AssistantMessageContentItem) MarshalJSON() ([]byte, error)

func (*AssistantMessageContentItem) MergeMessageTextContentItem

func (t *AssistantMessageContentItem) MergeMessageTextContentItem(v MessageTextContentItem) error

MergeMessageTextContentItem performs a merge with any union data inside the AssistantMessageContentItem, using the provided MessageTextContentItem

func (*AssistantMessageContentItem) UnmarshalJSON

func (t *AssistantMessageContentItem) UnmarshalJSON(b []byte) error

func (AssistantMessageContentItem) ValueByDiscriminator

func (t AssistantMessageContentItem) ValueByDiscriminator() (interface{}, error)

type AssistantMessageRole

type AssistantMessageRole string

AssistantMessageRole Must be "assistant" to identify this as the model's response

const (
	AssistantMessageRoleAssistant AssistantMessageRole = "assistant"
)

Defines values for AssistantMessageRole.

func (AssistantMessageRole) Valid

func (e AssistantMessageRole) Valid() bool

Valid indicates whether the value is a known member of the AssistantMessageRole enum.

type AssistantMessageStopReason

type AssistantMessageStopReason string

AssistantMessageStopReason The reason why we stopped. Options are: - "stop": The model reached a natural stopping point. - "tool_calls": The model finished generating and invoked a tool call. - "length": The model reached the maxinum number of tokens specified in the request.

const (
	AssistantMessageStopReasonLength    AssistantMessageStopReason = "length"
	AssistantMessageStopReasonStop      AssistantMessageStopReason = "stop"
	AssistantMessageStopReasonToolCalls AssistantMessageStopReason = "tool_calls"
)

Defines values for AssistantMessageStopReason.

func (AssistantMessageStopReason) Valid

func (e AssistantMessageStopReason) Valid() bool

Valid indicates whether the value is a known member of the AssistantMessageStopReason enum.

type AssistantMessage_Content

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

AssistantMessage_Content The content of the model's response.

func (AssistantMessage_Content) AsAssistantMessageContent0

func (t AssistantMessage_Content) AsAssistantMessageContent0() (AssistantMessageContent0, error)

AsAssistantMessageContent0 returns the union data inside the AssistantMessage_Content as a AssistantMessageContent0

func (AssistantMessage_Content) AsAssistantMessageContentItem

func (t AssistantMessage_Content) AsAssistantMessageContentItem() (AssistantMessageContentItem, error)

AsAssistantMessageContentItem returns the union data inside the AssistantMessage_Content as a AssistantMessageContentItem

func (*AssistantMessage_Content) FromAssistantMessageContent0

func (t *AssistantMessage_Content) FromAssistantMessageContent0(v AssistantMessageContent0) error

FromAssistantMessageContent0 overwrites any union data inside the AssistantMessage_Content as the provided AssistantMessageContent0

func (*AssistantMessage_Content) FromAssistantMessageContentItem

func (t *AssistantMessage_Content) FromAssistantMessageContentItem(v AssistantMessageContentItem) error

FromAssistantMessageContentItem overwrites any union data inside the AssistantMessage_Content as the provided AssistantMessageContentItem

func (AssistantMessage_Content) MarshalJSON

func (t AssistantMessage_Content) MarshalJSON() ([]byte, error)

func (*AssistantMessage_Content) MergeAssistantMessageContent0

func (t *AssistantMessage_Content) MergeAssistantMessageContent0(v AssistantMessageContent0) error

MergeAssistantMessageContent0 performs a merge with any union data inside the AssistantMessage_Content, using the provided AssistantMessageContent0

func (*AssistantMessage_Content) MergeAssistantMessageContentItem

func (t *AssistantMessage_Content) MergeAssistantMessageContentItem(v AssistantMessageContentItem) error

MergeAssistantMessageContentItem performs a merge with any union data inside the AssistantMessage_Content, using the provided AssistantMessageContentItem

func (*AssistantMessage_Content) UnmarshalJSON

func (t *AssistantMessage_Content) UnmarshalJSON(b []byte) error

type BadRequest400

type BadRequest400 = Error

BadRequest400 Error response from the API. Roughly follows RFC 7807.

type ChatCompletionNamedToolChoice

type ChatCompletionNamedToolChoice struct {
	Function struct {
		// Name The name of the function to call.
		Name string `json:"name"`
	} `json:"function"`

	// Type The type of the tool. Currently, only `function` is supported.
	Type ChatCompletionNamedToolChoiceType `json:"type"`
}

ChatCompletionNamedToolChoice Specifies a tool the model should use. Use to force the model to call a specific function.

type ChatCompletionNamedToolChoiceType

type ChatCompletionNamedToolChoiceType string

ChatCompletionNamedToolChoiceType The type of the tool. Currently, only `function` is supported.

const (
	ChatCompletionNamedToolChoiceTypeFunction ChatCompletionNamedToolChoiceType = "function"
)

Defines values for ChatCompletionNamedToolChoiceType.

func (ChatCompletionNamedToolChoiceType) Valid

Valid indicates whether the value is a known member of the ChatCompletionNamedToolChoiceType enum.

type ChatCompletionStreamResponseDelta

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

ChatCompletionStreamResponseDelta defines model for ChatCompletionStreamResponseDelta.

func (ChatCompletionStreamResponseDelta) AsTextDelta

AsTextDelta returns the union data inside the ChatCompletionStreamResponseDelta as a TextDelta

func (ChatCompletionStreamResponseDelta) AsToolCallDelta

func (t ChatCompletionStreamResponseDelta) AsToolCallDelta() (ToolCallDelta, error)

AsToolCallDelta returns the union data inside the ChatCompletionStreamResponseDelta as a ToolCallDelta

func (ChatCompletionStreamResponseDelta) Discriminator

func (t ChatCompletionStreamResponseDelta) Discriminator() (string, error)

func (*ChatCompletionStreamResponseDelta) FromTextDelta

FromTextDelta overwrites any union data inside the ChatCompletionStreamResponseDelta as the provided TextDelta

func (*ChatCompletionStreamResponseDelta) FromToolCallDelta

func (t *ChatCompletionStreamResponseDelta) FromToolCallDelta(v ToolCallDelta) error

FromToolCallDelta overwrites any union data inside the ChatCompletionStreamResponseDelta as the provided ToolCallDelta

func (ChatCompletionStreamResponseDelta) MarshalJSON

func (t ChatCompletionStreamResponseDelta) MarshalJSON() ([]byte, error)

func (*ChatCompletionStreamResponseDelta) MergeTextDelta

func (t *ChatCompletionStreamResponseDelta) MergeTextDelta(v TextDelta) error

MergeTextDelta performs a merge with any union data inside the ChatCompletionStreamResponseDelta, using the provided TextDelta

func (*ChatCompletionStreamResponseDelta) MergeToolCallDelta

func (t *ChatCompletionStreamResponseDelta) MergeToolCallDelta(v ToolCallDelta) error

MergeToolCallDelta performs a merge with any union data inside the ChatCompletionStreamResponseDelta, using the provided ToolCallDelta

func (*ChatCompletionStreamResponseDelta) UnmarshalJSON

func (t *ChatCompletionStreamResponseDelta) UnmarshalJSON(b []byte) error

func (ChatCompletionStreamResponseDelta) ValueByDiscriminator

func (t ChatCompletionStreamResponseDelta) ValueByDiscriminator() (interface{}, error)

type ChatCompletionTool

type ChatCompletionTool struct {
	Function FunctionObject `json:"function"`

	// Type The type of the tool. Currently, only `function` is supported.
	Type ChatCompletionToolType `json:"type"`
}

ChatCompletionTool defines model for ChatCompletionTool.

type ChatCompletionToolChoiceOption

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

ChatCompletionToolChoiceOption Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.

`none` is the default when no tools are present. `auto` is the default if tools are present.

func (ChatCompletionToolChoiceOption) AsChatCompletionNamedToolChoice

func (t ChatCompletionToolChoiceOption) AsChatCompletionNamedToolChoice() (ChatCompletionNamedToolChoice, error)

AsChatCompletionNamedToolChoice returns the union data inside the ChatCompletionToolChoiceOption as a ChatCompletionNamedToolChoice

func (ChatCompletionToolChoiceOption) AsChatCompletionToolChoiceOption0

func (t ChatCompletionToolChoiceOption) AsChatCompletionToolChoiceOption0() (ChatCompletionToolChoiceOption0, error)

AsChatCompletionToolChoiceOption0 returns the union data inside the ChatCompletionToolChoiceOption as a ChatCompletionToolChoiceOption0

func (*ChatCompletionToolChoiceOption) FromChatCompletionNamedToolChoice

func (t *ChatCompletionToolChoiceOption) FromChatCompletionNamedToolChoice(v ChatCompletionNamedToolChoice) error

FromChatCompletionNamedToolChoice overwrites any union data inside the ChatCompletionToolChoiceOption as the provided ChatCompletionNamedToolChoice

func (*ChatCompletionToolChoiceOption) FromChatCompletionToolChoiceOption0

func (t *ChatCompletionToolChoiceOption) FromChatCompletionToolChoiceOption0(v ChatCompletionToolChoiceOption0) error

FromChatCompletionToolChoiceOption0 overwrites any union data inside the ChatCompletionToolChoiceOption as the provided ChatCompletionToolChoiceOption0

func (ChatCompletionToolChoiceOption) MarshalJSON

func (t ChatCompletionToolChoiceOption) MarshalJSON() ([]byte, error)

func (*ChatCompletionToolChoiceOption) MergeChatCompletionNamedToolChoice

func (t *ChatCompletionToolChoiceOption) MergeChatCompletionNamedToolChoice(v ChatCompletionNamedToolChoice) error

MergeChatCompletionNamedToolChoice performs a merge with any union data inside the ChatCompletionToolChoiceOption, using the provided ChatCompletionNamedToolChoice

func (*ChatCompletionToolChoiceOption) MergeChatCompletionToolChoiceOption0

func (t *ChatCompletionToolChoiceOption) MergeChatCompletionToolChoiceOption0(v ChatCompletionToolChoiceOption0) error

MergeChatCompletionToolChoiceOption0 performs a merge with any union data inside the ChatCompletionToolChoiceOption, using the provided ChatCompletionToolChoiceOption0

func (*ChatCompletionToolChoiceOption) UnmarshalJSON

func (t *ChatCompletionToolChoiceOption) UnmarshalJSON(b []byte) error

type ChatCompletionToolChoiceOption0

type ChatCompletionToolChoiceOption0 string

ChatCompletionToolChoiceOption0 `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.

const (
	ChatCompletionToolChoiceOption0Auto     ChatCompletionToolChoiceOption0 = "auto"
	ChatCompletionToolChoiceOption0None     ChatCompletionToolChoiceOption0 = "none"
	ChatCompletionToolChoiceOption0Required ChatCompletionToolChoiceOption0 = "required"
)

Defines values for ChatCompletionToolChoiceOption0.

func (ChatCompletionToolChoiceOption0) Valid

Valid indicates whether the value is a known member of the ChatCompletionToolChoiceOption0 enum.

type ChatCompletionToolType

type ChatCompletionToolType string

ChatCompletionToolType The type of the tool. Currently, only `function` is supported.

const (
	ChatCompletionToolTypeFunction ChatCompletionToolType = "function"
)

Defines values for ChatCompletionToolType.

func (ChatCompletionToolType) Valid

func (e ChatCompletionToolType) Valid() bool

Valid indicates whether the value is a known member of the ChatCompletionToolType enum.

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) CreateChatCompletion

func (c *Client) CreateChatCompletion(ctx context.Context, body CreateChatCompletionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateChatCompletion performs a POST /chat/completions (the `CreateChatCompletion` operationId) request. Takes a body of the `application/json` content type.

Generate a chat completion for the given messages using the specified model.

func (*Client) CreateChatCompletionWithBody

func (c *Client) CreateChatCompletionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateChatCompletionWithBody performs a POST /chat/completions (the `CreateChatCompletion` operationId) request, with any type of body and a specified content type.

Generate a chat completion for the given messages using the specified model.

func (*Client) GetUploadsUploadId

func (c *Client) GetUploadsUploadId(ctx context.Context, uploadId string, params *GetUploadsUploadIdParams, reqEditors ...RequestEditorFn) (*http.Response, error)

GetUploadsUploadId performs a GET /uploads/{upload_id} (the `GetUploadsUploadId` operationId) request.

Get the status of the given upload session.

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

ListModels performs a GET /models (the `ListModels` operationId) request.

Lists the currently available models, and provides basic information about each one.

func (*Client) Moderations

func (c *Client) Moderations(ctx context.Context, body ModerationsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

Moderations performs a POST /moderations (the `Moderations` operationId) request. Takes a body of the `application/json` content type.

Classifies if given messages are potentially harmful across several categories.

func (*Client) ModerationsWithBody

func (c *Client) ModerationsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

ModerationsWithBody performs a POST /moderations (the `Moderations` operationId) request, with any type of body and a specified content type.

Classifies if given messages are potentially harmful across several categories.

func (*Client) PostUploads

func (c *Client) PostUploads(ctx context.Context, params *PostUploadsParams, body PostUploadsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

PostUploads performs a POST /uploads (the `PostUploads` operationId) request. Takes a body of the `application/json` content type.

Initiate an upload session with specified file metadata.

func (*Client) PostUploadsUploadIdWithBody

func (c *Client) PostUploadsUploadIdWithBody(ctx context.Context, uploadId string, params *PostUploadsUploadIdParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

PostUploadsUploadIdWithBody performs a POST /uploads/{upload_id} (the `PostUploadsUploadId` operationId) request, with any type of body and a specified content type.

Upload a chunk of bytes to the upload session.

func (*Client) PostUploadsWithBody

func (c *Client) PostUploadsWithBody(ctx context.Context, params *PostUploadsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

PostUploadsWithBody performs a POST /uploads (the `PostUploads` operationId) request, with any type of body and a specified content type.

Initiate an upload session with specified file metadata.

func (*Client) RetrieveModel

func (c *Client) RetrieveModel(ctx context.Context, model string, reqEditors ...RequestEditorFn) (*http.Response, error)

RetrieveModel performs a GET /models/{model} (the `RetrieveModel` operationId) request.

type ClientInterface

type ClientInterface interface {

	// CreateChatCompletionWithBody performs a POST /chat/completions (the `CreateChatCompletion` operationId) request,
	// with any type of body and a specified content type.
	//
	// Generate a chat completion for the given messages using the specified model.
	CreateChatCompletionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateChatCompletion performs a POST /chat/completions (the `CreateChatCompletion` operationId) request.
	// Takes a body of the `application/json` content type.
	//
	// Generate a chat completion for the given messages using the specified model.
	CreateChatCompletion(ctx context.Context, body CreateChatCompletionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListModels performs a GET /models (the `ListModels` operationId) request.
	//
	// Lists the currently available models, and provides basic information about each one.
	ListModels(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// RetrieveModel performs a GET /models/{model} (the `RetrieveModel` operationId) request.
	RetrieveModel(ctx context.Context, model string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ModerationsWithBody performs a POST /moderations (the `Moderations` operationId) request,
	// with any type of body and a specified content type.
	//
	// Classifies if given messages are potentially harmful across several categories.
	ModerationsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// Moderations performs a POST /moderations (the `Moderations` operationId) request.
	// Takes a body of the `application/json` content type.
	//
	// Classifies if given messages are potentially harmful across several categories.
	Moderations(ctx context.Context, body ModerationsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PostUploadsWithBody performs a POST /uploads (the `PostUploads` operationId) request,
	// with any type of body and a specified content type.
	//
	// Initiate an upload session with specified file metadata.
	PostUploadsWithBody(ctx context.Context, params *PostUploadsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PostUploads performs a POST /uploads (the `PostUploads` operationId) request.
	// Takes a body of the `application/json` content type.
	//
	// Initiate an upload session with specified file metadata.
	PostUploads(ctx context.Context, params *PostUploadsParams, body PostUploadsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetUploadsUploadId performs a GET /uploads/{upload_id} (the `GetUploadsUploadId` operationId) request.
	//
	// Get the status of the given upload session.
	GetUploadsUploadId(ctx context.Context, uploadId string, params *GetUploadsUploadIdParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PostUploadsUploadIdWithBody performs a POST /uploads/{upload_id} (the `PostUploadsUploadId` operationId) request,
	// with any type of body and a specified content type.
	//
	// Upload a chunk of bytes to the upload session.
	PostUploadsUploadIdWithBody(ctx context.Context, uploadId string, params *PostUploadsUploadIdParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) CreateChatCompletionWithBodyWithResponse

func (c *ClientWithResponses) CreateChatCompletionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateChatCompletionResponse2, error)

CreateChatCompletionWithBodyWithResponse performs a POST /chat/completions (the `CreateChatCompletion` operationId) request, with any type of body and a specified content type.

Generate a chat completion for the given messages using the specified model.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) CreateChatCompletionWithResponse

func (c *ClientWithResponses) CreateChatCompletionWithResponse(ctx context.Context, body CreateChatCompletionJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateChatCompletionResponse2, error)

CreateChatCompletionWithResponse performs a POST /chat/completions (the `CreateChatCompletion` operationId) request. Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Generate a chat completion for the given messages using the specified model.

func (*ClientWithResponses) GetUploadsUploadIdWithResponse

func (c *ClientWithResponses) GetUploadsUploadIdWithResponse(ctx context.Context, uploadId string, params *GetUploadsUploadIdParams, reqEditors ...RequestEditorFn) (*GetUploadsUploadIdResponse, error)

GetUploadsUploadIdWithResponse performs a GET /uploads/{upload_id} (the `GetUploadsUploadId` operationId) request.

Get the status of the given upload session.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) ListModelsWithResponse

func (c *ClientWithResponses) ListModelsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListModelsResponse2, error)

ListModelsWithResponse performs a GET /models (the `ListModels` operationId) request.

Lists the currently available models, and provides basic information about each one.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) ModerationsWithBodyWithResponse

func (c *ClientWithResponses) ModerationsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ModerationsResponse, error)

ModerationsWithBodyWithResponse performs a POST /moderations (the `Moderations` operationId) request, with any type of body and a specified content type.

Classifies if given messages are potentially harmful across several categories.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) ModerationsWithResponse

func (c *ClientWithResponses) ModerationsWithResponse(ctx context.Context, body ModerationsJSONRequestBody, reqEditors ...RequestEditorFn) (*ModerationsResponse, error)

ModerationsWithResponse performs a POST /moderations (the `Moderations` operationId) request. Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Classifies if given messages are potentially harmful across several categories.

func (*ClientWithResponses) PostUploadsUploadIdWithBodyWithResponse

func (c *ClientWithResponses) PostUploadsUploadIdWithBodyWithResponse(ctx context.Context, uploadId string, params *PostUploadsUploadIdParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostUploadsUploadIdResponse, error)

PostUploadsUploadIdWithBodyWithResponse performs a POST /uploads/{upload_id} (the `PostUploadsUploadId` operationId) request, with any type of body and a specified content type.

Upload a chunk of bytes to the upload session.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) PostUploadsWithBodyWithResponse

func (c *ClientWithResponses) PostUploadsWithBodyWithResponse(ctx context.Context, params *PostUploadsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostUploadsResponse, error)

PostUploadsWithBodyWithResponse performs a POST /uploads (the `PostUploads` operationId) request, with any type of body and a specified content type.

Initiate an upload session with specified file metadata.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) PostUploadsWithResponse

func (c *ClientWithResponses) PostUploadsWithResponse(ctx context.Context, params *PostUploadsParams, body PostUploadsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostUploadsResponse, error)

PostUploadsWithResponse performs a POST /uploads (the `PostUploads` operationId) request. Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Initiate an upload session with specified file metadata.

func (*ClientWithResponses) RetrieveModelWithResponse

func (c *ClientWithResponses) RetrieveModelWithResponse(ctx context.Context, model string, reqEditors ...RequestEditorFn) (*RetrieveModelResponse, error)

RetrieveModelWithResponse performs a GET /models/{model} (the `RetrieveModel` operationId) request.

Returns a wrapper object for the known response body format(s).

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// CreateChatCompletionWithBodyWithResponse performs a POST /chat/completions (the `CreateChatCompletion` operationId) request,
	// with any type of body and a specified content type.
	//
	// Generate a chat completion for the given messages using the specified model.
	//
	// Returns a wrapper object for the known response body format(s).
	CreateChatCompletionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateChatCompletionResponse2, error)

	// CreateChatCompletionWithResponse performs a POST /chat/completions (the `CreateChatCompletion` operationId) request.
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Generate a chat completion for the given messages using the specified model.
	CreateChatCompletionWithResponse(ctx context.Context, body CreateChatCompletionJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateChatCompletionResponse2, error)

	// ListModelsWithResponse performs a GET /models (the `ListModels` operationId) request.
	//
	// Lists the currently available models, and provides basic information about each one.
	//
	// Returns a wrapper object for the known response body format(s).
	ListModelsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListModelsResponse2, error)

	// RetrieveModelWithResponse performs a GET /models/{model} (the `RetrieveModel` operationId) request.
	//
	// Returns a wrapper object for the known response body format(s).
	RetrieveModelWithResponse(ctx context.Context, model string, reqEditors ...RequestEditorFn) (*RetrieveModelResponse, error)

	// ModerationsWithBodyWithResponse performs a POST /moderations (the `Moderations` operationId) request,
	// with any type of body and a specified content type.
	//
	// Classifies if given messages are potentially harmful across several categories.
	//
	// Returns a wrapper object for the known response body format(s).
	ModerationsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ModerationsResponse, error)

	// ModerationsWithResponse performs a POST /moderations (the `Moderations` operationId) request.
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Classifies if given messages are potentially harmful across several categories.
	ModerationsWithResponse(ctx context.Context, body ModerationsJSONRequestBody, reqEditors ...RequestEditorFn) (*ModerationsResponse, error)

	// PostUploadsWithBodyWithResponse performs a POST /uploads (the `PostUploads` operationId) request,
	// with any type of body and a specified content type.
	//
	// Initiate an upload session with specified file metadata.
	//
	// Returns a wrapper object for the known response body format(s).
	PostUploadsWithBodyWithResponse(ctx context.Context, params *PostUploadsParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostUploadsResponse, error)

	// PostUploadsWithResponse performs a POST /uploads (the `PostUploads` operationId) request.
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Initiate an upload session with specified file metadata.
	PostUploadsWithResponse(ctx context.Context, params *PostUploadsParams, body PostUploadsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostUploadsResponse, error)

	// GetUploadsUploadIdWithResponse performs a GET /uploads/{upload_id} (the `GetUploadsUploadId` operationId) request.
	//
	// Get the status of the given upload session.
	//
	// Returns a wrapper object for the known response body format(s).
	GetUploadsUploadIdWithResponse(ctx context.Context, uploadId string, params *GetUploadsUploadIdParams, reqEditors ...RequestEditorFn) (*GetUploadsUploadIdResponse, error)

	// PostUploadsUploadIdWithBodyWithResponse performs a POST /uploads/{upload_id} (the `PostUploadsUploadId` operationId) request,
	// with any type of body and a specified content type.
	//
	// Upload a chunk of bytes to the upload session.
	//
	// Returns a wrapper object for the known response body format(s).
	PostUploadsUploadIdWithBodyWithResponse(ctx context.Context, uploadId string, params *PostUploadsUploadIdParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostUploadsUploadIdResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type CreateChatCompletionJSONRequestBody

type CreateChatCompletionJSONRequestBody = CreateChatCompletionRequest

CreateChatCompletionJSONRequestBody defines body for CreateChatCompletion for application/json ContentType.

type CreateChatCompletionRequest

type CreateChatCompletionRequest struct {
	// MaxCompletionTokens The maximum number of tokens to generate.
	MaxCompletionTokens *int `json:"max_completion_tokens,omitempty"`

	// Messages List of messages in the conversation.
	Messages []Message `json:"messages"`

	// Model The identifier of the model to use.
	Model string `json:"model"`

	// RepetitionPenalty Controls the likelyhood and generating repetitive responses.
	RepetitionPenalty *float64 `json:"repetition_penalty,omitempty"`

	// ResponseFormat An object specifying the format that the model must output.
	// Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema.
	// If not specified, the default is {"type": "text"}, and model will return a free-form text response.
	ResponseFormat *ResponseFormat `json:"response_format,omitempty"`

	// Stream If True, generate an SSE event stream of the response. Defaults to False.
	Stream *bool `json:"stream,omitempty"`

	// Temperature Controls randomness of the response by setting a temperature. Higher value leads to more creative responses. Lower values will make the response more focused and deterministic.
	Temperature *float64 `json:"temperature,omitempty"`

	// ToolChoice Controls which (if any) tool is called by the model.
	// `none` means the model will not call any tool and instead generates a message.
	// `auto` means the model can pick between generating a message or calling one or more tools.
	// `required` means the model must call one or more tools.
	// Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
	//
	// `none` is the default when no tools are present. `auto` is the default if tools are present.
	ToolChoice *ChatCompletionToolChoiceOption `json:"tool_choice,omitempty"`

	// Tools List of tool definitions available to the model
	Tools *[]ChatCompletionTool `json:"tools,omitempty"`

	// TopK Only sample from the top K options for each subsequent token.
	TopK *int `json:"top_k,omitempty"`

	// TopP Controls diversity of the response by setting a probability threshold when choosing the next token.
	TopP *float64 `json:"top_p,omitempty"`

	// User A unique identifier representing your application end-user for monitoring abuse.
	User *string `json:"user,omitempty"`
}

CreateChatCompletionRequest defines model for CreateChatCompletionRequest.

type CreateChatCompletionResponse

type CreateChatCompletionResponse struct {
	// CompletionMessage The complete response message
	CompletionMessage AssistantMessage `json:"completion_message"`

	// Id The unique identifier of the chat completion request.
	Id      *string             `json:"id,omitempty"`
	Metrics *[]MetricInResponse `json:"metrics,omitempty"`
}

CreateChatCompletionResponse Response from a chat completion request.

type CreateChatCompletionResponse2

type CreateChatCompletionResponse2 struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *CreateChatCompletionResponse
	// JSON400 the response for an HTTP 400 `application/json` response
	JSON400 *BadRequest400
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *TooManyRequests429
	// JSON500 the response for an HTTP 500 `application/json` response
	JSON500 *InternalServerError500
	// JSONDefault the response for an HTTP default `application/json` response
	JSONDefault *DefaultError
}

func ParseCreateChatCompletionResponse2

func ParseCreateChatCompletionResponse2(rsp *http.Response) (*CreateChatCompletionResponse2, error)

ParseCreateChatCompletionResponse2 parses an HTTP response from a CreateChatCompletionWithResponse call

func (CreateChatCompletionResponse2) ContentType

func (r CreateChatCompletionResponse2) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (CreateChatCompletionResponse2) GetBody

func (r CreateChatCompletionResponse2) GetBody() []byte

GetBody returns the raw response body bytes

func (CreateChatCompletionResponse2) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (CreateChatCompletionResponse2) GetJSON400

GetJSON400 returns the response for an HTTP 400 `application/json` response

func (CreateChatCompletionResponse2) GetJSON429

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (CreateChatCompletionResponse2) GetJSON500

GetJSON500 returns the response for an HTTP 500 `application/json` response

func (CreateChatCompletionResponse2) GetJSONDefault

func (r CreateChatCompletionResponse2) GetJSONDefault() *DefaultError

GetJSONDefault returns the response for an HTTP default `application/json` response

func (CreateChatCompletionResponse2) Status

Status returns HTTPResponse.Status

func (CreateChatCompletionResponse2) StatusCode

func (r CreateChatCompletionResponse2) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type CreateChatCompletionResponseEvent

type CreateChatCompletionResponseEvent struct {
	// Delta Content generated since last event. This can be one or more tokens, or a tool call.
	Delta ChatCompletionStreamResponseDelta `json:"delta"`

	// EventType Type of the event
	EventType CreateChatCompletionResponseEventEventType `json:"event_type"`
	Metrics   *[]MetricInResponse                        `json:"metrics,omitempty"`

	// StopReason The reason why we stopped. Options are: - "stop": The model reached a natural stopping point. - "tool_calls": The model finished generating and invoked a tool call. - "length": The model reached the maxinum number of tokens specified in the request.
	StopReason *CreateChatCompletionResponseEventStopReason `json:"stop_reason,omitempty"`
}

CreateChatCompletionResponseEvent An event during chat completion generation.

type CreateChatCompletionResponseEventEventType

type CreateChatCompletionResponseEventEventType string

CreateChatCompletionResponseEventEventType Type of the event

const (
	CreateChatCompletionResponseEventEventTypeComplete CreateChatCompletionResponseEventEventType = "complete"
	CreateChatCompletionResponseEventEventTypeMetrics  CreateChatCompletionResponseEventEventType = "metrics"
	CreateChatCompletionResponseEventEventTypeProgress CreateChatCompletionResponseEventEventType = "progress"
	CreateChatCompletionResponseEventEventTypeStart    CreateChatCompletionResponseEventEventType = "start"
)

Defines values for CreateChatCompletionResponseEventEventType.

func (CreateChatCompletionResponseEventEventType) Valid

Valid indicates whether the value is a known member of the CreateChatCompletionResponseEventEventType enum.

type CreateChatCompletionResponseEventStopReason

type CreateChatCompletionResponseEventStopReason string

CreateChatCompletionResponseEventStopReason The reason why we stopped. Options are: - "stop": The model reached a natural stopping point. - "tool_calls": The model finished generating and invoked a tool call. - "length": The model reached the maxinum number of tokens specified in the request.

const (
	CreateChatCompletionResponseEventStopReasonLength    CreateChatCompletionResponseEventStopReason = "length"
	CreateChatCompletionResponseEventStopReasonStop      CreateChatCompletionResponseEventStopReason = "stop"
	CreateChatCompletionResponseEventStopReasonToolCalls CreateChatCompletionResponseEventStopReason = "tool_calls"
)

Defines values for CreateChatCompletionResponseEventStopReason.

func (CreateChatCompletionResponseEventStopReason) Valid

Valid indicates whether the value is a known member of the CreateChatCompletionResponseEventStopReason enum.

type CreateChatCompletionResponseStreamChunk

type CreateChatCompletionResponseStreamChunk struct {
	// Event The event containing the new content
	Event CreateChatCompletionResponseEvent `json:"event"`

	// Id The unique identifier of the chat completion request.
	Id *string `json:"id,omitempty"`
}

CreateChatCompletionResponseStreamChunk A chunk of a streamed chat completion response.

type DefaultError

type DefaultError = Error

DefaultError Error response from the API. Roughly follows RFC 7807.

type Error

type Error struct {
	// Detail Error detail, a longer human-readable description of the error
	Detail string `json:"detail"`

	// Instance A URL which can be used to retrieve more information about the specific occurrence of the error
	Instance *string `json:"instance,omitempty"`

	// Status HTTP status code
	Status int `json:"status"`

	// Title Error title, a short summary of the error which is invariant for an error type
	Title string `json:"title"`
}

Error Error response from the API. Roughly follows RFC 7807.

type FunctionObject

type FunctionObject struct {
	// Description A description of what the function does, used by the model to choose when and how to call the function.
	Description *string `json:"description,omitempty"`

	// Name The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
	Name string `json:"name"`

	// Parameters The parameters the functions accepts, described as a JSON Schema object. Omitting `parameters` defines a function with an empty parameter list.
	Parameters *FunctionParameters `json:"parameters,omitempty"`

	// Strict Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
	Strict *bool `json:"strict,omitempty"`
}

FunctionObject defines model for FunctionObject.

type FunctionParameters

type FunctionParameters map[string]interface{}

FunctionParameters The parameters the functions accepts, described as a JSON Schema object. Omitting `parameters` defines a function with an empty parameter list.

type GetUploadsUploadIdParams

type GetUploadsUploadIdParams struct {
	XAPIVersion *GetUploadsUploadIdParamsXAPIVersion `json:"X-API-Version,omitempty"`
}

GetUploadsUploadIdParams defines parameters for GetUploadsUploadId.

type GetUploadsUploadIdParamsXAPIVersion

type GetUploadsUploadIdParamsXAPIVersion string

GetUploadsUploadIdParamsXAPIVersion defines parameters for GetUploadsUploadId.

const (
	GetUploadsUploadIdParamsXAPIVersionN100 GetUploadsUploadIdParamsXAPIVersion = "1.0.0"
)

Defines values for GetUploadsUploadIdParamsXAPIVersion.

func (GetUploadsUploadIdParamsXAPIVersion) Valid

Valid indicates whether the value is a known member of the GetUploadsUploadIdParamsXAPIVersion enum.

type GetUploadsUploadIdResponse

type GetUploadsUploadIdResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *GetUploadsWithUploadIdResponseSchema
	// Headers200 the parsed response headers for an HTTP 200 response
	Headers200 *GetUploadsUploadIdResponse200Headers
}

func ParseGetUploadsUploadIdResponse

func ParseGetUploadsUploadIdResponse(rsp *http.Response) (*GetUploadsUploadIdResponse, error)

ParseGetUploadsUploadIdResponse parses an HTTP response from a GetUploadsUploadIdWithResponse call

func (GetUploadsUploadIdResponse) ContentType

func (r GetUploadsUploadIdResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetUploadsUploadIdResponse) GetBody

func (r GetUploadsUploadIdResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetUploadsUploadIdResponse) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetUploadsUploadIdResponse) Status

Status returns HTTPResponse.Status

func (GetUploadsUploadIdResponse) StatusCode

func (r GetUploadsUploadIdResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetUploadsUploadIdResponse200Headers

type GetUploadsUploadIdResponse200Headers struct {
	AccessControlAllowOrigin    *string
	AccessControlExposeHeaders  *string
	XRateLimitLimitRequests     *string
	XRateLimitLimitTokens       *string
	XRateLimitRemainingRequests *string
	XRateLimitRemainingTokens   *string
	XRateLimitRetryAfter        *string
}

GetUploadsUploadIdResponse200Headers the declared response headers of an HTTP 200 response for GetUploadsUploadId

type GetUploadsWithUploadIdResponseSchema

type GetUploadsWithUploadIdResponseSchema struct {
	// Offset This is a zero-based numeric index of byte number in which the current upload session to be resuming upload from
	Offset *int `json:"offset,omitempty"`

	// UploadId The unique upload session identifier to use for uploading the file
	UploadId string `json:"upload_id"`
}

GetUploadsWithUploadIdResponseSchema defines model for GetUploadsWithUploadIdResponseSchema.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type InternalServerError500

type InternalServerError500 = Error

InternalServerError500 Error response from the API. Roughly follows RFC 7807.

type JsonSchemaResponseFormat

type JsonSchemaResponseFormat struct {
	// JsonSchema The JSON schema the response should conform to.
	JsonSchema struct {
		// Name The name of the response format.
		Name string `json:"name"`

		// Schema The JSON schema the response should conform to. In a Python SDK, this is often a `pydantic` model.
		Schema JsonSchemaResponseFormatSchema `json:"schema"`
	} `json:"json_schema"`

	// Type The type of response format being defined. Always `json_schema`.
	Type JsonSchemaResponseFormatType `json:"type"`
}

JsonSchemaResponseFormat Configuration for JSON schema-guided response generation.

type JsonSchemaResponseFormatSchema

type JsonSchemaResponseFormatSchema = map[string]interface{}

JsonSchemaResponseFormatSchema The JSON schema the response should conform to. In a Python SDK, this is often a `pydantic` model.

type JsonSchemaResponseFormatType

type JsonSchemaResponseFormatType string

JsonSchemaResponseFormatType The type of response format being defined. Always `json_schema`.

const (
	JsonSchemaResponseFormatTypeJsonSchema JsonSchemaResponseFormatType = "json_schema"
)

Defines values for JsonSchemaResponseFormatType.

func (JsonSchemaResponseFormatType) Valid

Valid indicates whether the value is a known member of the JsonSchemaResponseFormatType enum.

type ListModelsResponse

type ListModelsResponse struct {
	Data   []Model                   `json:"data"`
	Object *ListModelsResponseObject `json:"object,omitempty"`
}

ListModelsResponse defines model for ListModelsResponse.

type ListModelsResponse2

type ListModelsResponse2 struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *ListModelsResponse
	// JSON400 the response for an HTTP 400 `application/json` response
	JSON400 *BadRequest400
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *TooManyRequests429
	// JSON500 the response for an HTTP 500 `application/json` response
	JSON500 *InternalServerError500
	// JSONDefault the response for an HTTP default `application/json` response
	JSONDefault *DefaultError
}

func ParseListModelsResponse2

func ParseListModelsResponse2(rsp *http.Response) (*ListModelsResponse2, error)

ParseListModelsResponse2 parses an HTTP response from a ListModelsWithResponse call

func (ListModelsResponse2) ContentType

func (r ListModelsResponse2) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (ListModelsResponse2) GetBody

func (r ListModelsResponse2) GetBody() []byte

GetBody returns the raw response body bytes

func (ListModelsResponse2) GetJSON200

func (r ListModelsResponse2) GetJSON200() *ListModelsResponse

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (ListModelsResponse2) GetJSON400

func (r ListModelsResponse2) GetJSON400() *BadRequest400

GetJSON400 returns the response for an HTTP 400 `application/json` response

func (ListModelsResponse2) GetJSON429

func (r ListModelsResponse2) GetJSON429() *TooManyRequests429

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (ListModelsResponse2) GetJSON500

GetJSON500 returns the response for an HTTP 500 `application/json` response

func (ListModelsResponse2) GetJSONDefault

func (r ListModelsResponse2) GetJSONDefault() *DefaultError

GetJSONDefault returns the response for an HTTP default `application/json` response

func (ListModelsResponse2) Status

func (r ListModelsResponse2) Status() string

Status returns HTTPResponse.Status

func (ListModelsResponse2) StatusCode

func (r ListModelsResponse2) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListModelsResponseObject

type ListModelsResponseObject string

ListModelsResponseObject defines model for ListModelsResponse.Object.

const (
	ListModelsResponseObjectList ListModelsResponseObject = "list"
)

Defines values for ListModelsResponseObject.

func (ListModelsResponseObject) Valid

func (e ListModelsResponseObject) Valid() bool

Valid indicates whether the value is a known member of the ListModelsResponseObject enum.

type Message

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

Message defines model for Message.

func (Message) AsAssistantMessage

func (t Message) AsAssistantMessage() (AssistantMessage, error)

AsAssistantMessage returns the union data inside the Message as a AssistantMessage

func (Message) AsSystemMessage

func (t Message) AsSystemMessage() (SystemMessage, error)

AsSystemMessage returns the union data inside the Message as a SystemMessage

func (Message) AsToolResponseMessage

func (t Message) AsToolResponseMessage() (ToolResponseMessage, error)

AsToolResponseMessage returns the union data inside the Message as a ToolResponseMessage

func (Message) AsUserMessage

func (t Message) AsUserMessage() (UserMessage, error)

AsUserMessage returns the union data inside the Message as a UserMessage

func (Message) Discriminator

func (t Message) Discriminator() (string, error)

func (*Message) FromAssistantMessage

func (t *Message) FromAssistantMessage(v AssistantMessage) error

FromAssistantMessage overwrites any union data inside the Message as the provided AssistantMessage

func (*Message) FromSystemMessage

func (t *Message) FromSystemMessage(v SystemMessage) error

FromSystemMessage overwrites any union data inside the Message as the provided SystemMessage

func (*Message) FromToolResponseMessage

func (t *Message) FromToolResponseMessage(v ToolResponseMessage) error

FromToolResponseMessage overwrites any union data inside the Message as the provided ToolResponseMessage

func (*Message) FromUserMessage

func (t *Message) FromUserMessage(v UserMessage) error

FromUserMessage overwrites any union data inside the Message as the provided UserMessage

func (Message) MarshalJSON

func (t Message) MarshalJSON() ([]byte, error)

func (*Message) MergeAssistantMessage

func (t *Message) MergeAssistantMessage(v AssistantMessage) error

MergeAssistantMessage performs a merge with any union data inside the Message, using the provided AssistantMessage

func (*Message) MergeSystemMessage

func (t *Message) MergeSystemMessage(v SystemMessage) error

MergeSystemMessage performs a merge with any union data inside the Message, using the provided SystemMessage

func (*Message) MergeToolResponseMessage

func (t *Message) MergeToolResponseMessage(v ToolResponseMessage) error

MergeToolResponseMessage performs a merge with any union data inside the Message, using the provided ToolResponseMessage

func (*Message) MergeUserMessage

func (t *Message) MergeUserMessage(v UserMessage) error

MergeUserMessage performs a merge with any union data inside the Message, using the provided UserMessage

func (*Message) UnmarshalJSON

func (t *Message) UnmarshalJSON(b []byte) error

func (Message) ValueByDiscriminator

func (t Message) ValueByDiscriminator() (interface{}, error)

type MessageImageContentItem

type MessageImageContentItem struct {
	// ImageUrl Contains either an image URL or a data URL for a base64 encoded image.
	ImageUrl struct {
		// Url Either a URL of the image or the base64 encoded image data.
		//
		// Examples: https://example.com/image.jpg
		Url string `json:"url"`
	} `json:"image_url"`

	// Type Discriminator type of the content item. Always "image"
	Type MessageImageContentItemType `json:"type"`
}

MessageImageContentItem A image content item

type MessageImageContentItemType

type MessageImageContentItemType string

MessageImageContentItemType Discriminator type of the content item. Always "image"

const (
	MessageImageContentItemTypeImageUrl MessageImageContentItemType = "image_url"
)

Defines values for MessageImageContentItemType.

func (MessageImageContentItemType) Valid

Valid indicates whether the value is a known member of the MessageImageContentItemType enum.

type MessageTextContentItem

type MessageTextContentItem struct {
	// Text Text content
	Text string `json:"text"`

	// Type Discriminator type of the content item. Always "text"
	Type MessageTextContentItemType `json:"type"`
}

MessageTextContentItem A text content item

type MessageTextContentItemType

type MessageTextContentItemType string

MessageTextContentItemType Discriminator type of the content item. Always "text"

const (
	MessageTextContentItemTypeText MessageTextContentItemType = "text"
)

Defines values for MessageTextContentItemType.

func (MessageTextContentItemType) Valid

func (e MessageTextContentItemType) Valid() bool

Valid indicates whether the value is a known member of the MessageTextContentItemType enum.

type MessageToolCall

type MessageToolCall struct {
	// Function The function that the model called.
	Function struct {
		// Arguments The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
		Arguments string `json:"arguments"`

		// Name The name of the function to call.
		Name string `json:"name"`
	} `json:"function"`

	// Id The ID of the tool call.
	Id string `json:"id"`
}

MessageToolCall defines model for MessageToolCall.

type MessageToolCalls

type MessageToolCalls = []MessageToolCall

MessageToolCalls The tool calls generated by the model, such as function calls.

type MetricInResponse

type MetricInResponse struct {
	Metric string                 `json:"metric"`
	Unit   *string                `json:"unit,omitempty"`
	Value  MetricInResponse_Value `json:"value"`
}

MetricInResponse defines model for MetricInResponse.

type MetricInResponseValue0

type MetricInResponseValue0 = int

MetricInResponseValue0 defines model for MetricInResponse.Value.0.

type MetricInResponseValue1

type MetricInResponseValue1 = float64

MetricInResponseValue1 defines model for MetricInResponse.Value.1.

type MetricInResponse_Value

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

MetricInResponse_Value defines model for MetricInResponse.Value.

func (MetricInResponse_Value) AsMetricInResponseValue0

func (t MetricInResponse_Value) AsMetricInResponseValue0() (MetricInResponseValue0, error)

AsMetricInResponseValue0 returns the union data inside the MetricInResponse_Value as a MetricInResponseValue0

func (MetricInResponse_Value) AsMetricInResponseValue1

func (t MetricInResponse_Value) AsMetricInResponseValue1() (MetricInResponseValue1, error)

AsMetricInResponseValue1 returns the union data inside the MetricInResponse_Value as a MetricInResponseValue1

func (*MetricInResponse_Value) FromMetricInResponseValue0

func (t *MetricInResponse_Value) FromMetricInResponseValue0(v MetricInResponseValue0) error

FromMetricInResponseValue0 overwrites any union data inside the MetricInResponse_Value as the provided MetricInResponseValue0

func (*MetricInResponse_Value) FromMetricInResponseValue1

func (t *MetricInResponse_Value) FromMetricInResponseValue1(v MetricInResponseValue1) error

FromMetricInResponseValue1 overwrites any union data inside the MetricInResponse_Value as the provided MetricInResponseValue1

func (MetricInResponse_Value) MarshalJSON

func (t MetricInResponse_Value) MarshalJSON() ([]byte, error)

func (*MetricInResponse_Value) MergeMetricInResponseValue0

func (t *MetricInResponse_Value) MergeMetricInResponseValue0(v MetricInResponseValue0) error

MergeMetricInResponseValue0 performs a merge with any union data inside the MetricInResponse_Value, using the provided MetricInResponseValue0

func (*MetricInResponse_Value) MergeMetricInResponseValue1

func (t *MetricInResponse_Value) MergeMetricInResponseValue1(v MetricInResponseValue1) error

MergeMetricInResponseValue1 performs a merge with any union data inside the MetricInResponse_Value, using the provided MetricInResponseValue1

func (*MetricInResponse_Value) UnmarshalJSON

func (t *MetricInResponse_Value) UnmarshalJSON(b []byte) error

type Model

type Model struct {
	// Created The creation time of the model.
	Created int `json:"created"`

	// Id The unique model identifier, which can be referenced in the API.
	Id string `json:"id"`

	// Object The object type, which is always "model"
	Object ModelObject `json:"object"`

	// OwnedBy The owner of the model.
	OwnedBy string `json:"owned_by"`
}

Model defines model for Model.

type ModelObject

type ModelObject string

ModelObject The object type, which is always "model"

const (
	ModelObjectModel ModelObject = "model"
)

Defines values for ModelObject.

func (ModelObject) Valid

func (e ModelObject) Valid() bool

Valid indicates whether the value is a known member of the ModelObject enum.

type ModerationObject

type ModerationObject struct {
	Flagged           bool     `json:"flagged"`
	FlaggedCategories []string `json:"flagged_categories"`
}

ModerationObject defines model for ModerationObject.

type ModerationRequest

type ModerationRequest struct {
	// Messages List of messages in the conversation.
	Messages []Message `json:"messages"`

	// Model Optional identifier of the model to use. Defaults to "Llama-Guard".
	Model *string `json:"model,omitempty"`
}

ModerationRequest defines model for ModerationRequest.

type ModerationResponse

type ModerationResponse struct {
	Model   string             `json:"model"`
	Results []ModerationObject `json:"results"`
}

ModerationResponse defines model for ModerationResponse.

type ModerationsJSONRequestBody

type ModerationsJSONRequestBody = ModerationRequest

ModerationsJSONRequestBody defines body for Moderations for application/json ContentType.

type ModerationsResponse

type ModerationsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *ModerationResponse
	// JSON400 the response for an HTTP 400 `application/json` response
	JSON400 *BadRequest400
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *TooManyRequests429
	// JSON500 the response for an HTTP 500 `application/json` response
	JSON500 *InternalServerError500
	// JSONDefault the response for an HTTP default `application/json` response
	JSONDefault *DefaultError
}

func ParseModerationsResponse

func ParseModerationsResponse(rsp *http.Response) (*ModerationsResponse, error)

ParseModerationsResponse parses an HTTP response from a ModerationsWithResponse call

func (ModerationsResponse) ContentType

func (r ModerationsResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (ModerationsResponse) GetBody

func (r ModerationsResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (ModerationsResponse) GetJSON200

func (r ModerationsResponse) GetJSON200() *ModerationResponse

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (ModerationsResponse) GetJSON400

func (r ModerationsResponse) GetJSON400() *BadRequest400

GetJSON400 returns the response for an HTTP 400 `application/json` response

func (ModerationsResponse) GetJSON429

func (r ModerationsResponse) GetJSON429() *TooManyRequests429

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (ModerationsResponse) GetJSON500

GetJSON500 returns the response for an HTTP 500 `application/json` response

func (ModerationsResponse) GetJSONDefault

func (r ModerationsResponse) GetJSONDefault() *DefaultError

GetJSONDefault returns the response for an HTTP default `application/json` response

func (ModerationsResponse) Status

func (r ModerationsResponse) Status() string

Status returns HTTPResponse.Status

func (ModerationsResponse) StatusCode

func (r ModerationsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PostUploadsJSONRequestBody

type PostUploadsJSONRequestBody = PostUploadsRequestSchema

PostUploadsJSONRequestBody defines body for PostUploads for application/json ContentType.

type PostUploadsParams

type PostUploadsParams struct {
	XAPIVersion *PostUploadsParamsXAPIVersion `json:"X-API-Version,omitempty"`
}

PostUploadsParams defines parameters for PostUploads.

type PostUploadsParamsXAPIVersion

type PostUploadsParamsXAPIVersion string

PostUploadsParamsXAPIVersion defines parameters for PostUploads.

const (
	PostUploadsParamsXAPIVersionN100 PostUploadsParamsXAPIVersion = "1.0.0"
)

Defines values for PostUploadsParamsXAPIVersion.

func (PostUploadsParamsXAPIVersion) Valid

Valid indicates whether the value is a known member of the PostUploadsParamsXAPIVersion enum.

type PostUploadsRequestSchema

type PostUploadsRequestSchema struct {
	// Bytes The number of bytes in the file you are uploading
	Bytes int `json:"bytes"`

	// Filename The name of the file to upload
	Filename string `json:"filename"`

	// MimeType The MIME type of the file. Must be one of the supported MIME type for the given purpose.
	MimeType PostUploadsRequestSchemaMimeType `json:"mime_type"`

	// Purpose Intended purpose of the uploaded file.
	Purpose PostUploadsRequestSchemaPurpose `json:"purpose"`
}

PostUploadsRequestSchema defines model for PostUploadsRequestSchema.

type PostUploadsRequestSchemaMimeType

type PostUploadsRequestSchemaMimeType string

PostUploadsRequestSchemaMimeType The MIME type of the file. Must be one of the supported MIME type for the given purpose.

const (
	PostUploadsRequestSchemaMimeTypeApplicationjson  PostUploadsRequestSchemaMimeType = "application/json"
	PostUploadsRequestSchemaMimeTypeApplicationjsonl PostUploadsRequestSchemaMimeType = "application/jsonl"
	PostUploadsRequestSchemaMimeTypeApplicationpdf   PostUploadsRequestSchemaMimeType = "application/pdf"
	PostUploadsRequestSchemaMimeTypeAudiomp3         PostUploadsRequestSchemaMimeType = "audio/mp3"
	PostUploadsRequestSchemaMimeTypeAudiompeg        PostUploadsRequestSchemaMimeType = "audio/mpeg"
	PostUploadsRequestSchemaMimeTypeAudiowav         PostUploadsRequestSchemaMimeType = "audio/wav"
	PostUploadsRequestSchemaMimeTypeAudioxWav        PostUploadsRequestSchemaMimeType = "audio/x-wav"
	PostUploadsRequestSchemaMimeTypeImagegif         PostUploadsRequestSchemaMimeType = "image/gif"
	PostUploadsRequestSchemaMimeTypeImagejpeg        PostUploadsRequestSchemaMimeType = "image/jpeg"
	PostUploadsRequestSchemaMimeTypeImagejpg         PostUploadsRequestSchemaMimeType = "image/jpg"
	PostUploadsRequestSchemaMimeTypeImagepng         PostUploadsRequestSchemaMimeType = "image/png"
	PostUploadsRequestSchemaMimeTypeImagewebp        PostUploadsRequestSchemaMimeType = "image/webp"
	PostUploadsRequestSchemaMimeTypeImagexIcon       PostUploadsRequestSchemaMimeType = "image/x-icon"
	PostUploadsRequestSchemaMimeTypeTextplain        PostUploadsRequestSchemaMimeType = "text/plain"
	PostUploadsRequestSchemaMimeTypeVideomp4         PostUploadsRequestSchemaMimeType = "video/mp4"
)

Defines values for PostUploadsRequestSchemaMimeType.

func (PostUploadsRequestSchemaMimeType) Valid

Valid indicates whether the value is a known member of the PostUploadsRequestSchemaMimeType enum.

type PostUploadsRequestSchemaPurpose

type PostUploadsRequestSchemaPurpose string

PostUploadsRequestSchemaPurpose Intended purpose of the uploaded file.

const (
	PostUploadsRequestSchemaPurposeAttachment            PostUploadsRequestSchemaPurpose = "attachment"
	PostUploadsRequestSchemaPurposeEphemeralAttachment   PostUploadsRequestSchemaPurpose = "ephemeral_attachment"
	PostUploadsRequestSchemaPurposeImageGenerationResult PostUploadsRequestSchemaPurpose = "image_generation_result"
	PostUploadsRequestSchemaPurposeMessagesEval          PostUploadsRequestSchemaPurpose = "messages_eval"
	PostUploadsRequestSchemaPurposeMessagesFinetune      PostUploadsRequestSchemaPurpose = "messages_finetune"
	PostUploadsRequestSchemaPurposeMetadata              PostUploadsRequestSchemaPurpose = "metadata"
)

Defines values for PostUploadsRequestSchemaPurpose.

func (PostUploadsRequestSchemaPurpose) Valid

Valid indicates whether the value is a known member of the PostUploadsRequestSchemaPurpose enum.

type PostUploadsResponse

type PostUploadsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON201 the response for an HTTP 201 `application/json` response
	JSON201 *PostUploadsResponseSchema
	// Headers201 the parsed response headers for an HTTP 201 response
	Headers201 *PostUploadsResponse201Headers
}

func ParsePostUploadsResponse

func ParsePostUploadsResponse(rsp *http.Response) (*PostUploadsResponse, error)

ParsePostUploadsResponse parses an HTTP response from a PostUploadsWithResponse call

func (PostUploadsResponse) ContentType

func (r PostUploadsResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (PostUploadsResponse) GetBody

func (r PostUploadsResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (PostUploadsResponse) GetJSON201

GetJSON201 returns the response for an HTTP 201 `application/json` response

func (PostUploadsResponse) Status

func (r PostUploadsResponse) Status() string

Status returns HTTPResponse.Status

func (PostUploadsResponse) StatusCode

func (r PostUploadsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PostUploadsResponse201Headers

type PostUploadsResponse201Headers struct {
	AccessControlAllowOrigin    *string
	AccessControlExposeHeaders  *string
	XRateLimitLimitRequests     *string
	XRateLimitLimitTokens       *string
	XRateLimitRemainingRequests *string
	XRateLimitRemainingTokens   *string
	XRateLimitRetryAfter        *string
}

PostUploadsResponse201Headers the declared response headers of an HTTP 201 response for PostUploads

type PostUploadsResponseSchema

type PostUploadsResponseSchema struct {
	// Bytes The number of bytes in the file you are uploading
	Bytes int `json:"bytes"`

	// Filename The name of the file to upload
	Filename string `json:"filename"`

	// Id The unique upload session identifier to use for uploading the file
	Id string `json:"id"`

	// MimeType The MIME type of the file. Must be one of the supported MIME type for the given purpose.
	MimeType PostUploadsResponseSchemaMimeType `json:"mime_type"`

	// Purpose Intended purpose of the uploaded file.
	Purpose PostUploadsResponseSchemaPurpose `json:"purpose"`
}

PostUploadsResponseSchema defines model for PostUploadsResponseSchema.

type PostUploadsResponseSchemaMimeType

type PostUploadsResponseSchemaMimeType string

PostUploadsResponseSchemaMimeType The MIME type of the file. Must be one of the supported MIME type for the given purpose.

const (
	PostUploadsResponseSchemaMimeTypeApplicationjson  PostUploadsResponseSchemaMimeType = "application/json"
	PostUploadsResponseSchemaMimeTypeApplicationjsonl PostUploadsResponseSchemaMimeType = "application/jsonl"
	PostUploadsResponseSchemaMimeTypeApplicationpdf   PostUploadsResponseSchemaMimeType = "application/pdf"
	PostUploadsResponseSchemaMimeTypeAudiomp3         PostUploadsResponseSchemaMimeType = "audio/mp3"
	PostUploadsResponseSchemaMimeTypeAudiompeg        PostUploadsResponseSchemaMimeType = "audio/mpeg"
	PostUploadsResponseSchemaMimeTypeAudiowav         PostUploadsResponseSchemaMimeType = "audio/wav"
	PostUploadsResponseSchemaMimeTypeAudioxWav        PostUploadsResponseSchemaMimeType = "audio/x-wav"
	PostUploadsResponseSchemaMimeTypeImagegif         PostUploadsResponseSchemaMimeType = "image/gif"
	PostUploadsResponseSchemaMimeTypeImagejpeg        PostUploadsResponseSchemaMimeType = "image/jpeg"
	PostUploadsResponseSchemaMimeTypeImagejpg         PostUploadsResponseSchemaMimeType = "image/jpg"
	PostUploadsResponseSchemaMimeTypeImagepng         PostUploadsResponseSchemaMimeType = "image/png"
	PostUploadsResponseSchemaMimeTypeImagewebp        PostUploadsResponseSchemaMimeType = "image/webp"
	PostUploadsResponseSchemaMimeTypeImagexIcon       PostUploadsResponseSchemaMimeType = "image/x-icon"
	PostUploadsResponseSchemaMimeTypeTextplain        PostUploadsResponseSchemaMimeType = "text/plain"
	PostUploadsResponseSchemaMimeTypeVideomp4         PostUploadsResponseSchemaMimeType = "video/mp4"
)

Defines values for PostUploadsResponseSchemaMimeType.

func (PostUploadsResponseSchemaMimeType) Valid

Valid indicates whether the value is a known member of the PostUploadsResponseSchemaMimeType enum.

type PostUploadsResponseSchemaPurpose

type PostUploadsResponseSchemaPurpose string

PostUploadsResponseSchemaPurpose Intended purpose of the uploaded file.

const (
	PostUploadsResponseSchemaPurposeAttachment            PostUploadsResponseSchemaPurpose = "attachment"
	PostUploadsResponseSchemaPurposeEphemeralAttachment   PostUploadsResponseSchemaPurpose = "ephemeral_attachment"
	PostUploadsResponseSchemaPurposeImageGenerationResult PostUploadsResponseSchemaPurpose = "image_generation_result"
	PostUploadsResponseSchemaPurposeMessagesEval          PostUploadsResponseSchemaPurpose = "messages_eval"
	PostUploadsResponseSchemaPurposeMessagesFinetune      PostUploadsResponseSchemaPurpose = "messages_finetune"
	PostUploadsResponseSchemaPurposeMetadata              PostUploadsResponseSchemaPurpose = "metadata"
)

Defines values for PostUploadsResponseSchemaPurpose.

func (PostUploadsResponseSchemaPurpose) Valid

Valid indicates whether the value is a known member of the PostUploadsResponseSchemaPurpose enum.

type PostUploadsUploadIdMultipartRequestBody

type PostUploadsUploadIdMultipartRequestBody = PostUploadsWithUploadIdRequestSchema

PostUploadsUploadIdMultipartRequestBody defines body for PostUploadsUploadId for multipart/form-data ContentType.

type PostUploadsUploadIdParams

type PostUploadsUploadIdParams struct {
	// XUploadOffset The offset of the chunk of bytes to upload for the upload session
	XUploadOffset *int                                  `json:"X-Upload-Offset,omitempty"`
	XAPIVersion   *PostUploadsUploadIdParamsXAPIVersion `json:"X-API-Version,omitempty"`
}

PostUploadsUploadIdParams defines parameters for PostUploadsUploadId.

type PostUploadsUploadIdParamsXAPIVersion

type PostUploadsUploadIdParamsXAPIVersion string

PostUploadsUploadIdParamsXAPIVersion defines parameters for PostUploadsUploadId.

const (
	PostUploadsUploadIdParamsXAPIVersionN100 PostUploadsUploadIdParamsXAPIVersion = "1.0.0"
)

Defines values for PostUploadsUploadIdParamsXAPIVersion.

func (PostUploadsUploadIdParamsXAPIVersion) Valid

Valid indicates whether the value is a known member of the PostUploadsUploadIdParamsXAPIVersion enum.

type PostUploadsUploadIdResponse

type PostUploadsUploadIdResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *PostUploadsWithUploadIdResponseSchema
	// Headers200 the parsed response headers for an HTTP 200 response
	Headers200 *PostUploadsUploadIdResponse200Headers
}

func ParsePostUploadsUploadIdResponse

func ParsePostUploadsUploadIdResponse(rsp *http.Response) (*PostUploadsUploadIdResponse, error)

ParsePostUploadsUploadIdResponse parses an HTTP response from a PostUploadsUploadIdWithResponse call

func (PostUploadsUploadIdResponse) ContentType

func (r PostUploadsUploadIdResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (PostUploadsUploadIdResponse) GetBody

func (r PostUploadsUploadIdResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (PostUploadsUploadIdResponse) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (PostUploadsUploadIdResponse) Status

Status returns HTTPResponse.Status

func (PostUploadsUploadIdResponse) StatusCode

func (r PostUploadsUploadIdResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PostUploadsUploadIdResponse200Headers

type PostUploadsUploadIdResponse200Headers struct {
	AccessControlAllowOrigin    *string
	AccessControlExposeHeaders  *string
	XRateLimitLimitRequests     *string
	XRateLimitLimitTokens       *string
	XRateLimitRemainingRequests *string
	XRateLimitRemainingTokens   *string
	XRateLimitRetryAfter        *string
}

PostUploadsUploadIdResponse200Headers the declared response headers of an HTTP 200 response for PostUploadsUploadId

type PostUploadsWithUploadIdRequestSchema

type PostUploadsWithUploadIdRequestSchema struct {
	// Data The chunk of bytes to upload
	Data openapi_types.File `json:"data"`
}

PostUploadsWithUploadIdRequestSchema defines model for PostUploadsWithUploadIdRequestSchema.

type PostUploadsWithUploadIdResponseSchema

type PostUploadsWithUploadIdResponseSchema struct {
	// FileId The ready file identifier after the upload is complete
	FileId *string `json:"file_id,omitempty"`

	// Offset This is a zero-based numeric index of byte number in which the current upload session to be resuming upload from
	Offset *int `json:"offset,omitempty"`

	// UploadId The unique upload session identifier to use for uploading the file
	UploadId string `json:"upload_id"`
}

PostUploadsWithUploadIdResponseSchema defines model for PostUploadsWithUploadIdResponseSchema.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type ResponseFormat

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

ResponseFormat defines model for ResponseFormat.

func (ResponseFormat) AsJsonSchemaResponseFormat

func (t ResponseFormat) AsJsonSchemaResponseFormat() (JsonSchemaResponseFormat, error)

AsJsonSchemaResponseFormat returns the union data inside the ResponseFormat as a JsonSchemaResponseFormat

func (ResponseFormat) AsTextResponseFormat

func (t ResponseFormat) AsTextResponseFormat() (TextResponseFormat, error)

AsTextResponseFormat returns the union data inside the ResponseFormat as a TextResponseFormat

func (ResponseFormat) Discriminator

func (t ResponseFormat) Discriminator() (string, error)

func (*ResponseFormat) FromJsonSchemaResponseFormat

func (t *ResponseFormat) FromJsonSchemaResponseFormat(v JsonSchemaResponseFormat) error

FromJsonSchemaResponseFormat overwrites any union data inside the ResponseFormat as the provided JsonSchemaResponseFormat

func (*ResponseFormat) FromTextResponseFormat

func (t *ResponseFormat) FromTextResponseFormat(v TextResponseFormat) error

FromTextResponseFormat overwrites any union data inside the ResponseFormat as the provided TextResponseFormat

func (ResponseFormat) MarshalJSON

func (t ResponseFormat) MarshalJSON() ([]byte, error)

func (*ResponseFormat) MergeJsonSchemaResponseFormat

func (t *ResponseFormat) MergeJsonSchemaResponseFormat(v JsonSchemaResponseFormat) error

MergeJsonSchemaResponseFormat performs a merge with any union data inside the ResponseFormat, using the provided JsonSchemaResponseFormat

func (*ResponseFormat) MergeTextResponseFormat

func (t *ResponseFormat) MergeTextResponseFormat(v TextResponseFormat) error

MergeTextResponseFormat performs a merge with any union data inside the ResponseFormat, using the provided TextResponseFormat

func (*ResponseFormat) UnmarshalJSON

func (t *ResponseFormat) UnmarshalJSON(b []byte) error

func (ResponseFormat) ValueByDiscriminator

func (t ResponseFormat) ValueByDiscriminator() (interface{}, error)

type RetrieveModelResponse

type RetrieveModelResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *Model
	// JSON400 the response for an HTTP 400 `application/json` response
	JSON400 *BadRequest400
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *TooManyRequests429
	// JSON500 the response for an HTTP 500 `application/json` response
	JSON500 *InternalServerError500
	// JSONDefault the response for an HTTP default `application/json` response
	JSONDefault *DefaultError
}

func ParseRetrieveModelResponse

func ParseRetrieveModelResponse(rsp *http.Response) (*RetrieveModelResponse, error)

ParseRetrieveModelResponse parses an HTTP response from a RetrieveModelWithResponse call

func (RetrieveModelResponse) ContentType

func (r RetrieveModelResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (RetrieveModelResponse) GetBody

func (r RetrieveModelResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (RetrieveModelResponse) GetJSON200

func (r RetrieveModelResponse) GetJSON200() *Model

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (RetrieveModelResponse) GetJSON400

func (r RetrieveModelResponse) GetJSON400() *BadRequest400

GetJSON400 returns the response for an HTTP 400 `application/json` response

func (RetrieveModelResponse) GetJSON429

func (r RetrieveModelResponse) GetJSON429() *TooManyRequests429

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (RetrieveModelResponse) GetJSON500

GetJSON500 returns the response for an HTTP 500 `application/json` response

func (RetrieveModelResponse) GetJSONDefault

func (r RetrieveModelResponse) GetJSONDefault() *DefaultError

GetJSONDefault returns the response for an HTTP default `application/json` response

func (RetrieveModelResponse) Status

func (r RetrieveModelResponse) Status() string

Status returns HTTPResponse.Status

func (RetrieveModelResponse) StatusCode

func (r RetrieveModelResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SystemMessage

type SystemMessage struct {
	// Content The content of the system message.
	Content SystemMessage_Content `json:"content"`

	// Role Must be "system" to identify this as a system message
	Role SystemMessageRole `json:"role"`
}

SystemMessage A system message providing instructions or context to the model.

type SystemMessageContent0

type SystemMessageContent0 = string

SystemMessageContent0 The text contents of the message.

type SystemMessageContent1

type SystemMessageContent1 = []MessageTextContentItem

SystemMessageContent1 A list of content items, which can include text and other media. Supported content types differ based on model.

type SystemMessageRole

type SystemMessageRole string

SystemMessageRole Must be "system" to identify this as a system message

const (
	SystemMessageRoleSystem SystemMessageRole = "system"
)

Defines values for SystemMessageRole.

func (SystemMessageRole) Valid

func (e SystemMessageRole) Valid() bool

Valid indicates whether the value is a known member of the SystemMessageRole enum.

type SystemMessage_Content

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

SystemMessage_Content The content of the system message.

func (SystemMessage_Content) AsSystemMessageContent0

func (t SystemMessage_Content) AsSystemMessageContent0() (SystemMessageContent0, error)

AsSystemMessageContent0 returns the union data inside the SystemMessage_Content as a SystemMessageContent0

func (SystemMessage_Content) AsSystemMessageContent1

func (t SystemMessage_Content) AsSystemMessageContent1() (SystemMessageContent1, error)

AsSystemMessageContent1 returns the union data inside the SystemMessage_Content as a SystemMessageContent1

func (*SystemMessage_Content) FromSystemMessageContent0

func (t *SystemMessage_Content) FromSystemMessageContent0(v SystemMessageContent0) error

FromSystemMessageContent0 overwrites any union data inside the SystemMessage_Content as the provided SystemMessageContent0

func (*SystemMessage_Content) FromSystemMessageContent1

func (t *SystemMessage_Content) FromSystemMessageContent1(v SystemMessageContent1) error

FromSystemMessageContent1 overwrites any union data inside the SystemMessage_Content as the provided SystemMessageContent1

func (SystemMessage_Content) MarshalJSON

func (t SystemMessage_Content) MarshalJSON() ([]byte, error)

func (*SystemMessage_Content) MergeSystemMessageContent0

func (t *SystemMessage_Content) MergeSystemMessageContent0(v SystemMessageContent0) error

MergeSystemMessageContent0 performs a merge with any union data inside the SystemMessage_Content, using the provided SystemMessageContent0

func (*SystemMessage_Content) MergeSystemMessageContent1

func (t *SystemMessage_Content) MergeSystemMessageContent1(v SystemMessageContent1) error

MergeSystemMessageContent1 performs a merge with any union data inside the SystemMessage_Content, using the provided SystemMessageContent1

func (*SystemMessage_Content) UnmarshalJSON

func (t *SystemMessage_Content) UnmarshalJSON(b []byte) error

type TextDelta

type TextDelta struct {
	Text string        `json:"text"`
	Type TextDeltaType `json:"type"`
}

TextDelta defines model for TextDelta.

type TextDeltaType

type TextDeltaType string

TextDeltaType defines model for TextDelta.Type.

const (
	TextDeltaTypeText TextDeltaType = "text"
)

Defines values for TextDeltaType.

func (TextDeltaType) Valid

func (e TextDeltaType) Valid() bool

Valid indicates whether the value is a known member of the TextDeltaType enum.

type TextResponseFormat

type TextResponseFormat struct {
	// Type The type of response format being defined. Always `text`.
	Type TextResponseFormatType `json:"type"`
}

TextResponseFormat Configuration for text-guided response generation.

type TextResponseFormatType

type TextResponseFormatType string

TextResponseFormatType The type of response format being defined. Always `text`.

const (
	TextResponseFormatTypeText TextResponseFormatType = "text"
)

Defines values for TextResponseFormatType.

func (TextResponseFormatType) Valid

func (e TextResponseFormatType) Valid() bool

Valid indicates whether the value is a known member of the TextResponseFormatType enum.

type TooManyRequests429

type TooManyRequests429 = Error

TooManyRequests429 Error response from the API. Roughly follows RFC 7807.

type ToolCallDelta

type ToolCallDelta struct {
	Function struct {
		// Arguments The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
		Arguments *string `json:"arguments,omitempty"`

		// Name The name of the function to call.
		Name *string `json:"name,omitempty"`
	} `json:"function"`

	// Id The ID of the tool call.
	Id   *string           `json:"id,omitempty"`
	Type ToolCallDeltaType `json:"type"`
}

ToolCallDelta defines model for ToolCallDelta.

type ToolCallDeltaType

type ToolCallDeltaType string

ToolCallDeltaType defines model for ToolCallDelta.Type.

const (
	ToolCallDeltaTypeToolCall ToolCallDeltaType = "tool_call"
)

Defines values for ToolCallDeltaType.

func (ToolCallDeltaType) Valid

func (e ToolCallDeltaType) Valid() bool

Valid indicates whether the value is a known member of the ToolCallDeltaType enum.

type ToolResponseMessage

type ToolResponseMessage struct {
	// Content The content of the user message, which can include text and other media.
	Content ToolResponseMessage_Content `json:"content"`

	// Role Must be "tool" to identify this as a tool response
	Role ToolResponseMessageRole `json:"role"`

	// ToolCallId Unique identifier for the tool call this response is for
	ToolCallId string `json:"tool_call_id"`
}

ToolResponseMessage A message representing the result of a tool invocation.

type ToolResponseMessageContent0

type ToolResponseMessageContent0 = string

ToolResponseMessageContent0 The text contents of the message.

type ToolResponseMessageContent1

type ToolResponseMessageContent1 = []MessageTextContentItem

ToolResponseMessageContent1 A list of content items, which can include text and other media. Supported content types differ based on model.

type ToolResponseMessageRole

type ToolResponseMessageRole string

ToolResponseMessageRole Must be "tool" to identify this as a tool response

const (
	ToolResponseMessageRoleTool ToolResponseMessageRole = "tool"
)

Defines values for ToolResponseMessageRole.

func (ToolResponseMessageRole) Valid

func (e ToolResponseMessageRole) Valid() bool

Valid indicates whether the value is a known member of the ToolResponseMessageRole enum.

type ToolResponseMessage_Content

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

ToolResponseMessage_Content The content of the user message, which can include text and other media.

func (ToolResponseMessage_Content) AsToolResponseMessageContent0

func (t ToolResponseMessage_Content) AsToolResponseMessageContent0() (ToolResponseMessageContent0, error)

AsToolResponseMessageContent0 returns the union data inside the ToolResponseMessage_Content as a ToolResponseMessageContent0

func (ToolResponseMessage_Content) AsToolResponseMessageContent1

func (t ToolResponseMessage_Content) AsToolResponseMessageContent1() (ToolResponseMessageContent1, error)

AsToolResponseMessageContent1 returns the union data inside the ToolResponseMessage_Content as a ToolResponseMessageContent1

func (*ToolResponseMessage_Content) FromToolResponseMessageContent0

func (t *ToolResponseMessage_Content) FromToolResponseMessageContent0(v ToolResponseMessageContent0) error

FromToolResponseMessageContent0 overwrites any union data inside the ToolResponseMessage_Content as the provided ToolResponseMessageContent0

func (*ToolResponseMessage_Content) FromToolResponseMessageContent1

func (t *ToolResponseMessage_Content) FromToolResponseMessageContent1(v ToolResponseMessageContent1) error

FromToolResponseMessageContent1 overwrites any union data inside the ToolResponseMessage_Content as the provided ToolResponseMessageContent1

func (ToolResponseMessage_Content) MarshalJSON

func (t ToolResponseMessage_Content) MarshalJSON() ([]byte, error)

func (*ToolResponseMessage_Content) MergeToolResponseMessageContent0

func (t *ToolResponseMessage_Content) MergeToolResponseMessageContent0(v ToolResponseMessageContent0) error

MergeToolResponseMessageContent0 performs a merge with any union data inside the ToolResponseMessage_Content, using the provided ToolResponseMessageContent0

func (*ToolResponseMessage_Content) MergeToolResponseMessageContent1

func (t *ToolResponseMessage_Content) MergeToolResponseMessageContent1(v ToolResponseMessageContent1) error

MergeToolResponseMessageContent1 performs a merge with any union data inside the ToolResponseMessage_Content, using the provided ToolResponseMessageContent1

func (*ToolResponseMessage_Content) UnmarshalJSON

func (t *ToolResponseMessage_Content) UnmarshalJSON(b []byte) error

type UserMessage

type UserMessage struct {
	// Content The content of the user message, which can include text and other media.
	Content UserMessage_Content `json:"content"`

	// Role Must be "user" to identify this as a user message.
	Role UserMessageRole `json:"role"`
}

UserMessage A message from the user in a chat conversation.

type UserMessageContent0

type UserMessageContent0 = string

UserMessageContent0 The text contents of the message.

type UserMessageContent1

type UserMessageContent1 = []UserMessageContentItem

UserMessageContent1 A list of content items, which can include text and other media. Supported content types differ based on model.

type UserMessageContentItem

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

UserMessageContentItem defines model for UserMessageContentItem.

func (UserMessageContentItem) AsMessageImageContentItem

func (t UserMessageContentItem) AsMessageImageContentItem() (MessageImageContentItem, error)

AsMessageImageContentItem returns the union data inside the UserMessageContentItem as a MessageImageContentItem

func (UserMessageContentItem) AsMessageTextContentItem

func (t UserMessageContentItem) AsMessageTextContentItem() (MessageTextContentItem, error)

AsMessageTextContentItem returns the union data inside the UserMessageContentItem as a MessageTextContentItem

func (UserMessageContentItem) Discriminator

func (t UserMessageContentItem) Discriminator() (string, error)

func (*UserMessageContentItem) FromMessageImageContentItem

func (t *UserMessageContentItem) FromMessageImageContentItem(v MessageImageContentItem) error

FromMessageImageContentItem overwrites any union data inside the UserMessageContentItem as the provided MessageImageContentItem

func (*UserMessageContentItem) FromMessageTextContentItem

func (t *UserMessageContentItem) FromMessageTextContentItem(v MessageTextContentItem) error

FromMessageTextContentItem overwrites any union data inside the UserMessageContentItem as the provided MessageTextContentItem

func (UserMessageContentItem) MarshalJSON

func (t UserMessageContentItem) MarshalJSON() ([]byte, error)

func (*UserMessageContentItem) MergeMessageImageContentItem

func (t *UserMessageContentItem) MergeMessageImageContentItem(v MessageImageContentItem) error

MergeMessageImageContentItem performs a merge with any union data inside the UserMessageContentItem, using the provided MessageImageContentItem

func (*UserMessageContentItem) MergeMessageTextContentItem

func (t *UserMessageContentItem) MergeMessageTextContentItem(v MessageTextContentItem) error

MergeMessageTextContentItem performs a merge with any union data inside the UserMessageContentItem, using the provided MessageTextContentItem

func (*UserMessageContentItem) UnmarshalJSON

func (t *UserMessageContentItem) UnmarshalJSON(b []byte) error

func (UserMessageContentItem) ValueByDiscriminator

func (t UserMessageContentItem) ValueByDiscriminator() (interface{}, error)

type UserMessageRole

type UserMessageRole string

UserMessageRole Must be "user" to identify this as a user message.

const (
	UserMessageRoleUser UserMessageRole = "user"
)

Defines values for UserMessageRole.

func (UserMessageRole) Valid

func (e UserMessageRole) Valid() bool

Valid indicates whether the value is a known member of the UserMessageRole enum.

type UserMessage_Content

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

UserMessage_Content The content of the user message, which can include text and other media.

func (UserMessage_Content) AsUserMessageContent0

func (t UserMessage_Content) AsUserMessageContent0() (UserMessageContent0, error)

AsUserMessageContent0 returns the union data inside the UserMessage_Content as a UserMessageContent0

func (UserMessage_Content) AsUserMessageContent1

func (t UserMessage_Content) AsUserMessageContent1() (UserMessageContent1, error)

AsUserMessageContent1 returns the union data inside the UserMessage_Content as a UserMessageContent1

func (*UserMessage_Content) FromUserMessageContent0

func (t *UserMessage_Content) FromUserMessageContent0(v UserMessageContent0) error

FromUserMessageContent0 overwrites any union data inside the UserMessage_Content as the provided UserMessageContent0

func (*UserMessage_Content) FromUserMessageContent1

func (t *UserMessage_Content) FromUserMessageContent1(v UserMessageContent1) error

FromUserMessageContent1 overwrites any union data inside the UserMessage_Content as the provided UserMessageContent1

func (UserMessage_Content) MarshalJSON

func (t UserMessage_Content) MarshalJSON() ([]byte, error)

func (*UserMessage_Content) MergeUserMessageContent0

func (t *UserMessage_Content) MergeUserMessageContent0(v UserMessageContent0) error

MergeUserMessageContent0 performs a merge with any union data inside the UserMessage_Content, using the provided UserMessageContent0

func (*UserMessage_Content) MergeUserMessageContent1

func (t *UserMessage_Content) MergeUserMessageContent1(v UserMessageContent1) error

MergeUserMessageContent1 performs a merge with any union data inside the UserMessage_Content, using the provided UserMessageContent1

func (*UserMessage_Content) UnmarshalJSON

func (t *UserMessage_Content) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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