together

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 23 Imported by: 1

README

Together Go API Library

Go Reference

The Together Go library provides convenient access to the Together REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/togethercomputer/together-go" // imported as together
)

Or to pin the version:

go get -u 'github.com/togethercomputer/together-go@v0.1.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/togethercomputer/together-go"
	"github.com/togethercomputer/together-go/option"
)

func main() {
	client := together.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("TOGETHER_API_KEY")
	)
	chatCompletion, err := client.Chat.Completions.New(context.TODO(), together.ChatCompletionNewParams{
		Messages: []together.ChatCompletionNewParamsMessageUnion{{
			OfChatCompletionNewsMessageChatCompletionUserMessageParam: &together.ChatCompletionNewParamsMessageChatCompletionUserMessageParam{
				Role: "user",
				Content: together.ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion{
					OfString: together.String("Say this is a test!"),
				},
			},
		}},
		Model: together.ChatCompletionNewParamsModelQwenQwen2_5_72BInstructTurbo,
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", chatCompletion.Choices)
}

Request fields

The together library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, together.String(string), together.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := together.ExampleParams{
	ID:   "id_xxx",               // required property
	Name: together.String("..."), // optional property

	Point: together.Point{
		X: 0,               // required field will serialize as 0
		Y: together.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: together.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[together.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := together.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Chat.Completions.New(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *together.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Chat.Completions.New(context.TODO(), together.ChatCompletionNewParams{
	Messages: []together.ChatCompletionNewParamsMessageUnion{{
		OfChatCompletionNewsMessageChatCompletionUserMessageParam: &together.ChatCompletionNewParamsMessageChatCompletionUserMessageParam{
			Role: "user",
			Content: together.ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion{
				OfString: together.String("Say this is a test"),
			},
		},
	}},
	Model: together.ChatCompletionNewParamsModelQwenQwen2_5_72BInstructTurbo,
})
if err != nil {
	var apierr *together.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/chat/completions": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Chat.Completions.New(
	ctx,
	together.ChatCompletionNewParams{
		Messages: []together.ChatCompletionNewParamsMessageUnion{{
			OfChatCompletionNewsMessageChatCompletionUserMessageParam: &together.ChatCompletionNewParamsMessageChatCompletionUserMessageParam{
				Role: "user",
				Content: together.ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion{
					OfString: together.String("Say this is a test"),
				},
			},
		}},
		Model: together.ChatCompletionNewParamsModelQwenQwen2_5_72BInstructTurbo,
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper together.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

// A file from the file system
file, err := os.Open("/path/to/file")
together.FileUploadParams{
	File:     file,
	FileName: "dataset.csv",
	Purpose:  together.FilePurposeFineTune,
}

// A file from a string
together.FileUploadParams{
	File:     strings.NewReader("my file contents"),
	FileName: "dataset.csv",
	Purpose:  together.FilePurposeFineTune,
}

// With a custom filename and contentType
together.FileUploadParams{
	File:     together.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
	FileName: "dataset.csv",
	Purpose:  together.FilePurposeFineTune,
}
Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := together.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Chat.Completions.New(
	context.TODO(),
	together.ChatCompletionNewParams{
		Messages: []together.ChatCompletionNewParamsMessageUnion{{
			OfChatCompletionNewsMessageChatCompletionUserMessageParam: &together.ChatCompletionNewParamsMessageChatCompletionUserMessageParam{
				Role: "user",
				Content: together.ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion{
					OfString: together.String("Say this is a test"),
				},
			},
		}},
		Model: together.ChatCompletionNewParamsModelQwenQwen2_5_72BInstructTurbo,
	},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
chatCompletion, err := client.Chat.Completions.New(
	context.TODO(),
	together.ChatCompletionNewParams{
		Messages: []together.ChatCompletionNewParamsMessageUnion{{
			OfChatCompletionNewsMessageChatCompletionUserMessageParam: &together.ChatCompletionNewParamsMessageChatCompletionUserMessageParam{
				Role: "user",
				Content: together.ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion{
					OfString: together.String("Say this is a test"),
				},
			},
		}},
		Model: together.ChatCompletionNewParamsModelQwenQwen2_5_72BInstructTurbo,
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", chatCompletion)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: together.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := together.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (TOGETHER_API_KEY, TOGETHER_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AudioService

type AudioService struct {
	Options        []option.RequestOption
	Speech         AudioSpeechService
	Voices         AudioVoiceService
	Transcriptions AudioTranscriptionService
	Translations   AudioTranslationService
}

AudioService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAudioService method instead.

func NewAudioService

func NewAudioService(opts ...option.RequestOption) (r AudioService)

NewAudioService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type AudioSpeechNewParams

type AudioSpeechNewParams struct {
	// Input text to generate the audio for
	Input string `json:"input,required"`
	// The name of the model to query.
	//
	// [See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models)
	// The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M -
	// canopylabs/orpheus-3b-0.1-ft
	Model AudioSpeechNewParamsModel `json:"model,omitzero,required"`
	// The voice to use for generating the audio. The voices supported are different
	// for each model. For eg - for canopylabs/orpheus-3b-0.1-ft, one of the voices
	// supported is tara, for hexgrad/Kokoro-82M, one of the voices supported is
	// af_alloy and for cartesia/sonic, one of the voices supported is "friendly
	// sidekick".
	//
	// You can view the voices supported for each model using the /v1/voices endpoint
	// sending the model name as the query parameter.
	// [View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
	Voice string `json:"voice,required"`
	// Sampling rate to use for the output audio. The default sampling rate for
	// canopylabs/orpheus-3b-0.1-ft and hexgrad/Kokoro-82M is 24000 and for
	// cartesia/sonic is 44100.
	SampleRate param.Opt[int64] `json:"sample_rate,omitzero"`
	// Language of input text.
	//
	// Any of "en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru",
	// "sv", "tr", "zh".
	Language AudioSpeechNewParamsLanguage `json:"language,omitzero"`
	// Audio encoding of response
	//
	// Any of "pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw".
	ResponseEncoding AudioSpeechNewParamsResponseEncoding `json:"response_encoding,omitzero"`
	// The format of audio output. Supported formats are mp3, wav, raw if streaming is
	// false. If streaming is true, the only supported format is raw.
	//
	// Any of "mp3", "wav", "raw".
	ResponseFormat AudioSpeechNewParamsResponseFormat `json:"response_format,omitzero"`
	// contains filtered or unexported fields
}

func (AudioSpeechNewParams) MarshalJSON

func (r AudioSpeechNewParams) MarshalJSON() (data []byte, err error)

func (*AudioSpeechNewParams) UnmarshalJSON

func (r *AudioSpeechNewParams) UnmarshalJSON(data []byte) error

type AudioSpeechNewParamsLanguage

type AudioSpeechNewParamsLanguage string

Language of input text.

const (
	AudioSpeechNewParamsLanguageEn AudioSpeechNewParamsLanguage = "en"
	AudioSpeechNewParamsLanguageDe AudioSpeechNewParamsLanguage = "de"
	AudioSpeechNewParamsLanguageFr AudioSpeechNewParamsLanguage = "fr"
	AudioSpeechNewParamsLanguageEs AudioSpeechNewParamsLanguage = "es"
	AudioSpeechNewParamsLanguageHi AudioSpeechNewParamsLanguage = "hi"
	AudioSpeechNewParamsLanguageIt AudioSpeechNewParamsLanguage = "it"
	AudioSpeechNewParamsLanguageJa AudioSpeechNewParamsLanguage = "ja"
	AudioSpeechNewParamsLanguageKo AudioSpeechNewParamsLanguage = "ko"
	AudioSpeechNewParamsLanguageNl AudioSpeechNewParamsLanguage = "nl"
	AudioSpeechNewParamsLanguagePl AudioSpeechNewParamsLanguage = "pl"
	AudioSpeechNewParamsLanguagePt AudioSpeechNewParamsLanguage = "pt"
	AudioSpeechNewParamsLanguageRu AudioSpeechNewParamsLanguage = "ru"
	AudioSpeechNewParamsLanguageSv AudioSpeechNewParamsLanguage = "sv"
	AudioSpeechNewParamsLanguageTr AudioSpeechNewParamsLanguage = "tr"
	AudioSpeechNewParamsLanguageZh AudioSpeechNewParamsLanguage = "zh"
)

type AudioSpeechNewParamsModel

type AudioSpeechNewParamsModel string

The name of the model to query.

[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models) The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M - canopylabs/orpheus-3b-0.1-ft

const (
	AudioSpeechNewParamsModelCartesiaSonic            AudioSpeechNewParamsModel = "cartesia/sonic"
	AudioSpeechNewParamsModelHexgradKokoro82M         AudioSpeechNewParamsModel = "hexgrad/Kokoro-82M"
	AudioSpeechNewParamsModelCanopylabsOrpheus3b0_1Ft AudioSpeechNewParamsModel = "canopylabs/orpheus-3b-0.1-ft"
)

type AudioSpeechNewParamsResponseEncoding

type AudioSpeechNewParamsResponseEncoding string

Audio encoding of response

const (
	AudioSpeechNewParamsResponseEncodingPcmF32le AudioSpeechNewParamsResponseEncoding = "pcm_f32le"
	AudioSpeechNewParamsResponseEncodingPcmS16le AudioSpeechNewParamsResponseEncoding = "pcm_s16le"
	AudioSpeechNewParamsResponseEncodingPcmMulaw AudioSpeechNewParamsResponseEncoding = "pcm_mulaw"
	AudioSpeechNewParamsResponseEncodingPcmAlaw  AudioSpeechNewParamsResponseEncoding = "pcm_alaw"
)

type AudioSpeechNewParamsResponseFormat

type AudioSpeechNewParamsResponseFormat string

The format of audio output. Supported formats are mp3, wav, raw if streaming is false. If streaming is true, the only supported format is raw.

const (
	AudioSpeechNewParamsResponseFormatMP3 AudioSpeechNewParamsResponseFormat = "mp3"
	AudioSpeechNewParamsResponseFormatWav AudioSpeechNewParamsResponseFormat = "wav"
	AudioSpeechNewParamsResponseFormatRaw AudioSpeechNewParamsResponseFormat = "raw"
)

type AudioSpeechService

type AudioSpeechService struct {
	Options []option.RequestOption
}

AudioSpeechService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAudioSpeechService method instead.

func NewAudioSpeechService

func NewAudioSpeechService(opts ...option.RequestOption) (r AudioSpeechService)

NewAudioSpeechService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AudioSpeechService) New

Generate audio from input text

func (*AudioSpeechService) NewStreaming

Generate audio from input text

type AudioSpeechStreamChunk

type AudioSpeechStreamChunk struct {
	// base64 encoded audio stream
	B64   string `json:"b64,required"`
	Model string `json:"model,required"`
	// Any of "audio.tts.chunk".
	Object AudioSpeechStreamChunkObject `json:"object,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		B64         respjson.Field
		Model       respjson.Field
		Object      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioSpeechStreamChunk) RawJSON

func (r AudioSpeechStreamChunk) RawJSON() string

Returns the unmodified JSON received from the API

func (*AudioSpeechStreamChunk) UnmarshalJSON

func (r *AudioSpeechStreamChunk) UnmarshalJSON(data []byte) error

type AudioSpeechStreamChunkObject

type AudioSpeechStreamChunkObject string
const (
	AudioSpeechStreamChunkObjectAudioTtsChunk AudioSpeechStreamChunkObject = "audio.tts.chunk"
)

type AudioTranscriptionNewParams

type AudioTranscriptionNewParams struct {
	// Audio file to transcribe
	File io.Reader `json:"file,omitzero,required" format:"binary"`
	// Whether to enable speaker diarization. When enabled, you will get the speaker id
	// for each word in the transcription. In the response, in the words array, you
	// will get the speaker id for each word. In addition, we also return the
	// speaker_segments array which contains the speaker id for each speaker segment
	// along with the start and end time of the segment along with all the words in the
	// segment.
	//
	// For eg - ... "speaker_segments": [ "speaker_id": "SPEAKER_00", "start": 0,
	// "end": 30.02, "words": [ { "id": 0, "word": "Tijana", "start": 0, "end": 11.475,
	// "speaker_id": "SPEAKER_00" }, ...
	Diarize param.Opt[bool] `json:"diarize,omitzero"`
	// Optional ISO 639-1 language code. If `auto` is provided, language is
	// auto-detected.
	Language param.Opt[string] `json:"language,omitzero"`
	// Maximum number of speakers expected in the audio. Used to improve diarization
	// accuracy when the approximate number of speakers is known.
	MaxSpeakers param.Opt[int64] `json:"max_speakers,omitzero"`
	// Minimum number of speakers expected in the audio. Used to improve diarization
	// accuracy when the approximate number of speakers is known.
	MinSpeakers param.Opt[int64] `json:"min_speakers,omitzero"`
	// Optional text to bias decoding.
	Prompt param.Opt[string] `json:"prompt,omitzero"`
	// Sampling temperature between 0.0 and 1.0
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	// Model to use for transcription
	//
	// Any of "openai/whisper-large-v3".
	Model AudioTranscriptionNewParamsModel `json:"model,omitzero"`
	// The format of the response
	//
	// Any of "json", "verbose_json".
	ResponseFormat AudioTranscriptionNewParamsResponseFormat `json:"response_format,omitzero"`
	// Controls level of timestamp detail in verbose_json. Only used when
	// response_format is verbose_json. Can be a single granularity or an array to get
	// multiple levels.
	TimestampGranularities AudioTranscriptionNewParamsTimestampGranularitiesUnion `json:"timestamp_granularities,omitzero"`
	// contains filtered or unexported fields
}

func (AudioTranscriptionNewParams) MarshalMultipart

func (r AudioTranscriptionNewParams) MarshalMultipart() (data []byte, contentType string, err error)

type AudioTranscriptionNewParamsModel

type AudioTranscriptionNewParamsModel string

Model to use for transcription

const (
	AudioTranscriptionNewParamsModelOpenAIWhisperLargeV3 AudioTranscriptionNewParamsModel = "openai/whisper-large-v3"
)

type AudioTranscriptionNewParamsResponseFormat

type AudioTranscriptionNewParamsResponseFormat string

The format of the response

const (
	AudioTranscriptionNewParamsResponseFormatJson        AudioTranscriptionNewParamsResponseFormat = "json"
	AudioTranscriptionNewParamsResponseFormatVerboseJson AudioTranscriptionNewParamsResponseFormat = "verbose_json"
)

type AudioTranscriptionNewParamsTimestampGranularitiesString

type AudioTranscriptionNewParamsTimestampGranularitiesString string
const (
	AudioTranscriptionNewParamsTimestampGranularitiesStringSegment AudioTranscriptionNewParamsTimestampGranularitiesString = "segment"
	AudioTranscriptionNewParamsTimestampGranularitiesStringWord    AudioTranscriptionNewParamsTimestampGranularitiesString = "word"
)

type AudioTranscriptionNewParamsTimestampGranularitiesUnion

type AudioTranscriptionNewParamsTimestampGranularitiesUnion struct {
	// Check if union is this variant with
	// !param.IsOmitted(union.OfAudioTranscriptionNewsTimestampGranularitiesString)
	OfAudioTranscriptionNewsTimestampGranularitiesString         param.Opt[string] `json:",omitzero,inline"`
	OfAudioTranscriptionNewsTimestampGranularitiesArrayItemArray []string          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (AudioTranscriptionNewParamsTimestampGranularitiesUnion) MarshalJSON

func (*AudioTranscriptionNewParamsTimestampGranularitiesUnion) UnmarshalJSON

type AudioTranscriptionNewResponseAudioTranscriptionJsonResponse

type AudioTranscriptionNewResponseAudioTranscriptionJsonResponse struct {
	// The transcribed text
	Text string `json:"text,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranscriptionNewResponseAudioTranscriptionJsonResponse) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranscriptionNewResponseAudioTranscriptionJsonResponse) UnmarshalJSON

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse struct {
	// The duration of the audio in seconds
	Duration float64 `json:"duration,required"`
	// The language of the audio
	Language string `json:"language,required"`
	// Array of transcription segments
	Segments []AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSegment `json:"segments,required"`
	// The task performed
	//
	// Any of "transcribe", "translate".
	Task string `json:"task,required"`
	// The transcribed text
	Text string `json:"text,required"`
	// Array of transcription speaker segments (only when diarize is enabled)
	SpeakerSegments []AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegment `json:"speaker_segments"`
	// Array of transcription words (only when timestamp_granularities includes 'word')
	Words []AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseWord `json:"words"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Duration        respjson.Field
		Language        respjson.Field
		Segments        respjson.Field
		Task            respjson.Field
		Text            respjson.Field
		SpeakerSegments respjson.Field
		Words           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse) UnmarshalJSON

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSegment

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSegment struct {
	// Unique identifier for the segment
	ID int64 `json:"id,required"`
	// End time of the segment in seconds
	End float64 `json:"end,required"`
	// Start time of the segment in seconds
	Start float64 `json:"start,required"`
	// The text content of the segment
	Text string `json:"text,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		End         respjson.Field
		Start       respjson.Field
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSegment) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSegment) UnmarshalJSON

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegment

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegment struct {
	// Unique identifier for the speaker segment
	ID int64 `json:"id,required"`
	// End time of the speaker segment in seconds
	End float64 `json:"end,required"`
	// The speaker identifier
	SpeakerID string `json:"speaker_id,required"`
	// Start time of the speaker segment in seconds
	Start float64 `json:"start,required"`
	// The full text spoken by this speaker in this segment
	Text string `json:"text,required"`
	// Array of words spoken by this speaker in this segment
	Words []AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegmentWord `json:"words,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		End         respjson.Field
		SpeakerID   respjson.Field
		Start       respjson.Field
		Text        respjson.Field
		Words       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegment) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegment) UnmarshalJSON

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegmentWord

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegmentWord struct {
	// End time of the word in seconds
	End float64 `json:"end,required"`
	// Start time of the word in seconds
	Start float64 `json:"start,required"`
	// The word
	Word string `json:"word,required"`
	// The speaker id for the word (only when diarize is enabled)
	SpeakerID string `json:"speaker_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		Word        respjson.Field
		SpeakerID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegmentWord) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegmentWord) UnmarshalJSON

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseWord

type AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseWord struct {
	// End time of the word in seconds
	End float64 `json:"end,required"`
	// Start time of the word in seconds
	Start float64 `json:"start,required"`
	// The word
	Word string `json:"word,required"`
	// The speaker id for the word (only when diarize is enabled)
	SpeakerID string `json:"speaker_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		Word        respjson.Field
		SpeakerID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseWord) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseWord) UnmarshalJSON

type AudioTranscriptionNewResponseUnion

type AudioTranscriptionNewResponseUnion struct {
	Text string `json:"text"`
	// This field is from variant
	// [AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse].
	Duration float64 `json:"duration"`
	// This field is from variant
	// [AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse].
	Language string `json:"language"`
	// This field is from variant
	// [AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse].
	Segments []AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSegment `json:"segments"`
	// This field is from variant
	// [AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse].
	Task string `json:"task"`
	// This field is from variant
	// [AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse].
	SpeakerSegments []AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseSpeakerSegment `json:"speaker_segments"`
	// This field is from variant
	// [AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse].
	Words []AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseWord `json:"words"`
	JSON  struct {
		Text            respjson.Field
		Duration        respjson.Field
		Language        respjson.Field
		Segments        respjson.Field
		Task            respjson.Field
		SpeakerSegments respjson.Field
		Words           respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AudioTranscriptionNewResponseUnion contains all possible properties and values from AudioTranscriptionNewResponseAudioTranscriptionJsonResponse, AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (AudioTranscriptionNewResponseUnion) AsAudioTranscriptionNewResponseAudioTranscriptionJsonResponse

func (u AudioTranscriptionNewResponseUnion) AsAudioTranscriptionNewResponseAudioTranscriptionJsonResponse() (v AudioTranscriptionNewResponseAudioTranscriptionJsonResponse)

func (AudioTranscriptionNewResponseUnion) AsAudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse

func (u AudioTranscriptionNewResponseUnion) AsAudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse() (v AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponse)

func (AudioTranscriptionNewResponseUnion) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranscriptionNewResponseUnion) UnmarshalJSON

func (r *AudioTranscriptionNewResponseUnion) UnmarshalJSON(data []byte) error

type AudioTranscriptionService

type AudioTranscriptionService struct {
	Options []option.RequestOption
}

AudioTranscriptionService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAudioTranscriptionService method instead.

func NewAudioTranscriptionService

func NewAudioTranscriptionService(opts ...option.RequestOption) (r AudioTranscriptionService)

NewAudioTranscriptionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AudioTranscriptionService) New

Transcribes audio into text

type AudioTranslationNewParams

type AudioTranslationNewParams struct {
	// Audio file to translate
	File io.Reader `json:"file,omitzero,required" format:"binary"`
	// Target output language. Optional ISO 639-1 language code. If omitted, language
	// is set to English.
	Language param.Opt[string] `json:"language,omitzero"`
	// Optional text to bias decoding.
	Prompt param.Opt[string] `json:"prompt,omitzero"`
	// Sampling temperature between 0.0 and 1.0
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	// Model to use for translation
	//
	// Any of "openai/whisper-large-v3".
	Model AudioTranslationNewParamsModel `json:"model,omitzero"`
	// The format of the response
	//
	// Any of "json", "verbose_json".
	ResponseFormat AudioTranslationNewParamsResponseFormat `json:"response_format,omitzero"`
	// Controls level of timestamp detail in verbose_json. Only used when
	// response_format is verbose_json. Can be a single granularity or an array to get
	// multiple levels.
	TimestampGranularities AudioTranslationNewParamsTimestampGranularitiesUnion `json:"timestamp_granularities,omitzero"`
	// contains filtered or unexported fields
}

func (AudioTranslationNewParams) MarshalMultipart

func (r AudioTranslationNewParams) MarshalMultipart() (data []byte, contentType string, err error)

type AudioTranslationNewParamsModel

type AudioTranslationNewParamsModel string

Model to use for translation

const (
	AudioTranslationNewParamsModelOpenAIWhisperLargeV3 AudioTranslationNewParamsModel = "openai/whisper-large-v3"
)

type AudioTranslationNewParamsResponseFormat

type AudioTranslationNewParamsResponseFormat string

The format of the response

const (
	AudioTranslationNewParamsResponseFormatJson        AudioTranslationNewParamsResponseFormat = "json"
	AudioTranslationNewParamsResponseFormatVerboseJson AudioTranslationNewParamsResponseFormat = "verbose_json"
)

type AudioTranslationNewParamsTimestampGranularitiesString

type AudioTranslationNewParamsTimestampGranularitiesString string
const (
	AudioTranslationNewParamsTimestampGranularitiesStringSegment AudioTranslationNewParamsTimestampGranularitiesString = "segment"
	AudioTranslationNewParamsTimestampGranularitiesStringWord    AudioTranslationNewParamsTimestampGranularitiesString = "word"
)

type AudioTranslationNewParamsTimestampGranularitiesUnion

type AudioTranslationNewParamsTimestampGranularitiesUnion struct {
	// Check if union is this variant with
	// !param.IsOmitted(union.OfAudioTranslationNewsTimestampGranularitiesString)
	OfAudioTranslationNewsTimestampGranularitiesString         param.Opt[string] `json:",omitzero,inline"`
	OfAudioTranslationNewsTimestampGranularitiesArrayItemArray []string          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (AudioTranslationNewParamsTimestampGranularitiesUnion) MarshalJSON

func (*AudioTranslationNewParamsTimestampGranularitiesUnion) UnmarshalJSON

type AudioTranslationNewResponseAudioTranslationJsonResponse

type AudioTranslationNewResponseAudioTranslationJsonResponse struct {
	// The translated text
	Text string `json:"text,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranslationNewResponseAudioTranslationJsonResponse) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranslationNewResponseAudioTranslationJsonResponse) UnmarshalJSON

type AudioTranslationNewResponseAudioTranslationVerboseJsonResponse

type AudioTranslationNewResponseAudioTranslationVerboseJsonResponse struct {
	// The duration of the audio in seconds
	Duration float64 `json:"duration,required"`
	// The target language of the translation
	Language string `json:"language,required"`
	// Array of translation segments
	Segments []AudioTranslationNewResponseAudioTranslationVerboseJsonResponseSegment `json:"segments,required"`
	// The task performed
	//
	// Any of "transcribe", "translate".
	Task string `json:"task,required"`
	// The translated text
	Text string `json:"text,required"`
	// Array of translation words (only when timestamp_granularities includes 'word')
	Words []AudioTranslationNewResponseAudioTranslationVerboseJsonResponseWord `json:"words"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Duration    respjson.Field
		Language    respjson.Field
		Segments    respjson.Field
		Task        respjson.Field
		Text        respjson.Field
		Words       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranslationNewResponseAudioTranslationVerboseJsonResponse) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranslationNewResponseAudioTranslationVerboseJsonResponse) UnmarshalJSON

type AudioTranslationNewResponseAudioTranslationVerboseJsonResponseSegment

type AudioTranslationNewResponseAudioTranslationVerboseJsonResponseSegment struct {
	// Unique identifier for the segment
	ID int64 `json:"id,required"`
	// End time of the segment in seconds
	End float64 `json:"end,required"`
	// Start time of the segment in seconds
	Start float64 `json:"start,required"`
	// The text content of the segment
	Text string `json:"text,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		End         respjson.Field
		Start       respjson.Field
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranslationNewResponseAudioTranslationVerboseJsonResponseSegment) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranslationNewResponseAudioTranslationVerboseJsonResponseSegment) UnmarshalJSON

type AudioTranslationNewResponseAudioTranslationVerboseJsonResponseWord

type AudioTranslationNewResponseAudioTranslationVerboseJsonResponseWord struct {
	// End time of the word in seconds
	End float64 `json:"end,required"`
	// Start time of the word in seconds
	Start float64 `json:"start,required"`
	// The word
	Word string `json:"word,required"`
	// The speaker id for the word (only when diarize is enabled)
	SpeakerID string `json:"speaker_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		Word        respjson.Field
		SpeakerID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioTranslationNewResponseAudioTranslationVerboseJsonResponseWord) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranslationNewResponseAudioTranslationVerboseJsonResponseWord) UnmarshalJSON

type AudioTranslationNewResponseUnion

type AudioTranslationNewResponseUnion struct {
	Text string `json:"text"`
	// This field is from variant
	// [AudioTranslationNewResponseAudioTranslationVerboseJsonResponse].
	Duration float64 `json:"duration"`
	// This field is from variant
	// [AudioTranslationNewResponseAudioTranslationVerboseJsonResponse].
	Language string `json:"language"`
	// This field is from variant
	// [AudioTranslationNewResponseAudioTranslationVerboseJsonResponse].
	Segments []AudioTranslationNewResponseAudioTranslationVerboseJsonResponseSegment `json:"segments"`
	// This field is from variant
	// [AudioTranslationNewResponseAudioTranslationVerboseJsonResponse].
	Task string `json:"task"`
	// This field is from variant
	// [AudioTranslationNewResponseAudioTranslationVerboseJsonResponse].
	Words []AudioTranslationNewResponseAudioTranslationVerboseJsonResponseWord `json:"words"`
	JSON  struct {
		Text     respjson.Field
		Duration respjson.Field
		Language respjson.Field
		Segments respjson.Field
		Task     respjson.Field
		Words    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AudioTranslationNewResponseUnion contains all possible properties and values from AudioTranslationNewResponseAudioTranslationJsonResponse, AudioTranslationNewResponseAudioTranslationVerboseJsonResponse.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (AudioTranslationNewResponseUnion) AsAudioTranslationNewResponseAudioTranslationJsonResponse

func (u AudioTranslationNewResponseUnion) AsAudioTranslationNewResponseAudioTranslationJsonResponse() (v AudioTranslationNewResponseAudioTranslationJsonResponse)

func (AudioTranslationNewResponseUnion) AsAudioTranslationNewResponseAudioTranslationVerboseJsonResponse

func (u AudioTranslationNewResponseUnion) AsAudioTranslationNewResponseAudioTranslationVerboseJsonResponse() (v AudioTranslationNewResponseAudioTranslationVerboseJsonResponse)

func (AudioTranslationNewResponseUnion) RawJSON

Returns the unmodified JSON received from the API

func (*AudioTranslationNewResponseUnion) UnmarshalJSON

func (r *AudioTranslationNewResponseUnion) UnmarshalJSON(data []byte) error

type AudioTranslationService

type AudioTranslationService struct {
	Options []option.RequestOption
}

AudioTranslationService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAudioTranslationService method instead.

func NewAudioTranslationService

func NewAudioTranslationService(opts ...option.RequestOption) (r AudioTranslationService)

NewAudioTranslationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AudioTranslationService) New

Translates audio into English

type AudioVoiceListResponse

type AudioVoiceListResponse struct {
	Data []AudioVoiceListResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response containing a list of models and their available voices.

func (AudioVoiceListResponse) RawJSON

func (r AudioVoiceListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AudioVoiceListResponse) UnmarshalJSON

func (r *AudioVoiceListResponse) UnmarshalJSON(data []byte) error

type AudioVoiceListResponseData

type AudioVoiceListResponseData struct {
	Model  string                            `json:"model,required"`
	Voices []AudioVoiceListResponseDataVoice `json:"voices,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Model       respjson.Field
		Voices      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a model with its available voices.

func (AudioVoiceListResponseData) RawJSON

func (r AudioVoiceListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*AudioVoiceListResponseData) UnmarshalJSON

func (r *AudioVoiceListResponseData) UnmarshalJSON(data []byte) error

type AudioVoiceListResponseDataVoice

type AudioVoiceListResponseDataVoice struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AudioVoiceListResponseDataVoice) RawJSON

Returns the unmodified JSON received from the API

func (*AudioVoiceListResponseDataVoice) UnmarshalJSON

func (r *AudioVoiceListResponseDataVoice) UnmarshalJSON(data []byte) error

type AudioVoiceService

type AudioVoiceService struct {
	Options []option.RequestOption
}

AudioVoiceService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAudioVoiceService method instead.

func NewAudioVoiceService

func NewAudioVoiceService(opts ...option.RequestOption) (r AudioVoiceService)

NewAudioVoiceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AudioVoiceService) List

Fetch available voices for each model

type Autoscaling

type Autoscaling struct {
	// The maximum number of replicas to scale up to under load
	MaxReplicas int64 `json:"max_replicas,required"`
	// The minimum number of replicas to maintain, even when there is no load
	MinReplicas int64 `json:"min_replicas,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MaxReplicas respjson.Field
		MinReplicas respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for automatic scaling of replicas based on demand.

func (Autoscaling) RawJSON

func (r Autoscaling) RawJSON() string

Returns the unmodified JSON received from the API

func (Autoscaling) ToParam

func (r Autoscaling) ToParam() AutoscalingParam

ToParam converts this Autoscaling to a AutoscalingParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with AutoscalingParam.Overrides()

func (*Autoscaling) UnmarshalJSON

func (r *Autoscaling) UnmarshalJSON(data []byte) error

type AutoscalingParam

type AutoscalingParam struct {
	// The maximum number of replicas to scale up to under load
	MaxReplicas int64 `json:"max_replicas,required"`
	// The minimum number of replicas to maintain, even when there is no load
	MinReplicas int64 `json:"min_replicas,required"`
	// contains filtered or unexported fields
}

Configuration for automatic scaling of replicas based on demand.

The properties MaxReplicas, MinReplicas are required.

func (AutoscalingParam) MarshalJSON

func (r AutoscalingParam) MarshalJSON() (data []byte, err error)

func (*AutoscalingParam) UnmarshalJSON

func (r *AutoscalingParam) UnmarshalJSON(data []byte) error

type BatchJob

type BatchJob struct {
	ID          string    `json:"id" format:"uuid"`
	CompletedAt time.Time `json:"completed_at" format:"date-time"`
	CreatedAt   time.Time `json:"created_at" format:"date-time"`
	Endpoint    string    `json:"endpoint"`
	Error       string    `json:"error"`
	ErrorFileID string    `json:"error_file_id"`
	// Size of input file in bytes
	FileSizeBytes int64     `json:"file_size_bytes"`
	InputFileID   string    `json:"input_file_id"`
	JobDeadline   time.Time `json:"job_deadline" format:"date-time"`
	// Model used for processing requests
	ModelID      string `json:"model_id"`
	OutputFileID string `json:"output_file_id"`
	// Completion progress (0.0 to 100)
	Progress float64 `json:"progress"`
	// Current status of the batch job
	//
	// Any of "VALIDATING", "IN_PROGRESS", "COMPLETED", "FAILED", "EXPIRED",
	// "CANCELLED".
	Status BatchJobStatus `json:"status"`
	UserID string         `json:"user_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		CompletedAt   respjson.Field
		CreatedAt     respjson.Field
		Endpoint      respjson.Field
		Error         respjson.Field
		ErrorFileID   respjson.Field
		FileSizeBytes respjson.Field
		InputFileID   respjson.Field
		JobDeadline   respjson.Field
		ModelID       respjson.Field
		OutputFileID  respjson.Field
		Progress      respjson.Field
		Status        respjson.Field
		UserID        respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BatchJob) RawJSON

func (r BatchJob) RawJSON() string

Returns the unmodified JSON received from the API

func (*BatchJob) UnmarshalJSON

func (r *BatchJob) UnmarshalJSON(data []byte) error

type BatchJobStatus

type BatchJobStatus string

Current status of the batch job

const (
	BatchJobStatusValidating BatchJobStatus = "VALIDATING"
	BatchJobStatusInProgress BatchJobStatus = "IN_PROGRESS"
	BatchJobStatusCompleted  BatchJobStatus = "COMPLETED"
	BatchJobStatusFailed     BatchJobStatus = "FAILED"
	BatchJobStatusExpired    BatchJobStatus = "EXPIRED"
	BatchJobStatusCancelled  BatchJobStatus = "CANCELLED"
)

type BatchNewParams

type BatchNewParams struct {
	// The endpoint to use for batch processing
	Endpoint string `json:"endpoint,required"`
	// ID of the uploaded input file containing batch requests
	InputFileID string `json:"input_file_id,required"`
	// Time window for batch completion (optional)
	CompletionWindow param.Opt[string] `json:"completion_window,omitzero"`
	// Model to use for processing batch requests
	ModelID param.Opt[string] `json:"model_id,omitzero"`
	// Priority for batch processing (optional)
	Priority param.Opt[int64] `json:"priority,omitzero"`
	// contains filtered or unexported fields
}

func (BatchNewParams) MarshalJSON

func (r BatchNewParams) MarshalJSON() (data []byte, err error)

func (*BatchNewParams) UnmarshalJSON

func (r *BatchNewParams) UnmarshalJSON(data []byte) error

type BatchNewResponse

type BatchNewResponse struct {
	Job     BatchJob `json:"job"`
	Warning string   `json:"warning"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Job         respjson.Field
		Warning     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BatchNewResponse) RawJSON

func (r BatchNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BatchNewResponse) UnmarshalJSON

func (r *BatchNewResponse) UnmarshalJSON(data []byte) error

type BatchService

type BatchService struct {
	Options []option.RequestOption
}

BatchService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBatchService method instead.

func NewBatchService

func NewBatchService(opts ...option.RequestOption) (r BatchService)

NewBatchService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BatchService) Cancel

func (r *BatchService) Cancel(ctx context.Context, id string, opts ...option.RequestOption) (res *BatchJob, err error)

Cancel a batch job by ID

func (*BatchService) Get

func (r *BatchService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *BatchJob, err error)

Get details of a batch job by ID

func (*BatchService) List

func (r *BatchService) List(ctx context.Context, opts ...option.RequestOption) (res *[]BatchJob, err error)

List all batch jobs for the authenticated user

func (*BatchService) New

func (r *BatchService) New(ctx context.Context, body BatchNewParams, opts ...option.RequestOption) (res *BatchNewResponse, err error)

Create a new batch job with the given input file and endpoint

type ChatCompletion

type ChatCompletion struct {
	ID      string                 `json:"id,required"`
	Choices []ChatCompletionChoice `json:"choices,required"`
	Created int64                  `json:"created,required"`
	Model   string                 `json:"model,required"`
	// Any of "chat.completion".
	Object   ChatCompletionObject    `json:"object,required"`
	Usage    ChatCompletionUsage     `json:"usage,nullable"`
	Warnings []ChatCompletionWarning `json:"warnings"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Choices     respjson.Field
		Created     respjson.Field
		Model       respjson.Field
		Object      respjson.Field
		Usage       respjson.Field
		Warnings    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ChatCompletion) RawJSON

func (r ChatCompletion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChatCompletion) UnmarshalJSON

func (r *ChatCompletion) UnmarshalJSON(data []byte) error

type ChatCompletionChoice

type ChatCompletionChoice struct {
	// Any of "stop", "eos", "length", "tool_calls", "function_call".
	FinishReason string                      `json:"finish_reason"`
	Index        int64                       `json:"index"`
	Logprobs     LogProbs                    `json:"logprobs,nullable"`
	Message      ChatCompletionChoiceMessage `json:"message"`
	Seed         int64                       `json:"seed"`
	Text         string                      `json:"text"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FinishReason respjson.Field
		Index        respjson.Field
		Logprobs     respjson.Field
		Message      respjson.Field
		Seed         respjson.Field
		Text         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ChatCompletionChoice) RawJSON

func (r ChatCompletionChoice) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChatCompletionChoice) UnmarshalJSON

func (r *ChatCompletionChoice) UnmarshalJSON(data []byte) error

type ChatCompletionChoiceMessage

type ChatCompletionChoiceMessage struct {
	Content string `json:"content,required"`
	// Any of "assistant".
	Role string `json:"role,required"`
	// Deprecated: deprecated
	FunctionCall ChatCompletionChoiceMessageFunctionCall `json:"function_call"`
	Reasoning    string                                  `json:"reasoning,nullable"`
	ToolCalls    []ToolChoice                            `json:"tool_calls"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Content      respjson.Field
		Role         respjson.Field
		FunctionCall respjson.Field
		Reasoning    respjson.Field
		ToolCalls    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ChatCompletionChoiceMessage) RawJSON

func (r ChatCompletionChoiceMessage) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChatCompletionChoiceMessage) UnmarshalJSON

func (r *ChatCompletionChoiceMessage) UnmarshalJSON(data []byte) error

type ChatCompletionChoiceMessageFunctionCall deprecated

type ChatCompletionChoiceMessageFunctionCall struct {
	Arguments string `json:"arguments,required"`
	Name      string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arguments   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Deprecated: deprecated

func (ChatCompletionChoiceMessageFunctionCall) RawJSON

Returns the unmodified JSON received from the API

func (*ChatCompletionChoiceMessageFunctionCall) UnmarshalJSON

func (r *ChatCompletionChoiceMessageFunctionCall) UnmarshalJSON(data []byte) error

type ChatCompletionChunk

type ChatCompletionChunk struct {
	ID      string                      `json:"id,required"`
	Choices []ChatCompletionChunkChoice `json:"choices,required"`
	Created int64                       `json:"created,required"`
	Model   string                      `json:"model,required"`
	// Any of "chat.completion.chunk".
	Object            ChatCompletionChunkObject `json:"object,required"`
	SystemFingerprint string                    `json:"system_fingerprint"`
	Usage             ChatCompletionUsage       `json:"usage,nullable"`
	Warnings          []ChatCompletionWarning   `json:"warnings"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		Choices           respjson.Field
		Created           respjson.Field
		Model             respjson.Field
		Object            respjson.Field
		SystemFingerprint respjson.Field
		Usage             respjson.Field
		Warnings          respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ChatCompletionChunk) RawJSON

func (r ChatCompletionChunk) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChatCompletionChunk) UnmarshalJSON

func (r *ChatCompletionChunk) UnmarshalJSON(data []byte) error

type ChatCompletionChunkChoice

type ChatCompletionChunkChoice struct {
	Delta ChatCompletionChunkChoiceDelta `json:"delta,required"`
	// Any of "stop", "eos", "length", "tool_calls", "function_call".
	FinishReason string  `json:"finish_reason,required"`
	Index        int64   `json:"index,required"`
	Logprobs     float64 `json:"logprobs,nullable"`
	Seed         int64   `json:"seed,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Delta        respjson.Field
		FinishReason respjson.Field
		Index        respjson.Field
		Logprobs     respjson.Field
		Seed         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ChatCompletionChunkChoice) RawJSON

func (r ChatCompletionChunkChoice) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChatCompletionChunkChoice) UnmarshalJSON

func (r *ChatCompletionChunkChoice) UnmarshalJSON(data []byte) error

type ChatCompletionChunkChoiceDelta

type ChatCompletionChunkChoiceDelta struct {
	// Any of "system", "user", "assistant", "function", "tool".
	Role    string `json:"role,required"`
	Content string `json:"content,nullable"`
	// Deprecated: deprecated
	FunctionCall ChatCompletionChunkChoiceDeltaFunctionCall `json:"function_call,nullable"`
	Reasoning    string                                     `json:"reasoning,nullable"`
	TokenID      int64                                      `json:"token_id"`
	ToolCalls    []ToolChoice                               `json:"tool_calls"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Role         respjson.Field
		Content      respjson.Field
		FunctionCall respjson.Field
		Reasoning    respjson.Field
		TokenID      respjson.Field
		ToolCalls    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ChatCompletionChunkChoiceDelta) RawJSON

Returns the unmodified JSON received from the API

func (*ChatCompletionChunkChoiceDelta) UnmarshalJSON

func (r *ChatCompletionChunkChoiceDelta) UnmarshalJSON(data []byte) error

type ChatCompletionChunkChoiceDeltaFunctionCall deprecated

type ChatCompletionChunkChoiceDeltaFunctionCall struct {
	Arguments string `json:"arguments,required"`
	Name      string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arguments   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Deprecated: deprecated

func (ChatCompletionChunkChoiceDeltaFunctionCall) RawJSON

Returns the unmodified JSON received from the API

func (*ChatCompletionChunkChoiceDeltaFunctionCall) UnmarshalJSON

func (r *ChatCompletionChunkChoiceDeltaFunctionCall) UnmarshalJSON(data []byte) error

type ChatCompletionChunkObject

type ChatCompletionChunkObject string
const (
	ChatCompletionChunkObjectChatCompletionChunk ChatCompletionChunkObject = "chat.completion.chunk"
)

type ChatCompletionNewParams

type ChatCompletionNewParams struct {
	// A list of messages comprising the conversation so far.
	Messages []ChatCompletionNewParamsMessageUnion `json:"messages,omitzero,required"`
	// The name of the model to query.
	//
	// [See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#chat-models)
	Model ChatCompletionNewParamsModel `json:"model,omitzero,required"`
	// If true, the response will contain the prompt. Can be used with `logprobs` to
	// return prompt logprobs.
	Echo param.Opt[bool] `json:"echo,omitzero"`
	// A number between -2.0 and 2.0 where a positive value decreases the likelihood of
	// repeating tokens that have already been mentioned.
	FrequencyPenalty param.Opt[float64] `json:"frequency_penalty,omitzero"`
	// An integer between 0 and 20 of the top k tokens to return log probabilities for
	// at each generation step, instead of just the sampled token. Log probabilities
	// help assess model confidence in token predictions.
	Logprobs param.Opt[int64] `json:"logprobs,omitzero"`
	// The maximum number of tokens to generate.
	MaxTokens param.Opt[int64] `json:"max_tokens,omitzero"`
	// A number between 0 and 1 that can be used as an alternative to top_p and top-k.
	MinP param.Opt[float64] `json:"min_p,omitzero"`
	// The number of completions to generate for each prompt.
	N param.Opt[int64] `json:"n,omitzero"`
	// A number between -2.0 and 2.0 where a positive value increases the likelihood of
	// a model talking about new topics.
	PresencePenalty param.Opt[float64] `json:"presence_penalty,omitzero"`
	// A number that controls the diversity of generated text by reducing the
	// likelihood of repeated sequences. Higher values decrease repetition.
	RepetitionPenalty param.Opt[float64] `json:"repetition_penalty,omitzero"`
	// The name of the moderation model used to validate tokens. Choose from the
	// available moderation models found
	// [here](https://docs.together.ai/docs/inference-models#moderation-models).
	SafetyModel param.Opt[string] `json:"safety_model,omitzero"`
	// Seed value for reproducibility.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// A decimal number from 0-1 that determines the degree of randomness in the
	// response. A temperature less than 1 favors more correctness and is appropriate
	// for question answering or summarization. A value closer to 1 introduces more
	// randomness in the output.
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	// An integer that's used to limit the number of choices for the next predicted
	// word or token. It specifies the maximum number of tokens to consider at each
	// step, based on their probability of occurrence. This technique helps to speed up
	// the generation process and can improve the quality of the generated text by
	// focusing on the most likely options.
	TopK param.Opt[int64] `json:"top_k,omitzero"`
	// A percentage (also called the nucleus parameter) that's used to dynamically
	// adjust the number of choices for each predicted token based on the cumulative
	// probabilities. It specifies a probability threshold below which all less likely
	// tokens are filtered out. This technique helps maintain diversity and generate
	// more fluent and natural-sounding text.
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	// Defined the behavior of the API when max_tokens exceed the maximum context
	// length of the model. When set to 'error', API will return 400 with appropriate
	// error message. When set to 'truncate', override the max_tokens with maximum
	// context length of the model.
	//
	// Any of "truncate", "error".
	ContextLengthExceededBehavior ChatCompletionNewParamsContextLengthExceededBehavior `json:"context_length_exceeded_behavior,omitzero"`
	FunctionCall                  ChatCompletionNewParamsFunctionCallUnion             `json:"function_call,omitzero"`
	// Adjusts the likelihood of specific tokens appearing in the generated output.
	LogitBias map[string]float64 `json:"logit_bias,omitzero"`
	// Controls the level of reasoning effort the model should apply when generating
	// responses. Higher values may result in more thoughtful and detailed responses
	// but may take longer to generate.
	//
	// Any of "low", "medium", "high".
	ReasoningEffort ChatCompletionNewParamsReasoningEffort `json:"reasoning_effort,omitzero"`
	// 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. Learn more
	// in the [Structured Outputs guide](https://docs.together.ai/docs/json-mode).
	//
	// Setting to `{ "type": "json_object" }` enables the older JSON mode, which
	// ensures the message the model generates is valid JSON. Using `json_schema` is
	// preferred for models that support it.
	ResponseFormat ChatCompletionNewParamsResponseFormatUnion `json:"response_format,omitzero"`
	// A list of string sequences that will truncate (stop) inference text output. For
	// example, "</s>" will stop generation as soon as the model generates the given
	// token.
	Stop []string `json:"stop,omitzero"`
	// Controls which (if any) function is called by the model. By default uses `auto`,
	// which lets the model pick between generating a message or calling a function.
	ToolChoice ChatCompletionNewParamsToolChoiceUnion `json:"tool_choice,omitzero"`
	// A list of tools the model may call. Currently, only functions are supported as a
	// tool. Use this to provide a list of functions the model may generate JSON inputs
	// for.
	Tools []ToolsParam `json:"tools,omitzero"`
	// contains filtered or unexported fields
}

func (ChatCompletionNewParams) MarshalJSON

func (r ChatCompletionNewParams) MarshalJSON() (data []byte, err error)

func (*ChatCompletionNewParams) UnmarshalJSON

func (r *ChatCompletionNewParams) UnmarshalJSON(data []byte) error

type ChatCompletionNewParamsContextLengthExceededBehavior

type ChatCompletionNewParamsContextLengthExceededBehavior string

Defined the behavior of the API when max_tokens exceed the maximum context length of the model. When set to 'error', API will return 400 with appropriate error message. When set to 'truncate', override the max_tokens with maximum context length of the model.

const (
	ChatCompletionNewParamsContextLengthExceededBehaviorTruncate ChatCompletionNewParamsContextLengthExceededBehavior = "truncate"
	ChatCompletionNewParamsContextLengthExceededBehaviorError    ChatCompletionNewParamsContextLengthExceededBehavior = "error"
)

type ChatCompletionNewParamsFunctionCallName

type ChatCompletionNewParamsFunctionCallName struct {
	Name string `json:"name,required"`
	// contains filtered or unexported fields
}

The property Name is required.

func (ChatCompletionNewParamsFunctionCallName) MarshalJSON

func (r ChatCompletionNewParamsFunctionCallName) MarshalJSON() (data []byte, err error)

func (*ChatCompletionNewParamsFunctionCallName) UnmarshalJSON

func (r *ChatCompletionNewParamsFunctionCallName) UnmarshalJSON(data []byte) error

type ChatCompletionNewParamsFunctionCallString

type ChatCompletionNewParamsFunctionCallString string
const (
	ChatCompletionNewParamsFunctionCallStringNone ChatCompletionNewParamsFunctionCallString = "none"
	ChatCompletionNewParamsFunctionCallStringAuto ChatCompletionNewParamsFunctionCallString = "auto"
)

type ChatCompletionNewParamsFunctionCallUnion

type ChatCompletionNewParamsFunctionCallUnion struct {
	// Check if union is this variant with
	// !param.IsOmitted(union.OfChatCompletionNewsFunctionCallString)
	OfChatCompletionNewsFunctionCallString param.Opt[string]                        `json:",omitzero,inline"`
	OfChatCompletionNewsFunctionCallName   *ChatCompletionNewParamsFunctionCallName `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ChatCompletionNewParamsFunctionCallUnion) MarshalJSON

func (*ChatCompletionNewParamsFunctionCallUnion) UnmarshalJSON

func (u *ChatCompletionNewParamsFunctionCallUnion) UnmarshalJSON(data []byte) error

type ChatCompletionNewParamsMessageChatCompletionAssistantMessageParam

type ChatCompletionNewParamsMessageChatCompletionAssistantMessageParam struct {
	// Any of "assistant".
	Role    string            `json:"role,omitzero,required"`
	Content param.Opt[string] `json:"content,omitzero"`
	Name    param.Opt[string] `json:"name,omitzero"`
	// Deprecated: deprecated
	FunctionCall ChatCompletionNewParamsMessageChatCompletionAssistantMessageParamFunctionCall `json:"function_call,omitzero"`
	ToolCalls    []ToolChoiceParam                                                             `json:"tool_calls,omitzero"`
	// contains filtered or unexported fields
}

The property Role is required.

func (ChatCompletionNewParamsMessageChatCompletionAssistantMessageParam) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionAssistantMessageParam) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionAssistantMessageParamFunctionCall deprecated

type ChatCompletionNewParamsMessageChatCompletionAssistantMessageParamFunctionCall struct {
	Arguments string `json:"arguments,required"`
	Name      string `json:"name,required"`
	// contains filtered or unexported fields
}

Deprecated: deprecated

The properties Arguments, Name are required.

func (ChatCompletionNewParamsMessageChatCompletionAssistantMessageParamFunctionCall) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionAssistantMessageParamFunctionCall) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionFunctionMessageParam deprecated

type ChatCompletionNewParamsMessageChatCompletionFunctionMessageParam struct {
	Content string `json:"content,required"`
	Name    string `json:"name,required"`
	// Any of "function".
	Role string `json:"role,omitzero,required"`
	// contains filtered or unexported fields
}

Deprecated: deprecated

The properties Content, Name, Role are required.

func (ChatCompletionNewParamsMessageChatCompletionFunctionMessageParam) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionFunctionMessageParam) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionSystemMessageParam

type ChatCompletionNewParamsMessageChatCompletionSystemMessageParam struct {
	Content string `json:"content,required"`
	// Any of "system".
	Role string            `json:"role,omitzero,required"`
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

The properties Content, Role are required.

func (ChatCompletionNewParamsMessageChatCompletionSystemMessageParam) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionSystemMessageParam) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionToolMessageParam

type ChatCompletionNewParamsMessageChatCompletionToolMessageParam struct {
	Content string `json:"content,required"`
	// Any of "tool".
	Role       string            `json:"role,omitzero,required"`
	ToolCallID string            `json:"tool_call_id,required"`
	Name       param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

The properties Content, Role, ToolCallID are required.

func (ChatCompletionNewParamsMessageChatCompletionToolMessageParam) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionToolMessageParam) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionUserMessageParam

type ChatCompletionNewParamsMessageChatCompletionUserMessageParam struct {
	// The content of the message, which can either be a simple string or a structured
	// format.
	Content ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion `json:"content,omitzero,required"`
	// Any of "user".
	Role string            `json:"role,omitzero,required"`
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

The properties Content, Role are required.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParam) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionUserMessageParam) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudio

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudio struct {
	AudioURL ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudioAudioURL `json:"audio_url,omitzero,required"`
	// Any of "audio_url".
	Type string `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

The properties AudioURL, Type are required.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudio) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudio) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudioAudioURL

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudioAudioURL struct {
	// The URL of the audio
	URL string `json:"url,required"`
	// contains filtered or unexported fields
}

The property URL is required.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudioAudioURL) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudioAudioURL) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudio

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudio struct {
	InputAudio ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudioInputAudio `json:"input_audio,omitzero,required"`
	// Any of "input_audio".
	Type string `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

The properties InputAudio, Type are required.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudio) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudio) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudioInputAudio

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudioInputAudio struct {
	// The base64 encoded audio data
	Data string `json:"data,required"`
	// The format of the audio data
	//
	// Any of "wav".
	Format string `json:"format,omitzero,required"`
	// contains filtered or unexported fields
}

The properties Data, Format are required.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudioInputAudio) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudioInputAudio) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion struct {
	OfChatCompletionStructuredMessageText     *ChatCompletionStructuredMessageTextParam                                                                                    `json:",omitzero,inline"`
	OfChatCompletionStructuredMessageImageURL *ChatCompletionStructuredMessageImageURLParam                                                                                `json:",omitzero,inline"`
	OfVideo                                   *ChatCompletionStructuredMessageVideoURLParam                                                                                `json:",omitzero,inline"`
	OfAudio                                   *ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemAudio      `json:",omitzero,inline"`
	OfInputAudio                              *ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemInputAudio `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion) GetAudioURL

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion) GetImageURL

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion) GetInputAudio

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion) GetText

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion) GetType

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion) GetVideoURL

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion) UnmarshalJSON

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion

type ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion struct {
	OfString                                                                                                        param.Opt[string]                                                                                                        `json:",omitzero,inline"`
	OfChatCompletionNewsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalArray []ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalItemUnion `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion) MarshalJSON

func (*ChatCompletionNewParamsMessageChatCompletionUserMessageParamContentUnion) UnmarshalJSON

type ChatCompletionNewParamsMessageUnion

type ChatCompletionNewParamsMessageUnion struct {
	OfChatCompletionNewsMessageChatCompletionSystemMessageParam    *ChatCompletionNewParamsMessageChatCompletionSystemMessageParam    `json:",omitzero,inline"`
	OfChatCompletionNewsMessageChatCompletionUserMessageParam      *ChatCompletionNewParamsMessageChatCompletionUserMessageParam      `json:",omitzero,inline"`
	OfChatCompletionNewsMessageChatCompletionAssistantMessageParam *ChatCompletionNewParamsMessageChatCompletionAssistantMessageParam `json:",omitzero,inline"`
	OfChatCompletionNewsMessageChatCompletionToolMessageParam      *ChatCompletionNewParamsMessageChatCompletionToolMessageParam      `json:",omitzero,inline"`
	OfChatCompletionNewsMessageChatCompletionFunctionMessageParam  *ChatCompletionNewParamsMessageChatCompletionFunctionMessageParam  `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ChatCompletionNewParamsMessageUnion) GetContent

func (u ChatCompletionNewParamsMessageUnion) GetContent() (res chatCompletionNewParamsMessageUnionContent)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (ChatCompletionNewParamsMessageUnion) GetFunctionCall

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageUnion) GetName

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageUnion) GetRole

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageUnion) GetToolCallID

func (u ChatCompletionNewParamsMessageUnion) GetToolCallID() *string

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageUnion) GetToolCalls

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsMessageUnion) MarshalJSON

func (u ChatCompletionNewParamsMessageUnion) MarshalJSON() ([]byte, error)

func (*ChatCompletionNewParamsMessageUnion) UnmarshalJSON

func (u *ChatCompletionNewParamsMessageUnion) UnmarshalJSON(data []byte) error

type ChatCompletionNewParamsModel

type ChatCompletionNewParamsModel string

The name of the model to query.

[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#chat-models)

const (
	ChatCompletionNewParamsModelQwenQwen2_5_72BInstructTurbo            ChatCompletionNewParamsModel = "Qwen/Qwen2.5-72B-Instruct-Turbo"
	ChatCompletionNewParamsModelQwenQwen2_5_7BInstructTurbo             ChatCompletionNewParamsModel = "Qwen/Qwen2.5-7B-Instruct-Turbo"
	ChatCompletionNewParamsModelMetaLlamaMetaLlama3_1_405BInstructTurbo ChatCompletionNewParamsModel = "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo"
	ChatCompletionNewParamsModelMetaLlamaMetaLlama3_1_70BInstructTurbo  ChatCompletionNewParamsModel = "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo"
	ChatCompletionNewParamsModelMetaLlamaMetaLlama3_1_8BInstructTurbo   ChatCompletionNewParamsModel = "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo"
)

type ChatCompletionNewParamsReasoningEffort

type ChatCompletionNewParamsReasoningEffort string

Controls the level of reasoning effort the model should apply when generating responses. Higher values may result in more thoughtful and detailed responses but may take longer to generate.

const (
	ChatCompletionNewParamsReasoningEffortLow    ChatCompletionNewParamsReasoningEffort = "low"
	ChatCompletionNewParamsReasoningEffortMedium ChatCompletionNewParamsReasoningEffort = "medium"
	ChatCompletionNewParamsReasoningEffortHigh   ChatCompletionNewParamsReasoningEffort = "high"
)

type ChatCompletionNewParamsResponseFormatJsonObject

type ChatCompletionNewParamsResponseFormatJsonObject struct {
	// The type of response format being defined. Always `json_object`.
	Type constant.JsonObject `json:"type,required"`
	// contains filtered or unexported fields
}

JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

This struct has a constant value, construct it with NewChatCompletionNewParamsResponseFormatJsonObject.

func NewChatCompletionNewParamsResponseFormatJsonObject

func NewChatCompletionNewParamsResponseFormatJsonObject() ChatCompletionNewParamsResponseFormatJsonObject

func (ChatCompletionNewParamsResponseFormatJsonObject) MarshalJSON

func (r ChatCompletionNewParamsResponseFormatJsonObject) MarshalJSON() (data []byte, err error)

func (*ChatCompletionNewParamsResponseFormatJsonObject) UnmarshalJSON

type ChatCompletionNewParamsResponseFormatJsonSchema

type ChatCompletionNewParamsResponseFormatJsonSchema struct {
	// Structured Outputs configuration options, including a JSON Schema.
	JsonSchema ChatCompletionNewParamsResponseFormatJsonSchemaJsonSchema `json:"json_schema,omitzero,required"`
	// The type of response format being defined. Always `json_schema`.
	//
	// This field can be elided, and will marshal its zero value as "json_schema".
	Type constant.JsonSchema `json:"type,required"`
	// contains filtered or unexported fields
}

JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://docs.together.ai/docs/json-mode).

The properties JsonSchema, Type are required.

func (ChatCompletionNewParamsResponseFormatJsonSchema) MarshalJSON

func (r ChatCompletionNewParamsResponseFormatJsonSchema) MarshalJSON() (data []byte, err error)

func (*ChatCompletionNewParamsResponseFormatJsonSchema) UnmarshalJSON

type ChatCompletionNewParamsResponseFormatJsonSchemaJsonSchema

type ChatCompletionNewParamsResponseFormatJsonSchemaJsonSchema struct {
	// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
	// and dashes, with a maximum length of 64.
	Name string `json:"name,required"`
	// Whether to enable strict schema adherence when generating the output. If set to
	// true, the model will always follow the exact schema defined in the `schema`
	// field. Only a subset of JSON Schema is supported when `strict` is `true`. To
	// learn more, read the
	// [Structured Outputs guide](https://docs.together.ai/docs/json-mode).
	Strict param.Opt[bool] `json:"strict,omitzero"`
	// A description of what the response format is for, used by the model to determine
	// how to respond in the format.
	Description param.Opt[string] `json:"description,omitzero"`
	// The schema for the response format, described as a JSON Schema object. Learn how
	// to build JSON schemas [here](https://json-schema.org/).
	Schema map[string]any `json:"schema,omitzero"`
	// contains filtered or unexported fields
}

Structured Outputs configuration options, including a JSON Schema.

The property Name is required.

func (ChatCompletionNewParamsResponseFormatJsonSchemaJsonSchema) MarshalJSON

func (*ChatCompletionNewParamsResponseFormatJsonSchemaJsonSchema) UnmarshalJSON

type ChatCompletionNewParamsResponseFormatText

type ChatCompletionNewParamsResponseFormatText struct {
	// The type of response format being defined. Always `text`.
	Type constant.Text `json:"type,required"`
	// contains filtered or unexported fields
}

Default response format. Used to generate text responses.

This struct has a constant value, construct it with NewChatCompletionNewParamsResponseFormatText.

func NewChatCompletionNewParamsResponseFormatText

func NewChatCompletionNewParamsResponseFormatText() ChatCompletionNewParamsResponseFormatText

func (ChatCompletionNewParamsResponseFormatText) MarshalJSON

func (r ChatCompletionNewParamsResponseFormatText) MarshalJSON() (data []byte, err error)

func (*ChatCompletionNewParamsResponseFormatText) UnmarshalJSON

func (r *ChatCompletionNewParamsResponseFormatText) UnmarshalJSON(data []byte) error

type ChatCompletionNewParamsResponseFormatUnion

type ChatCompletionNewParamsResponseFormatUnion struct {
	OfText       *ChatCompletionNewParamsResponseFormatText       `json:",omitzero,inline"`
	OfJsonSchema *ChatCompletionNewParamsResponseFormatJsonSchema `json:",omitzero,inline"`
	OfJsonObject *ChatCompletionNewParamsResponseFormatJsonObject `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ChatCompletionNewParamsResponseFormatUnion) GetJsonSchema

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsResponseFormatUnion) GetType

Returns a pointer to the underlying variant's property, if present.

func (ChatCompletionNewParamsResponseFormatUnion) MarshalJSON

func (*ChatCompletionNewParamsResponseFormatUnion) UnmarshalJSON

func (u *ChatCompletionNewParamsResponseFormatUnion) UnmarshalJSON(data []byte) error

type ChatCompletionNewParamsToolChoiceUnion

type ChatCompletionNewParamsToolChoiceUnion struct {
	OfString     param.Opt[string] `json:",omitzero,inline"`
	OfToolChoice *ToolChoiceParam  `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ChatCompletionNewParamsToolChoiceUnion) MarshalJSON

func (u ChatCompletionNewParamsToolChoiceUnion) MarshalJSON() ([]byte, error)

func (*ChatCompletionNewParamsToolChoiceUnion) UnmarshalJSON

func (u *ChatCompletionNewParamsToolChoiceUnion) UnmarshalJSON(data []byte) error

type ChatCompletionObject

type ChatCompletionObject string
const (
	ChatCompletionObjectChatCompletion ChatCompletionObject = "chat.completion"
)

type ChatCompletionService

type ChatCompletionService struct {
	Options []option.RequestOption
}

ChatCompletionService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatCompletionService method instead.

func NewChatCompletionService

func NewChatCompletionService(opts ...option.RequestOption) (r ChatCompletionService)

NewChatCompletionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ChatCompletionService) New

Query a chat model.

func (*ChatCompletionService) NewStreaming

Query a chat model.

type ChatCompletionStructuredMessageImageURLImageURLParam

type ChatCompletionStructuredMessageImageURLImageURLParam struct {
	// The URL of the image
	URL string `json:"url,required"`
	// contains filtered or unexported fields
}

The property URL is required.

func (ChatCompletionStructuredMessageImageURLImageURLParam) MarshalJSON

func (r ChatCompletionStructuredMessageImageURLImageURLParam) MarshalJSON() (data []byte, err error)

func (*ChatCompletionStructuredMessageImageURLImageURLParam) UnmarshalJSON

type ChatCompletionStructuredMessageImageURLParam

type ChatCompletionStructuredMessageImageURLParam struct {
	ImageURL ChatCompletionStructuredMessageImageURLImageURLParam `json:"image_url,omitzero"`
	// Any of "image_url".
	Type ChatCompletionStructuredMessageImageURLType `json:"type,omitzero"`
	// contains filtered or unexported fields
}

func (ChatCompletionStructuredMessageImageURLParam) MarshalJSON

func (r ChatCompletionStructuredMessageImageURLParam) MarshalJSON() (data []byte, err error)

func (*ChatCompletionStructuredMessageImageURLParam) UnmarshalJSON

func (r *ChatCompletionStructuredMessageImageURLParam) UnmarshalJSON(data []byte) error

type ChatCompletionStructuredMessageImageURLType

type ChatCompletionStructuredMessageImageURLType string
const (
	ChatCompletionStructuredMessageImageURLTypeImageURL ChatCompletionStructuredMessageImageURLType = "image_url"
)

type ChatCompletionStructuredMessageTextParam

type ChatCompletionStructuredMessageTextParam struct {
	Text string `json:"text,required"`
	// Any of "text".
	Type ChatCompletionStructuredMessageTextType `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

The properties Text, Type are required.

func (ChatCompletionStructuredMessageTextParam) MarshalJSON

func (r ChatCompletionStructuredMessageTextParam) MarshalJSON() (data []byte, err error)

func (*ChatCompletionStructuredMessageTextParam) UnmarshalJSON

func (r *ChatCompletionStructuredMessageTextParam) UnmarshalJSON(data []byte) error

type ChatCompletionStructuredMessageTextType

type ChatCompletionStructuredMessageTextType string
const (
	ChatCompletionStructuredMessageTextTypeText ChatCompletionStructuredMessageTextType = "text"
)

type ChatCompletionStructuredMessageVideoURLParam

type ChatCompletionStructuredMessageVideoURLParam struct {
	// Any of "video_url".
	Type     ChatCompletionStructuredMessageVideoURLType          `json:"type,omitzero,required"`
	VideoURL ChatCompletionStructuredMessageVideoURLVideoURLParam `json:"video_url,omitzero,required"`
	// contains filtered or unexported fields
}

The properties Type, VideoURL are required.

func (ChatCompletionStructuredMessageVideoURLParam) MarshalJSON

func (r ChatCompletionStructuredMessageVideoURLParam) MarshalJSON() (data []byte, err error)

func (*ChatCompletionStructuredMessageVideoURLParam) UnmarshalJSON

func (r *ChatCompletionStructuredMessageVideoURLParam) UnmarshalJSON(data []byte) error

type ChatCompletionStructuredMessageVideoURLType

type ChatCompletionStructuredMessageVideoURLType string
const (
	ChatCompletionStructuredMessageVideoURLTypeVideoURL ChatCompletionStructuredMessageVideoURLType = "video_url"
)

type ChatCompletionStructuredMessageVideoURLVideoURLParam

type ChatCompletionStructuredMessageVideoURLVideoURLParam struct {
	// The URL of the video
	URL string `json:"url,required"`
	// contains filtered or unexported fields
}

The property URL is required.

func (ChatCompletionStructuredMessageVideoURLVideoURLParam) MarshalJSON

func (r ChatCompletionStructuredMessageVideoURLVideoURLParam) MarshalJSON() (data []byte, err error)

func (*ChatCompletionStructuredMessageVideoURLVideoURLParam) UnmarshalJSON

type ChatCompletionUsage

type ChatCompletionUsage struct {
	CompletionTokens int64 `json:"completion_tokens,required"`
	PromptTokens     int64 `json:"prompt_tokens,required"`
	TotalTokens      int64 `json:"total_tokens,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CompletionTokens respjson.Field
		PromptTokens     respjson.Field
		TotalTokens      respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ChatCompletionUsage) RawJSON

func (r ChatCompletionUsage) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChatCompletionUsage) UnmarshalJSON

func (r *ChatCompletionUsage) UnmarshalJSON(data []byte) error

type ChatCompletionWarning

type ChatCompletionWarning struct {
	Message string `json:"message,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ChatCompletionWarning) RawJSON

func (r ChatCompletionWarning) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChatCompletionWarning) UnmarshalJSON

func (r *ChatCompletionWarning) UnmarshalJSON(data []byte) error

type ChatService

type ChatService struct {
	Options     []option.RequestOption
	Completions ChatCompletionService
}

ChatService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChatService method instead.

func NewChatService

func NewChatService(opts ...option.RequestOption) (r ChatService)

NewChatService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type Client

type Client struct {
	Options         []option.RequestOption
	Chat            ChatService
	Completions     CompletionService
	Embeddings      EmbeddingService
	Files           FileService
	FineTuning      FineTuningService
	CodeInterpreter CodeInterpreterService
	Images          ImageService
	Videos          VideoService
	Audio           AudioService
	Models          ModelService
	Jobs            JobService
	Endpoints       EndpointService
	Hardware        HardwareService
	Rerank          RerankService
	Batches         BatchService
	Evals           EvalService
}

Client creates a struct with services and top level methods that help with interacting with the together API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (TOGETHER_API_KEY, TOGETHER_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CodeInterpreterExecuteParams

type CodeInterpreterExecuteParams struct {
	// Code snippet to execute.
	Code string `json:"code,required"`
	// Programming language for the code to execute. Currently only supports Python,
	// but more will be added.
	//
	// Any of "python".
	Language CodeInterpreterExecuteParamsLanguage `json:"language,omitzero,required"`
	// Identifier of the current session. Used to make follow-up calls. Requests will
	// return an error if the session does not belong to the caller or has expired.
	SessionID param.Opt[string] `json:"session_id,omitzero"`
	// Files to upload to the session. If present, files will be uploaded before
	// executing the given code.
	Files []CodeInterpreterExecuteParamsFile `json:"files,omitzero"`
	// contains filtered or unexported fields
}

func (CodeInterpreterExecuteParams) MarshalJSON

func (r CodeInterpreterExecuteParams) MarshalJSON() (data []byte, err error)

func (*CodeInterpreterExecuteParams) UnmarshalJSON

func (r *CodeInterpreterExecuteParams) UnmarshalJSON(data []byte) error

type CodeInterpreterExecuteParamsFile

type CodeInterpreterExecuteParamsFile struct {
	Content string `json:"content,required"`
	// Encoding of the file content. Use `string` for text files such as code, and
	// `base64` for binary files, such as images.
	//
	// Any of "string", "base64".
	Encoding string `json:"encoding,omitzero,required"`
	Name     string `json:"name,required"`
	// contains filtered or unexported fields
}

The properties Content, Encoding, Name are required.

func (CodeInterpreterExecuteParamsFile) MarshalJSON

func (r CodeInterpreterExecuteParamsFile) MarshalJSON() (data []byte, err error)

func (*CodeInterpreterExecuteParamsFile) UnmarshalJSON

func (r *CodeInterpreterExecuteParamsFile) UnmarshalJSON(data []byte) error

type CodeInterpreterExecuteParamsLanguage

type CodeInterpreterExecuteParamsLanguage string

Programming language for the code to execute. Currently only supports Python, but more will be added.

const (
	CodeInterpreterExecuteParamsLanguagePython CodeInterpreterExecuteParamsLanguage = "python"
)

type CodeInterpreterService

type CodeInterpreterService struct {
	Options  []option.RequestOption
	Sessions CodeInterpreterSessionService
}

CodeInterpreterService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCodeInterpreterService method instead.

func NewCodeInterpreterService

func NewCodeInterpreterService(opts ...option.RequestOption) (r CodeInterpreterService)

NewCodeInterpreterService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CodeInterpreterService) Execute

Executes the given code snippet and returns the output. Without a session_id, a new session will be created to run the code. If you do pass in a valid session_id, the code will be run in that session. This is useful for running multiple code snippets in the same environment, because dependencies and similar things are persisted between calls to the same session.

type CodeInterpreterSessionService

type CodeInterpreterSessionService struct {
	Options []option.RequestOption
}

CodeInterpreterSessionService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCodeInterpreterSessionService method instead.

func NewCodeInterpreterSessionService

func NewCodeInterpreterSessionService(opts ...option.RequestOption) (r CodeInterpreterSessionService)

NewCodeInterpreterSessionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CodeInterpreterSessionService) List

Lists all your currently active sessions.

type Completion

type Completion struct {
	ID      string             `json:"id,required"`
	Choices []CompletionChoice `json:"choices,required"`
	Created int64              `json:"created,required"`
	Model   string             `json:"model,required"`
	// Any of "text.completion".
	Object CompletionObject    `json:"object,required"`
	Usage  ChatCompletionUsage `json:"usage,required"`
	Prompt []CompletionPrompt  `json:"prompt"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Choices     respjson.Field
		Created     respjson.Field
		Model       respjson.Field
		Object      respjson.Field
		Usage       respjson.Field
		Prompt      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Completion) RawJSON

func (r Completion) RawJSON() string

Returns the unmodified JSON received from the API

func (*Completion) UnmarshalJSON

func (r *Completion) UnmarshalJSON(data []byte) error

type CompletionChoice

type CompletionChoice struct {
	// Any of "stop", "eos", "length", "tool_calls", "function_call".
	FinishReason string   `json:"finish_reason"`
	Logprobs     LogProbs `json:"logprobs"`
	Seed         int64    `json:"seed"`
	Text         string   `json:"text"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FinishReason respjson.Field
		Logprobs     respjson.Field
		Seed         respjson.Field
		Text         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompletionChoice) RawJSON

func (r CompletionChoice) RawJSON() string

Returns the unmodified JSON received from the API

func (*CompletionChoice) UnmarshalJSON

func (r *CompletionChoice) UnmarshalJSON(data []byte) error

type CompletionChunk

type CompletionChunk struct {
	ID      string                  `json:"id,required"`
	Token   CompletionChunkToken    `json:"token,required"`
	Choices []CompletionChunkChoice `json:"choices,required"`
	// Any of "stop", "eos", "length", "tool_calls", "function_call".
	FinishReason CompletionChunkFinishReason `json:"finish_reason,required"`
	Usage        ChatCompletionUsage         `json:"usage,required"`
	Created      int64                       `json:"created"`
	// Any of "completion.chunk".
	Object CompletionChunkObject `json:"object"`
	Seed   int64                 `json:"seed"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Token        respjson.Field
		Choices      respjson.Field
		FinishReason respjson.Field
		Usage        respjson.Field
		Created      respjson.Field
		Object       respjson.Field
		Seed         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompletionChunk) RawJSON

func (r CompletionChunk) RawJSON() string

Returns the unmodified JSON received from the API

func (*CompletionChunk) UnmarshalJSON

func (r *CompletionChunk) UnmarshalJSON(data []byte) error

type CompletionChunkChoice

type CompletionChunkChoice struct {
	Index int64                      `json:"index,required"`
	Delta CompletionChunkChoiceDelta `json:"delta"`
	Text  string                     `json:"text"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Index       respjson.Field
		Delta       respjson.Field
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompletionChunkChoice) RawJSON

func (r CompletionChunkChoice) RawJSON() string

Returns the unmodified JSON received from the API

func (*CompletionChunkChoice) UnmarshalJSON

func (r *CompletionChunkChoice) UnmarshalJSON(data []byte) error

type CompletionChunkChoiceDelta

type CompletionChunkChoiceDelta struct {
	// Any of "system", "user", "assistant", "function", "tool".
	Role    string `json:"role,required"`
	Content string `json:"content,nullable"`
	// Deprecated: deprecated
	FunctionCall CompletionChunkChoiceDeltaFunctionCall `json:"function_call,nullable"`
	Reasoning    string                                 `json:"reasoning,nullable"`
	TokenID      int64                                  `json:"token_id"`
	ToolCalls    []ToolChoice                           `json:"tool_calls"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Role         respjson.Field
		Content      respjson.Field
		FunctionCall respjson.Field
		Reasoning    respjson.Field
		TokenID      respjson.Field
		ToolCalls    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompletionChunkChoiceDelta) RawJSON

func (r CompletionChunkChoiceDelta) RawJSON() string

Returns the unmodified JSON received from the API

func (*CompletionChunkChoiceDelta) UnmarshalJSON

func (r *CompletionChunkChoiceDelta) UnmarshalJSON(data []byte) error

type CompletionChunkChoiceDeltaFunctionCall deprecated

type CompletionChunkChoiceDeltaFunctionCall struct {
	Arguments string `json:"arguments,required"`
	Name      string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arguments   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Deprecated: deprecated

func (CompletionChunkChoiceDeltaFunctionCall) RawJSON

Returns the unmodified JSON received from the API

func (*CompletionChunkChoiceDeltaFunctionCall) UnmarshalJSON

func (r *CompletionChunkChoiceDeltaFunctionCall) UnmarshalJSON(data []byte) error

type CompletionChunkFinishReason

type CompletionChunkFinishReason string
const (
	CompletionChunkFinishReasonStop         CompletionChunkFinishReason = "stop"
	CompletionChunkFinishReasonEos          CompletionChunkFinishReason = "eos"
	CompletionChunkFinishReasonLength       CompletionChunkFinishReason = "length"
	CompletionChunkFinishReasonToolCalls    CompletionChunkFinishReason = "tool_calls"
	CompletionChunkFinishReasonFunctionCall CompletionChunkFinishReason = "function_call"
)

type CompletionChunkObject

type CompletionChunkObject string
const (
	CompletionChunkObjectCompletionChunk CompletionChunkObject = "completion.chunk"
)

type CompletionChunkToken

type CompletionChunkToken struct {
	ID      int64   `json:"id,required"`
	Logprob float64 `json:"logprob,required"`
	Special bool    `json:"special,required"`
	Text    string  `json:"text,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Logprob     respjson.Field
		Special     respjson.Field
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompletionChunkToken) RawJSON

func (r CompletionChunkToken) RawJSON() string

Returns the unmodified JSON received from the API

func (*CompletionChunkToken) UnmarshalJSON

func (r *CompletionChunkToken) UnmarshalJSON(data []byte) error

type CompletionNewParams

type CompletionNewParams struct {
	// The name of the model to query.
	//
	// [See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#chat-models)
	Model CompletionNewParamsModel `json:"model,omitzero,required"`
	// A string providing context for the model to complete.
	Prompt string `json:"prompt,required"`
	// If true, the response will contain the prompt. Can be used with `logprobs` to
	// return prompt logprobs.
	Echo param.Opt[bool] `json:"echo,omitzero"`
	// A number between -2.0 and 2.0 where a positive value decreases the likelihood of
	// repeating tokens that have already been mentioned.
	FrequencyPenalty param.Opt[float64] `json:"frequency_penalty,omitzero"`
	// An integer between 0 and 20 of the top k tokens to return log probabilities for
	// at each generation step, instead of just the sampled token. Log probabilities
	// help assess model confidence in token predictions.
	Logprobs param.Opt[int64] `json:"logprobs,omitzero"`
	// The maximum number of tokens to generate.
	MaxTokens param.Opt[int64] `json:"max_tokens,omitzero"`
	// A number between 0 and 1 that can be used as an alternative to top-p and top-k.
	MinP param.Opt[float64] `json:"min_p,omitzero"`
	// The number of completions to generate for each prompt.
	N param.Opt[int64] `json:"n,omitzero"`
	// A number between -2.0 and 2.0 where a positive value increases the likelihood of
	// a model talking about new topics.
	PresencePenalty param.Opt[float64] `json:"presence_penalty,omitzero"`
	// A number that controls the diversity of generated text by reducing the
	// likelihood of repeated sequences. Higher values decrease repetition.
	RepetitionPenalty param.Opt[float64] `json:"repetition_penalty,omitzero"`
	// Seed value for reproducibility.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// A decimal number from 0-1 that determines the degree of randomness in the
	// response. A temperature less than 1 favors more correctness and is appropriate
	// for question answering or summarization. A value closer to 1 introduces more
	// randomness in the output.
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	// An integer that's used to limit the number of choices for the next predicted
	// word or token. It specifies the maximum number of tokens to consider at each
	// step, based on their probability of occurrence. This technique helps to speed up
	// the generation process and can improve the quality of the generated text by
	// focusing on the most likely options.
	TopK param.Opt[int64] `json:"top_k,omitzero"`
	// A percentage (also called the nucleus parameter) that's used to dynamically
	// adjust the number of choices for each predicted token based on the cumulative
	// probabilities. It specifies a probability threshold below which all less likely
	// tokens are filtered out. This technique helps maintain diversity and generate
	// more fluent and natural-sounding text.
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	// Adjusts the likelihood of specific tokens appearing in the generated output.
	LogitBias map[string]float64 `json:"logit_bias,omitzero"`
	// The name of the moderation model used to validate tokens. Choose from the
	// available moderation models found
	// [here](https://docs.together.ai/docs/inference-models#moderation-models).
	SafetyModel CompletionNewParamsSafetyModel `json:"safety_model,omitzero"`
	// A list of string sequences that will truncate (stop) inference text output. For
	// example, "</s>" will stop generation as soon as the model generates the given
	// token.
	Stop []string `json:"stop,omitzero"`
	// contains filtered or unexported fields
}

func (CompletionNewParams) MarshalJSON

func (r CompletionNewParams) MarshalJSON() (data []byte, err error)

func (*CompletionNewParams) UnmarshalJSON

func (r *CompletionNewParams) UnmarshalJSON(data []byte) error

type CompletionNewParamsModel

type CompletionNewParamsModel string

The name of the model to query.

[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#chat-models)

const (
	CompletionNewParamsModelMetaLlamaLlama2_70bHf    CompletionNewParamsModel = "meta-llama/Llama-2-70b-hf"
	CompletionNewParamsModelMistralaiMistral7BV0_1   CompletionNewParamsModel = "mistralai/Mistral-7B-v0.1"
	CompletionNewParamsModelMistralaiMixtral8x7BV0_1 CompletionNewParamsModel = "mistralai/Mixtral-8x7B-v0.1"
	CompletionNewParamsModelMetaLlamaLlamaGuard7b    CompletionNewParamsModel = "Meta-Llama/Llama-Guard-7b"
)

type CompletionNewParamsSafetyModel

type CompletionNewParamsSafetyModel string

The name of the moderation model used to validate tokens. Choose from the available moderation models found [here](https://docs.together.ai/docs/inference-models#moderation-models).

const (
	CompletionNewParamsSafetyModelMetaLlamaLlamaGuard7b CompletionNewParamsSafetyModel = "Meta-Llama/Llama-Guard-7b"
)

type CompletionObject

type CompletionObject string
const (
	CompletionObjectTextCompletion CompletionObject = "text.completion"
)

type CompletionPrompt

type CompletionPrompt struct {
	Logprobs LogProbs `json:"logprobs"`
	Text     string   `json:"text"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Logprobs    respjson.Field
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompletionPrompt) RawJSON

func (r CompletionPrompt) RawJSON() string

Returns the unmodified JSON received from the API

func (*CompletionPrompt) UnmarshalJSON

func (r *CompletionPrompt) UnmarshalJSON(data []byte) error

type CompletionService

type CompletionService struct {
	Options []option.RequestOption
}

CompletionService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCompletionService method instead.

func NewCompletionService

func NewCompletionService(opts ...option.RequestOption) (r CompletionService)

NewCompletionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CompletionService) New

Query a language, code, or image model.

func (*CompletionService) NewStreaming

Query a language, code, or image model.

type DedicatedEndpoint

type DedicatedEndpoint struct {
	// Unique identifier for the endpoint
	ID string `json:"id,required"`
	// Configuration for automatic scaling of the endpoint
	Autoscaling Autoscaling `json:"autoscaling,required"`
	// Timestamp when the endpoint was created
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Human-readable name for the endpoint
	DisplayName string `json:"display_name,required"`
	// The hardware configuration used for this endpoint
	Hardware string `json:"hardware,required"`
	// The model deployed on this endpoint
	Model string `json:"model,required"`
	// System name for the endpoint
	Name string `json:"name,required"`
	// The type of object
	//
	// Any of "endpoint".
	Object DedicatedEndpointObject `json:"object,required"`
	// The owner of this endpoint
	Owner string `json:"owner,required"`
	// Current state of the endpoint
	//
	// Any of "PENDING", "STARTING", "STARTED", "STOPPING", "STOPPED", "ERROR".
	State DedicatedEndpointState `json:"state,required"`
	// The type of endpoint
	//
	// Any of "dedicated".
	Type DedicatedEndpointType `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Autoscaling respjson.Field
		CreatedAt   respjson.Field
		DisplayName respjson.Field
		Hardware    respjson.Field
		Model       respjson.Field
		Name        respjson.Field
		Object      respjson.Field
		Owner       respjson.Field
		State       respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details about a dedicated endpoint deployment

func (DedicatedEndpoint) RawJSON

func (r DedicatedEndpoint) RawJSON() string

Returns the unmodified JSON received from the API

func (*DedicatedEndpoint) UnmarshalJSON

func (r *DedicatedEndpoint) UnmarshalJSON(data []byte) error

type DedicatedEndpointObject

type DedicatedEndpointObject string

The type of object

const (
	DedicatedEndpointObjectEndpoint DedicatedEndpointObject = "endpoint"
)

type DedicatedEndpointState

type DedicatedEndpointState string

Current state of the endpoint

const (
	DedicatedEndpointStatePending  DedicatedEndpointState = "PENDING"
	DedicatedEndpointStateStarting DedicatedEndpointState = "STARTING"
	DedicatedEndpointStateStarted  DedicatedEndpointState = "STARTED"
	DedicatedEndpointStateStopping DedicatedEndpointState = "STOPPING"
	DedicatedEndpointStateStopped  DedicatedEndpointState = "STOPPED"
	DedicatedEndpointStateError    DedicatedEndpointState = "ERROR"
)

type DedicatedEndpointType

type DedicatedEndpointType string

The type of endpoint

const (
	DedicatedEndpointTypeDedicated DedicatedEndpointType = "dedicated"
)

type Embedding

type Embedding struct {
	Data  []EmbeddingData `json:"data,required"`
	Model string          `json:"model,required"`
	// Any of "list".
	Object EmbeddingObject `json:"object,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Model       respjson.Field
		Object      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Embedding) RawJSON

func (r Embedding) RawJSON() string

Returns the unmodified JSON received from the API

func (*Embedding) UnmarshalJSON

func (r *Embedding) UnmarshalJSON(data []byte) error

type EmbeddingData

type EmbeddingData struct {
	Embedding []float64 `json:"embedding,required"`
	Index     int64     `json:"index,required"`
	// Any of "embedding".
	Object string `json:"object,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Embedding   respjson.Field
		Index       respjson.Field
		Object      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EmbeddingData) RawJSON

func (r EmbeddingData) RawJSON() string

Returns the unmodified JSON received from the API

func (*EmbeddingData) UnmarshalJSON

func (r *EmbeddingData) UnmarshalJSON(data []byte) error

type EmbeddingNewParams

type EmbeddingNewParams struct {
	// A string providing the text for the model to embed.
	Input EmbeddingNewParamsInputUnion `json:"input,omitzero,required"`
	// The name of the embedding model to use.
	//
	// [See all of Together AI's embedding models](https://docs.together.ai/docs/serverless-models#embedding-models)
	Model EmbeddingNewParamsModel `json:"model,omitzero,required"`
	// contains filtered or unexported fields
}

func (EmbeddingNewParams) MarshalJSON

func (r EmbeddingNewParams) MarshalJSON() (data []byte, err error)

func (*EmbeddingNewParams) UnmarshalJSON

func (r *EmbeddingNewParams) UnmarshalJSON(data []byte) error

type EmbeddingNewParamsInputUnion

type EmbeddingNewParamsInputUnion struct {
	OfString      param.Opt[string] `json:",omitzero,inline"`
	OfStringArray []string          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (EmbeddingNewParamsInputUnion) MarshalJSON

func (u EmbeddingNewParamsInputUnion) MarshalJSON() ([]byte, error)

func (*EmbeddingNewParamsInputUnion) UnmarshalJSON

func (u *EmbeddingNewParamsInputUnion) UnmarshalJSON(data []byte) error

type EmbeddingNewParamsModel

type EmbeddingNewParamsModel string

The name of the embedding model to use.

[See all of Together AI's embedding models](https://docs.together.ai/docs/serverless-models#embedding-models)

const (
	EmbeddingNewParamsModelWhereIsAIUaeLargeV1                  EmbeddingNewParamsModel = "WhereIsAI/UAE-Large-V1"
	EmbeddingNewParamsModelBaaiBgeLargeEnV1_5                   EmbeddingNewParamsModel = "BAAI/bge-large-en-v1.5"
	EmbeddingNewParamsModelBaaiBgeBaseEnV1_5                    EmbeddingNewParamsModel = "BAAI/bge-base-en-v1.5"
	EmbeddingNewParamsModelTogethercomputerM2Bert80M8kRetrieval EmbeddingNewParamsModel = "togethercomputer/m2-bert-80M-8k-retrieval"
)

type EmbeddingObject

type EmbeddingObject string
const (
	EmbeddingObjectList EmbeddingObject = "list"
)

type EmbeddingService

type EmbeddingService struct {
	Options []option.RequestOption
}

EmbeddingService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEmbeddingService method instead.

func NewEmbeddingService

func NewEmbeddingService(opts ...option.RequestOption) (r EmbeddingService)

NewEmbeddingService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EmbeddingService) New

func (r *EmbeddingService) New(ctx context.Context, body EmbeddingNewParams, opts ...option.RequestOption) (res *Embedding, err error)

Query an embedding model for a given string of text.

type EndpointListAvzonesResponse

type EndpointListAvzonesResponse struct {
	Avzones []string `json:"avzones,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Avzones     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

List of unique availability zones

func (EndpointListAvzonesResponse) RawJSON

func (r EndpointListAvzonesResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EndpointListAvzonesResponse) UnmarshalJSON

func (r *EndpointListAvzonesResponse) UnmarshalJSON(data []byte) error

type EndpointListParams

type EndpointListParams struct {
	// If true, return only endpoints owned by the caller
	Mine param.Opt[bool] `query:"mine,omitzero" json:"-"`
	// Filter endpoints by type
	//
	// Any of "dedicated", "serverless".
	Type EndpointListParamsType `query:"type,omitzero" json:"-"`
	// Filter endpoints by usage type
	//
	// Any of "on-demand", "reserved".
	UsageType EndpointListParamsUsageType `query:"usage_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EndpointListParams) URLQuery

func (r EndpointListParams) URLQuery() (v url.Values, err error)

URLQuery serializes EndpointListParams's query parameters as `url.Values`.

type EndpointListParamsType

type EndpointListParamsType string

Filter endpoints by type

const (
	EndpointListParamsTypeDedicated  EndpointListParamsType = "dedicated"
	EndpointListParamsTypeServerless EndpointListParamsType = "serverless"
)

type EndpointListParamsUsageType

type EndpointListParamsUsageType string

Filter endpoints by usage type

const (
	EndpointListParamsUsageTypeOnDemand EndpointListParamsUsageType = "on-demand"
	EndpointListParamsUsageTypeReserved EndpointListParamsUsageType = "reserved"
)

type EndpointListResponse

type EndpointListResponse struct {
	Data []EndpointListResponseData `json:"data,required"`
	// Any of "list".
	Object EndpointListResponseObject `json:"object,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Object      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EndpointListResponse) RawJSON

func (r EndpointListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EndpointListResponse) UnmarshalJSON

func (r *EndpointListResponse) UnmarshalJSON(data []byte) error

type EndpointListResponseData

type EndpointListResponseData struct {
	// Unique identifier for the endpoint
	ID string `json:"id,required"`
	// Timestamp when the endpoint was created
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The model deployed on this endpoint
	Model string `json:"model,required"`
	// System name for the endpoint
	Name string `json:"name,required"`
	// The type of object
	//
	// Any of "endpoint".
	Object string `json:"object,required"`
	// The owner of this endpoint
	Owner string `json:"owner,required"`
	// Current state of the endpoint
	//
	// Any of "PENDING", "STARTING", "STARTED", "STOPPING", "STOPPED", "ERROR".
	State string `json:"state,required"`
	// The type of endpoint
	//
	// Any of "serverless", "dedicated".
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Model       respjson.Field
		Name        respjson.Field
		Object      respjson.Field
		Owner       respjson.Field
		State       respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details about an endpoint when listed via the list endpoint

func (EndpointListResponseData) RawJSON

func (r EndpointListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*EndpointListResponseData) UnmarshalJSON

func (r *EndpointListResponseData) UnmarshalJSON(data []byte) error

type EndpointListResponseObject

type EndpointListResponseObject string
const (
	EndpointListResponseObjectList EndpointListResponseObject = "list"
)

type EndpointNewParams

type EndpointNewParams struct {
	// Configuration for automatic scaling of the endpoint
	Autoscaling AutoscalingParam `json:"autoscaling,omitzero,required"`
	// The hardware configuration to use for this endpoint
	Hardware string `json:"hardware,required"`
	// The model to deploy on this endpoint
	Model string `json:"model,required"`
	// The number of minutes of inactivity after which the endpoint will be
	// automatically stopped. Set to null, omit or set to 0 to disable automatic
	// timeout.
	InactiveTimeout param.Opt[int64] `json:"inactive_timeout,omitzero"`
	// Create the endpoint in a specified availability zone (e.g., us-central-4b)
	AvailabilityZone param.Opt[string] `json:"availability_zone,omitzero"`
	// Whether to disable the prompt cache for this endpoint
	DisablePromptCache param.Opt[bool] `json:"disable_prompt_cache,omitzero"`
	// Whether to disable speculative decoding for this endpoint
	DisableSpeculativeDecoding param.Opt[bool] `json:"disable_speculative_decoding,omitzero"`
	// A human-readable name for the endpoint
	DisplayName param.Opt[string] `json:"display_name,omitzero"`
	// The desired state of the endpoint
	//
	// Any of "STARTED", "STOPPED".
	State EndpointNewParamsState `json:"state,omitzero"`
	// contains filtered or unexported fields
}

func (EndpointNewParams) MarshalJSON

func (r EndpointNewParams) MarshalJSON() (data []byte, err error)

func (*EndpointNewParams) UnmarshalJSON

func (r *EndpointNewParams) UnmarshalJSON(data []byte) error

type EndpointNewParamsState

type EndpointNewParamsState string

The desired state of the endpoint

const (
	EndpointNewParamsStateStarted EndpointNewParamsState = "STARTED"
	EndpointNewParamsStateStopped EndpointNewParamsState = "STOPPED"
)

type EndpointService

type EndpointService struct {
	Options []option.RequestOption
}

EndpointService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEndpointService method instead.

func NewEndpointService

func NewEndpointService(opts ...option.RequestOption) (r EndpointService)

NewEndpointService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EndpointService) Delete

func (r *EndpointService) Delete(ctx context.Context, endpointID string, opts ...option.RequestOption) (err error)

Permanently deletes an endpoint. This action cannot be undone.

func (*EndpointService) Get

func (r *EndpointService) Get(ctx context.Context, endpointID string, opts ...option.RequestOption) (res *DedicatedEndpoint, err error)

Retrieves details about a specific endpoint, including its current state, configuration, and scaling settings.

func (*EndpointService) List

Returns a list of all endpoints associated with your account. You can filter the results by type (dedicated or serverless).

func (*EndpointService) ListAvzones

func (r *EndpointService) ListAvzones(ctx context.Context, opts ...option.RequestOption) (res *EndpointListAvzonesResponse, err error)

List all available availability zones.

func (*EndpointService) New

Creates a new dedicated endpoint for serving models. The endpoint will automatically start after creation. You can deploy any supported model on hardware configurations that meet the model's requirements.

func (*EndpointService) Update

func (r *EndpointService) Update(ctx context.Context, endpointID string, body EndpointUpdateParams, opts ...option.RequestOption) (res *DedicatedEndpoint, err error)

Updates an existing endpoint's configuration. You can modify the display name, autoscaling settings, or change the endpoint's state (start/stop).

type EndpointUpdateParams

type EndpointUpdateParams struct {
	// The number of minutes of inactivity after which the endpoint will be
	// automatically stopped. Set to 0 to disable automatic timeout.
	InactiveTimeout param.Opt[int64] `json:"inactive_timeout,omitzero"`
	// A human-readable name for the endpoint
	DisplayName param.Opt[string] `json:"display_name,omitzero"`
	// New autoscaling configuration for the endpoint
	Autoscaling AutoscalingParam `json:"autoscaling,omitzero"`
	// The desired state of the endpoint
	//
	// Any of "STARTED", "STOPPED".
	State EndpointUpdateParamsState `json:"state,omitzero"`
	// contains filtered or unexported fields
}

func (EndpointUpdateParams) MarshalJSON

func (r EndpointUpdateParams) MarshalJSON() (data []byte, err error)

func (*EndpointUpdateParams) UnmarshalJSON

func (r *EndpointUpdateParams) UnmarshalJSON(data []byte) error

type EndpointUpdateParamsState

type EndpointUpdateParamsState string

The desired state of the endpoint

const (
	EndpointUpdateParamsStateStarted EndpointUpdateParamsState = "STARTED"
	EndpointUpdateParamsStateStopped EndpointUpdateParamsState = "STOPPED"
)

type Error

type Error = apierror.Error

type EvalListParams

type EvalListParams struct {
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	Status param.Opt[string] `query:"status,omitzero" json:"-"`
	// Admin users can specify a user ID to filter jobs. Pass empty string to get all
	// jobs.
	UserID param.Opt[string] `query:"userId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EvalListParams) URLQuery

func (r EvalListParams) URLQuery() (v url.Values, err error)

URLQuery serializes EvalListParams's query parameters as `url.Values`.

type EvalNewParams

type EvalNewParams struct {
	// Type-specific parameters for the evaluation
	Parameters EvalNewParamsParametersUnion `json:"parameters,omitzero,required"`
	// The type of evaluation to perform
	//
	// Any of "classify", "score", "compare".
	Type EvalNewParamsType `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

func (EvalNewParams) MarshalJSON

func (r EvalNewParams) MarshalJSON() (data []byte, err error)

func (*EvalNewParams) UnmarshalJSON

func (r *EvalNewParams) UnmarshalJSON(data []byte) error

type EvalNewParamsParametersEvaluationClassifyParameters

type EvalNewParamsParametersEvaluationClassifyParameters struct {
	// Data file ID
	InputDataFilePath string                                                   `json:"input_data_file_path,required"`
	Judge             EvalNewParamsParametersEvaluationClassifyParametersJudge `json:"judge,omitzero,required"`
	// List of possible classification labels
	Labels []string `json:"labels,omitzero,required"`
	// List of labels that are considered passing
	PassLabels []string `json:"pass_labels,omitzero,required"`
	// Field name in the input data
	ModelToEvaluate EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateUnion `json:"model_to_evaluate,omitzero"`
	// contains filtered or unexported fields
}

The properties InputDataFilePath, Judge, Labels, PassLabels are required.

func (EvalNewParamsParametersEvaluationClassifyParameters) MarshalJSON

func (r EvalNewParamsParametersEvaluationClassifyParameters) MarshalJSON() (data []byte, err error)

func (*EvalNewParamsParametersEvaluationClassifyParameters) UnmarshalJSON

type EvalNewParamsParametersEvaluationClassifyParametersJudge

type EvalNewParamsParametersEvaluationClassifyParametersJudge struct {
	// Name of the judge model
	Model string `json:"model,required"`
	// Source of the judge model.
	//
	// Any of "serverless", "dedicated", "external".
	ModelSource string `json:"model_source,omitzero,required"`
	// System prompt template for the judge
	SystemTemplate string `json:"system_template,required"`
	// Bearer/API token for external judge models.
	ExternalAPIToken param.Opt[string] `json:"external_api_token,omitzero"`
	// Base URL for external judge models. Must be OpenAI-compatible base URL.
	ExternalBaseURL param.Opt[string] `json:"external_base_url,omitzero"`
	// contains filtered or unexported fields
}

The properties Model, ModelSource, SystemTemplate are required.

func (EvalNewParamsParametersEvaluationClassifyParametersJudge) MarshalJSON

func (*EvalNewParamsParametersEvaluationClassifyParametersJudge) UnmarshalJSON

type EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateEvaluationModelRequest

type EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateEvaluationModelRequest struct {
	// Input prompt template
	InputTemplate string `json:"input_template,required"`
	// Maximum number of tokens to generate
	MaxTokens int64 `json:"max_tokens,required"`
	// Name of the model to evaluate
	Model string `json:"model,required"`
	// Source of the model.
	//
	// Any of "serverless", "dedicated", "external".
	ModelSource string `json:"model_source,omitzero,required"`
	// System prompt template
	SystemTemplate string `json:"system_template,required"`
	// Sampling temperature
	Temperature float64 `json:"temperature,required"`
	// Bearer/API token for external models.
	ExternalAPIToken param.Opt[string] `json:"external_api_token,omitzero"`
	// Base URL for external models. Must be OpenAI-compatible base URL
	ExternalBaseURL param.Opt[string] `json:"external_base_url,omitzero"`
	// contains filtered or unexported fields
}

The properties InputTemplate, MaxTokens, Model, ModelSource, SystemTemplate, Temperature are required.

func (EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateEvaluationModelRequest) MarshalJSON

func (*EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateEvaluationModelRequest) UnmarshalJSON

type EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateUnion

type EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateUnion struct {
	OfString                                                                              param.Opt[string]                                                                         `json:",omitzero,inline"`
	OfEvalNewsParametersEvaluationClassifyParametersModelToEvaluateEvaluationModelRequest *EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateEvaluationModelRequest `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateUnion) MarshalJSON

func (*EvalNewParamsParametersEvaluationClassifyParametersModelToEvaluateUnion) UnmarshalJSON

type EvalNewParamsParametersEvaluationCompareParameters

type EvalNewParamsParametersEvaluationCompareParameters struct {
	// Data file name
	InputDataFilePath string                                                  `json:"input_data_file_path,required"`
	Judge             EvalNewParamsParametersEvaluationCompareParametersJudge `json:"judge,omitzero,required"`
	// Field name in the input data
	ModelA EvalNewParamsParametersEvaluationCompareParametersModelAUnion `json:"model_a,omitzero"`
	// Field name in the input data
	ModelB EvalNewParamsParametersEvaluationCompareParametersModelBUnion `json:"model_b,omitzero"`
	// contains filtered or unexported fields
}

The properties InputDataFilePath, Judge are required.

func (EvalNewParamsParametersEvaluationCompareParameters) MarshalJSON

func (r EvalNewParamsParametersEvaluationCompareParameters) MarshalJSON() (data []byte, err error)

func (*EvalNewParamsParametersEvaluationCompareParameters) UnmarshalJSON

type EvalNewParamsParametersEvaluationCompareParametersJudge

type EvalNewParamsParametersEvaluationCompareParametersJudge struct {
	// Name of the judge model
	Model string `json:"model,required"`
	// Source of the judge model.
	//
	// Any of "serverless", "dedicated", "external".
	ModelSource string `json:"model_source,omitzero,required"`
	// System prompt template for the judge
	SystemTemplate string `json:"system_template,required"`
	// Bearer/API token for external judge models.
	ExternalAPIToken param.Opt[string] `json:"external_api_token,omitzero"`
	// Base URL for external judge models. Must be OpenAI-compatible base URL.
	ExternalBaseURL param.Opt[string] `json:"external_base_url,omitzero"`
	// contains filtered or unexported fields
}

The properties Model, ModelSource, SystemTemplate are required.

func (EvalNewParamsParametersEvaluationCompareParametersJudge) MarshalJSON

func (*EvalNewParamsParametersEvaluationCompareParametersJudge) UnmarshalJSON

type EvalNewParamsParametersEvaluationCompareParametersModelAEvaluationModelRequest

type EvalNewParamsParametersEvaluationCompareParametersModelAEvaluationModelRequest struct {
	// Input prompt template
	InputTemplate string `json:"input_template,required"`
	// Maximum number of tokens to generate
	MaxTokens int64 `json:"max_tokens,required"`
	// Name of the model to evaluate
	Model string `json:"model,required"`
	// Source of the model.
	//
	// Any of "serverless", "dedicated", "external".
	ModelSource string `json:"model_source,omitzero,required"`
	// System prompt template
	SystemTemplate string `json:"system_template,required"`
	// Sampling temperature
	Temperature float64 `json:"temperature,required"`
	// Bearer/API token for external models.
	ExternalAPIToken param.Opt[string] `json:"external_api_token,omitzero"`
	// Base URL for external models. Must be OpenAI-compatible base URL
	ExternalBaseURL param.Opt[string] `json:"external_base_url,omitzero"`
	// contains filtered or unexported fields
}

The properties InputTemplate, MaxTokens, Model, ModelSource, SystemTemplate, Temperature are required.

func (EvalNewParamsParametersEvaluationCompareParametersModelAEvaluationModelRequest) MarshalJSON

func (*EvalNewParamsParametersEvaluationCompareParametersModelAEvaluationModelRequest) UnmarshalJSON

type EvalNewParamsParametersEvaluationCompareParametersModelAUnion

type EvalNewParamsParametersEvaluationCompareParametersModelAUnion struct {
	OfString                                                                    param.Opt[string]                                                               `json:",omitzero,inline"`
	OfEvalNewsParametersEvaluationCompareParametersModelAEvaluationModelRequest *EvalNewParamsParametersEvaluationCompareParametersModelAEvaluationModelRequest `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (EvalNewParamsParametersEvaluationCompareParametersModelAUnion) MarshalJSON

func (*EvalNewParamsParametersEvaluationCompareParametersModelAUnion) UnmarshalJSON

type EvalNewParamsParametersEvaluationCompareParametersModelBEvaluationModelRequest

type EvalNewParamsParametersEvaluationCompareParametersModelBEvaluationModelRequest struct {
	// Input prompt template
	InputTemplate string `json:"input_template,required"`
	// Maximum number of tokens to generate
	MaxTokens int64 `json:"max_tokens,required"`
	// Name of the model to evaluate
	Model string `json:"model,required"`
	// Source of the model.
	//
	// Any of "serverless", "dedicated", "external".
	ModelSource string `json:"model_source,omitzero,required"`
	// System prompt template
	SystemTemplate string `json:"system_template,required"`
	// Sampling temperature
	Temperature float64 `json:"temperature,required"`
	// Bearer/API token for external models.
	ExternalAPIToken param.Opt[string] `json:"external_api_token,omitzero"`
	// Base URL for external models. Must be OpenAI-compatible base URL
	ExternalBaseURL param.Opt[string] `json:"external_base_url,omitzero"`
	// contains filtered or unexported fields
}

The properties InputTemplate, MaxTokens, Model, ModelSource, SystemTemplate, Temperature are required.

func (EvalNewParamsParametersEvaluationCompareParametersModelBEvaluationModelRequest) MarshalJSON

func (*EvalNewParamsParametersEvaluationCompareParametersModelBEvaluationModelRequest) UnmarshalJSON

type EvalNewParamsParametersEvaluationCompareParametersModelBUnion

type EvalNewParamsParametersEvaluationCompareParametersModelBUnion struct {
	OfString                                                                    param.Opt[string]                                                               `json:",omitzero,inline"`
	OfEvalNewsParametersEvaluationCompareParametersModelBEvaluationModelRequest *EvalNewParamsParametersEvaluationCompareParametersModelBEvaluationModelRequest `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (EvalNewParamsParametersEvaluationCompareParametersModelBUnion) MarshalJSON

func (*EvalNewParamsParametersEvaluationCompareParametersModelBUnion) UnmarshalJSON

type EvalNewParamsParametersEvaluationScoreParameters

type EvalNewParamsParametersEvaluationScoreParameters struct {
	// Data file ID
	InputDataFilePath string                                                `json:"input_data_file_path,required"`
	Judge             EvalNewParamsParametersEvaluationScoreParametersJudge `json:"judge,omitzero,required"`
	// Maximum possible score
	MaxScore float64 `json:"max_score,required"`
	// Minimum possible score
	MinScore float64 `json:"min_score,required"`
	// Score threshold for passing
	PassThreshold float64 `json:"pass_threshold,required"`
	// Field name in the input data
	ModelToEvaluate EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateUnion `json:"model_to_evaluate,omitzero"`
	// contains filtered or unexported fields
}

The properties InputDataFilePath, Judge, MaxScore, MinScore, PassThreshold are required.

func (EvalNewParamsParametersEvaluationScoreParameters) MarshalJSON

func (r EvalNewParamsParametersEvaluationScoreParameters) MarshalJSON() (data []byte, err error)

func (*EvalNewParamsParametersEvaluationScoreParameters) UnmarshalJSON

type EvalNewParamsParametersEvaluationScoreParametersJudge

type EvalNewParamsParametersEvaluationScoreParametersJudge struct {
	// Name of the judge model
	Model string `json:"model,required"`
	// Source of the judge model.
	//
	// Any of "serverless", "dedicated", "external".
	ModelSource string `json:"model_source,omitzero,required"`
	// System prompt template for the judge
	SystemTemplate string `json:"system_template,required"`
	// Bearer/API token for external judge models.
	ExternalAPIToken param.Opt[string] `json:"external_api_token,omitzero"`
	// Base URL for external judge models. Must be OpenAI-compatible base URL.
	ExternalBaseURL param.Opt[string] `json:"external_base_url,omitzero"`
	// contains filtered or unexported fields
}

The properties Model, ModelSource, SystemTemplate are required.

func (EvalNewParamsParametersEvaluationScoreParametersJudge) MarshalJSON

func (*EvalNewParamsParametersEvaluationScoreParametersJudge) UnmarshalJSON

type EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateEvaluationModelRequest

type EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateEvaluationModelRequest struct {
	// Input prompt template
	InputTemplate string `json:"input_template,required"`
	// Maximum number of tokens to generate
	MaxTokens int64 `json:"max_tokens,required"`
	// Name of the model to evaluate
	Model string `json:"model,required"`
	// Source of the model.
	//
	// Any of "serverless", "dedicated", "external".
	ModelSource string `json:"model_source,omitzero,required"`
	// System prompt template
	SystemTemplate string `json:"system_template,required"`
	// Sampling temperature
	Temperature float64 `json:"temperature,required"`
	// Bearer/API token for external models.
	ExternalAPIToken param.Opt[string] `json:"external_api_token,omitzero"`
	// Base URL for external models. Must be OpenAI-compatible base URL
	ExternalBaseURL param.Opt[string] `json:"external_base_url,omitzero"`
	// contains filtered or unexported fields
}

The properties InputTemplate, MaxTokens, Model, ModelSource, SystemTemplate, Temperature are required.

func (EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateEvaluationModelRequest) MarshalJSON

func (*EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateEvaluationModelRequest) UnmarshalJSON

type EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateUnion

type EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateUnion struct {
	OfString                                                                           param.Opt[string]                                                                      `json:",omitzero,inline"`
	OfEvalNewsParametersEvaluationScoreParametersModelToEvaluateEvaluationModelRequest *EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateEvaluationModelRequest `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateUnion) MarshalJSON

func (*EvalNewParamsParametersEvaluationScoreParametersModelToEvaluateUnion) UnmarshalJSON

type EvalNewParamsParametersUnion

type EvalNewParamsParametersUnion struct {
	OfEvalNewsParametersEvaluationClassifyParameters *EvalNewParamsParametersEvaluationClassifyParameters `json:",omitzero,inline"`
	OfEvalNewsParametersEvaluationScoreParameters    *EvalNewParamsParametersEvaluationScoreParameters    `json:",omitzero,inline"`
	OfEvalNewsParametersEvaluationCompareParameters  *EvalNewParamsParametersEvaluationCompareParameters  `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (EvalNewParamsParametersUnion) GetInputDataFilePath

func (u EvalNewParamsParametersUnion) GetInputDataFilePath() *string

Returns a pointer to the underlying variant's property, if present.

func (EvalNewParamsParametersUnion) GetJudge

func (u EvalNewParamsParametersUnion) GetJudge() (res evalNewParamsParametersUnionJudge)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (EvalNewParamsParametersUnion) GetLabels

func (u EvalNewParamsParametersUnion) GetLabels() []string

Returns a pointer to the underlying variant's property, if present.

func (EvalNewParamsParametersUnion) GetMaxScore

func (u EvalNewParamsParametersUnion) GetMaxScore() *float64

Returns a pointer to the underlying variant's property, if present.

func (EvalNewParamsParametersUnion) GetMinScore

func (u EvalNewParamsParametersUnion) GetMinScore() *float64

Returns a pointer to the underlying variant's property, if present.

func (EvalNewParamsParametersUnion) GetModelA

Returns a pointer to the underlying variant's property, if present.

func (EvalNewParamsParametersUnion) GetModelB

Returns a pointer to the underlying variant's property, if present.

func (EvalNewParamsParametersUnion) GetModelToEvaluate

func (u EvalNewParamsParametersUnion) GetModelToEvaluate() (res evalNewParamsParametersUnionModelToEvaluate)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (EvalNewParamsParametersUnion) GetPassLabels

func (u EvalNewParamsParametersUnion) GetPassLabels() []string

Returns a pointer to the underlying variant's property, if present.

func (EvalNewParamsParametersUnion) GetPassThreshold

func (u EvalNewParamsParametersUnion) GetPassThreshold() *float64

Returns a pointer to the underlying variant's property, if present.

func (EvalNewParamsParametersUnion) MarshalJSON

func (u EvalNewParamsParametersUnion) MarshalJSON() ([]byte, error)

func (*EvalNewParamsParametersUnion) UnmarshalJSON

func (u *EvalNewParamsParametersUnion) UnmarshalJSON(data []byte) error

type EvalNewParamsType

type EvalNewParamsType string

The type of evaluation to perform

const (
	EvalNewParamsTypeClassify EvalNewParamsType = "classify"
	EvalNewParamsTypeScore    EvalNewParamsType = "score"
	EvalNewParamsTypeCompare  EvalNewParamsType = "compare"
)

type EvalNewResponse

type EvalNewResponse struct {
	// Initial status of the job
	//
	// Any of "pending".
	Status EvalNewResponseStatus `json:"status"`
	// The ID of the created evaluation job
	WorkflowID string `json:"workflow_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Status      respjson.Field
		WorkflowID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvalNewResponse) RawJSON

func (r EvalNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalNewResponse) UnmarshalJSON

func (r *EvalNewResponse) UnmarshalJSON(data []byte) error

type EvalNewResponseStatus

type EvalNewResponseStatus string

Initial status of the job

const (
	EvalNewResponseStatusPending EvalNewResponseStatus = "pending"
)

type EvalService

type EvalService struct {
	Options []option.RequestOption
}

EvalService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEvalService method instead.

func NewEvalService

func NewEvalService(opts ...option.RequestOption) (r EvalService)

NewEvalService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EvalService) Get

func (r *EvalService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *EvaluationJob, err error)

Get evaluation job details

func (*EvalService) List

func (r *EvalService) List(ctx context.Context, query EvalListParams, opts ...option.RequestOption) (res *[]EvaluationJob, err error)

Get all evaluation jobs

func (*EvalService) New

func (r *EvalService) New(ctx context.Context, body EvalNewParams, opts ...option.RequestOption) (res *EvalNewResponse, err error)

Create an evaluation job

func (*EvalService) Status

func (r *EvalService) Status(ctx context.Context, id string, opts ...option.RequestOption) (res *EvalStatusResponse, err error)

Get evaluation job status and results

type EvalStatusResponse

type EvalStatusResponse struct {
	// The results of the evaluation job
	Results EvalStatusResponseResultsUnion `json:"results"`
	// The status of the evaluation job
	//
	// Any of "completed", "error", "user_error", "running", "queued", "pending".
	Status EvalStatusResponseStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Results     respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvalStatusResponse) RawJSON

func (r EvalStatusResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalStatusResponse) UnmarshalJSON

func (r *EvalStatusResponse) UnmarshalJSON(data []byte) error

type EvalStatusResponseResultsEvaluationClassifyResults

type EvalStatusResponseResultsEvaluationClassifyResults struct {
	// Number of failed generations.
	GenerationFailCount float64 `json:"generation_fail_count,nullable"`
	// Number of invalid labels
	InvalidLabelCount float64 `json:"invalid_label_count,nullable"`
	// Number of failed judge generations
	JudgeFailCount float64 `json:"judge_fail_count,nullable"`
	// JSON string representing label counts
	LabelCounts string `json:"label_counts"`
	// Pecentage of pass labels.
	PassPercentage float64 `json:"pass_percentage,nullable"`
	// Data File ID
	ResultFileID string `json:"result_file_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GenerationFailCount respjson.Field
		InvalidLabelCount   respjson.Field
		JudgeFailCount      respjson.Field
		LabelCounts         respjson.Field
		PassPercentage      respjson.Field
		ResultFileID        respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvalStatusResponseResultsEvaluationClassifyResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalStatusResponseResultsEvaluationClassifyResults) UnmarshalJSON

type EvalStatusResponseResultsEvaluationCompareResults

type EvalStatusResponseResultsEvaluationCompareResults struct {
	// Number of times model A won
	AWins int64 `json:"A_wins"`
	// Number of times model B won
	BWins int64 `json:"B_wins"`
	// Number of failed generations.
	GenerationFailCount float64 `json:"generation_fail_count,nullable"`
	// Number of failed judge generations
	JudgeFailCount float64 `json:"judge_fail_count,nullable"`
	// Total number of samples compared
	NumSamples int64 `json:"num_samples"`
	// Data File ID
	ResultFileID string `json:"result_file_id"`
	// Number of ties
	Ties int64 `json:"Ties"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AWins               respjson.Field
		BWins               respjson.Field
		GenerationFailCount respjson.Field
		JudgeFailCount      respjson.Field
		NumSamples          respjson.Field
		ResultFileID        respjson.Field
		Ties                respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvalStatusResponseResultsEvaluationCompareResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalStatusResponseResultsEvaluationCompareResults) UnmarshalJSON

type EvalStatusResponseResultsEvaluationScoreResults

type EvalStatusResponseResultsEvaluationScoreResults struct {
	AggregatedScores EvalStatusResponseResultsEvaluationScoreResultsAggregatedScores `json:"aggregated_scores"`
	// number of failed samples generated from model
	FailedSamples float64 `json:"failed_samples"`
	// Number of failed generations.
	GenerationFailCount float64 `json:"generation_fail_count,nullable"`
	// number of invalid scores generated from model
	InvalidScoreCount float64 `json:"invalid_score_count"`
	// Number of failed judge generations
	JudgeFailCount float64 `json:"judge_fail_count,nullable"`
	// Data File ID
	ResultFileID string `json:"result_file_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AggregatedScores    respjson.Field
		FailedSamples       respjson.Field
		GenerationFailCount respjson.Field
		InvalidScoreCount   respjson.Field
		JudgeFailCount      respjson.Field
		ResultFileID        respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvalStatusResponseResultsEvaluationScoreResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalStatusResponseResultsEvaluationScoreResults) UnmarshalJSON

type EvalStatusResponseResultsEvaluationScoreResultsAggregatedScores

type EvalStatusResponseResultsEvaluationScoreResultsAggregatedScores struct {
	MeanScore      float64 `json:"mean_score"`
	PassPercentage float64 `json:"pass_percentage"`
	StdScore       float64 `json:"std_score"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MeanScore      respjson.Field
		PassPercentage respjson.Field
		StdScore       respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvalStatusResponseResultsEvaluationScoreResultsAggregatedScores) RawJSON

Returns the unmodified JSON received from the API

func (*EvalStatusResponseResultsEvaluationScoreResultsAggregatedScores) UnmarshalJSON

type EvalStatusResponseResultsUnion

type EvalStatusResponseResultsUnion struct {
	GenerationFailCount float64 `json:"generation_fail_count"`
	// This field is from variant [EvalStatusResponseResultsEvaluationClassifyResults].
	InvalidLabelCount float64 `json:"invalid_label_count"`
	JudgeFailCount    float64 `json:"judge_fail_count"`
	// This field is from variant [EvalStatusResponseResultsEvaluationClassifyResults].
	LabelCounts string `json:"label_counts"`
	// This field is from variant [EvalStatusResponseResultsEvaluationClassifyResults].
	PassPercentage float64 `json:"pass_percentage"`
	ResultFileID   string  `json:"result_file_id"`
	// This field is from variant [EvalStatusResponseResultsEvaluationScoreResults].
	AggregatedScores EvalStatusResponseResultsEvaluationScoreResultsAggregatedScores `json:"aggregated_scores"`
	// This field is from variant [EvalStatusResponseResultsEvaluationScoreResults].
	FailedSamples float64 `json:"failed_samples"`
	// This field is from variant [EvalStatusResponseResultsEvaluationScoreResults].
	InvalidScoreCount float64 `json:"invalid_score_count"`
	// This field is from variant [EvalStatusResponseResultsEvaluationCompareResults].
	AWins int64 `json:"A_wins"`
	// This field is from variant [EvalStatusResponseResultsEvaluationCompareResults].
	BWins int64 `json:"B_wins"`
	// This field is from variant [EvalStatusResponseResultsEvaluationCompareResults].
	NumSamples int64 `json:"num_samples"`
	// This field is from variant [EvalStatusResponseResultsEvaluationCompareResults].
	Ties int64 `json:"Ties"`
	JSON struct {
		GenerationFailCount respjson.Field
		InvalidLabelCount   respjson.Field
		JudgeFailCount      respjson.Field
		LabelCounts         respjson.Field
		PassPercentage      respjson.Field
		ResultFileID        respjson.Field
		AggregatedScores    respjson.Field
		FailedSamples       respjson.Field
		InvalidScoreCount   respjson.Field
		AWins               respjson.Field
		BWins               respjson.Field
		NumSamples          respjson.Field
		Ties                respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EvalStatusResponseResultsUnion contains all possible properties and values from EvalStatusResponseResultsEvaluationClassifyResults, EvalStatusResponseResultsEvaluationScoreResults, EvalStatusResponseResultsEvaluationCompareResults.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (EvalStatusResponseResultsUnion) AsEvalStatusResponseResultsEvaluationClassifyResults

func (u EvalStatusResponseResultsUnion) AsEvalStatusResponseResultsEvaluationClassifyResults() (v EvalStatusResponseResultsEvaluationClassifyResults)

func (EvalStatusResponseResultsUnion) AsEvalStatusResponseResultsEvaluationCompareResults

func (u EvalStatusResponseResultsUnion) AsEvalStatusResponseResultsEvaluationCompareResults() (v EvalStatusResponseResultsEvaluationCompareResults)

func (EvalStatusResponseResultsUnion) AsEvalStatusResponseResultsEvaluationScoreResults

func (u EvalStatusResponseResultsUnion) AsEvalStatusResponseResultsEvaluationScoreResults() (v EvalStatusResponseResultsEvaluationScoreResults)

func (EvalStatusResponseResultsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*EvalStatusResponseResultsUnion) UnmarshalJSON

func (r *EvalStatusResponseResultsUnion) UnmarshalJSON(data []byte) error

type EvalStatusResponseStatus

type EvalStatusResponseStatus string

The status of the evaluation job

const (
	EvalStatusResponseStatusCompleted EvalStatusResponseStatus = "completed"
	EvalStatusResponseStatusError     EvalStatusResponseStatus = "error"
	EvalStatusResponseStatusUserError EvalStatusResponseStatus = "user_error"
	EvalStatusResponseStatusRunning   EvalStatusResponseStatus = "running"
	EvalStatusResponseStatusQueued    EvalStatusResponseStatus = "queued"
	EvalStatusResponseStatusPending   EvalStatusResponseStatus = "pending"
)

type EvaluationJob

type EvaluationJob struct {
	// When the job was created
	CreatedAt time.Time `json:"created_at" format:"date-time"`
	// ID of the job owner (admin only)
	OwnerID string `json:"owner_id"`
	// The parameters used for this evaluation
	Parameters map[string]any `json:"parameters"`
	// Results of the evaluation (when completed)
	Results EvaluationJobResultsUnion `json:"results,nullable"`
	// Current status of the job
	//
	// Any of "pending", "queued", "running", "completed", "error", "user_error".
	Status EvaluationJobStatus `json:"status"`
	// History of status updates (admin only)
	StatusUpdates []EvaluationJobStatusUpdate `json:"status_updates"`
	// The type of evaluation
	//
	// Any of "classify", "score", "compare".
	Type EvaluationJobType `json:"type"`
	// When the job was last updated
	UpdatedAt time.Time `json:"updated_at" format:"date-time"`
	// The evaluation job ID
	WorkflowID string `json:"workflow_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt     respjson.Field
		OwnerID       respjson.Field
		Parameters    respjson.Field
		Results       respjson.Field
		Status        respjson.Field
		StatusUpdates respjson.Field
		Type          respjson.Field
		UpdatedAt     respjson.Field
		WorkflowID    respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluationJob) RawJSON

func (r EvaluationJob) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluationJob) UnmarshalJSON

func (r *EvaluationJob) UnmarshalJSON(data []byte) error

type EvaluationJobResultsError

type EvaluationJobResultsError struct {
	Error string `json:"error"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluationJobResultsError) RawJSON

func (r EvaluationJobResultsError) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluationJobResultsError) UnmarshalJSON

func (r *EvaluationJobResultsError) UnmarshalJSON(data []byte) error

type EvaluationJobResultsEvaluationClassifyResults

type EvaluationJobResultsEvaluationClassifyResults struct {
	// Number of failed generations.
	GenerationFailCount float64 `json:"generation_fail_count,nullable"`
	// Number of invalid labels
	InvalidLabelCount float64 `json:"invalid_label_count,nullable"`
	// Number of failed judge generations
	JudgeFailCount float64 `json:"judge_fail_count,nullable"`
	// JSON string representing label counts
	LabelCounts string `json:"label_counts"`
	// Pecentage of pass labels.
	PassPercentage float64 `json:"pass_percentage,nullable"`
	// Data File ID
	ResultFileID string `json:"result_file_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GenerationFailCount respjson.Field
		InvalidLabelCount   respjson.Field
		JudgeFailCount      respjson.Field
		LabelCounts         respjson.Field
		PassPercentage      respjson.Field
		ResultFileID        respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluationJobResultsEvaluationClassifyResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvaluationJobResultsEvaluationClassifyResults) UnmarshalJSON

func (r *EvaluationJobResultsEvaluationClassifyResults) UnmarshalJSON(data []byte) error

type EvaluationJobResultsEvaluationCompareResults

type EvaluationJobResultsEvaluationCompareResults struct {
	// Number of times model A won
	AWins int64 `json:"A_wins"`
	// Number of times model B won
	BWins int64 `json:"B_wins"`
	// Number of failed generations.
	GenerationFailCount float64 `json:"generation_fail_count,nullable"`
	// Number of failed judge generations
	JudgeFailCount float64 `json:"judge_fail_count,nullable"`
	// Total number of samples compared
	NumSamples int64 `json:"num_samples"`
	// Data File ID
	ResultFileID string `json:"result_file_id"`
	// Number of ties
	Ties int64 `json:"Ties"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AWins               respjson.Field
		BWins               respjson.Field
		GenerationFailCount respjson.Field
		JudgeFailCount      respjson.Field
		NumSamples          respjson.Field
		ResultFileID        respjson.Field
		Ties                respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluationJobResultsEvaluationCompareResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvaluationJobResultsEvaluationCompareResults) UnmarshalJSON

func (r *EvaluationJobResultsEvaluationCompareResults) UnmarshalJSON(data []byte) error

type EvaluationJobResultsEvaluationScoreResults

type EvaluationJobResultsEvaluationScoreResults struct {
	AggregatedScores EvaluationJobResultsEvaluationScoreResultsAggregatedScores `json:"aggregated_scores"`
	// number of failed samples generated from model
	FailedSamples float64 `json:"failed_samples"`
	// Number of failed generations.
	GenerationFailCount float64 `json:"generation_fail_count,nullable"`
	// number of invalid scores generated from model
	InvalidScoreCount float64 `json:"invalid_score_count"`
	// Number of failed judge generations
	JudgeFailCount float64 `json:"judge_fail_count,nullable"`
	// Data File ID
	ResultFileID string `json:"result_file_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AggregatedScores    respjson.Field
		FailedSamples       respjson.Field
		GenerationFailCount respjson.Field
		InvalidScoreCount   respjson.Field
		JudgeFailCount      respjson.Field
		ResultFileID        respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluationJobResultsEvaluationScoreResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvaluationJobResultsEvaluationScoreResults) UnmarshalJSON

func (r *EvaluationJobResultsEvaluationScoreResults) UnmarshalJSON(data []byte) error

type EvaluationJobResultsEvaluationScoreResultsAggregatedScores

type EvaluationJobResultsEvaluationScoreResultsAggregatedScores struct {
	MeanScore      float64 `json:"mean_score"`
	PassPercentage float64 `json:"pass_percentage"`
	StdScore       float64 `json:"std_score"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MeanScore      respjson.Field
		PassPercentage respjson.Field
		StdScore       respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluationJobResultsEvaluationScoreResultsAggregatedScores) RawJSON

Returns the unmodified JSON received from the API

func (*EvaluationJobResultsEvaluationScoreResultsAggregatedScores) UnmarshalJSON

type EvaluationJobResultsUnion

type EvaluationJobResultsUnion struct {
	GenerationFailCount float64 `json:"generation_fail_count"`
	// This field is from variant [EvaluationJobResultsEvaluationClassifyResults].
	InvalidLabelCount float64 `json:"invalid_label_count"`
	JudgeFailCount    float64 `json:"judge_fail_count"`
	// This field is from variant [EvaluationJobResultsEvaluationClassifyResults].
	LabelCounts string `json:"label_counts"`
	// This field is from variant [EvaluationJobResultsEvaluationClassifyResults].
	PassPercentage float64 `json:"pass_percentage"`
	ResultFileID   string  `json:"result_file_id"`
	// This field is from variant [EvaluationJobResultsEvaluationScoreResults].
	AggregatedScores EvaluationJobResultsEvaluationScoreResultsAggregatedScores `json:"aggregated_scores"`
	// This field is from variant [EvaluationJobResultsEvaluationScoreResults].
	FailedSamples float64 `json:"failed_samples"`
	// This field is from variant [EvaluationJobResultsEvaluationScoreResults].
	InvalidScoreCount float64 `json:"invalid_score_count"`
	// This field is from variant [EvaluationJobResultsEvaluationCompareResults].
	AWins int64 `json:"A_wins"`
	// This field is from variant [EvaluationJobResultsEvaluationCompareResults].
	BWins int64 `json:"B_wins"`
	// This field is from variant [EvaluationJobResultsEvaluationCompareResults].
	NumSamples int64 `json:"num_samples"`
	// This field is from variant [EvaluationJobResultsEvaluationCompareResults].
	Ties int64 `json:"Ties"`
	// This field is from variant [EvaluationJobResultsError].
	Error string `json:"error"`
	JSON  struct {
		GenerationFailCount respjson.Field
		InvalidLabelCount   respjson.Field
		JudgeFailCount      respjson.Field
		LabelCounts         respjson.Field
		PassPercentage      respjson.Field
		ResultFileID        respjson.Field
		AggregatedScores    respjson.Field
		FailedSamples       respjson.Field
		InvalidScoreCount   respjson.Field
		AWins               respjson.Field
		BWins               respjson.Field
		NumSamples          respjson.Field
		Ties                respjson.Field
		Error               respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EvaluationJobResultsUnion contains all possible properties and values from EvaluationJobResultsEvaluationClassifyResults, EvaluationJobResultsEvaluationScoreResults, EvaluationJobResultsEvaluationCompareResults, EvaluationJobResultsError.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (EvaluationJobResultsUnion) AsEvaluationJobResultsError

func (u EvaluationJobResultsUnion) AsEvaluationJobResultsError() (v EvaluationJobResultsError)

func (EvaluationJobResultsUnion) AsEvaluationJobResultsEvaluationClassifyResults

func (u EvaluationJobResultsUnion) AsEvaluationJobResultsEvaluationClassifyResults() (v EvaluationJobResultsEvaluationClassifyResults)

func (EvaluationJobResultsUnion) AsEvaluationJobResultsEvaluationCompareResults

func (u EvaluationJobResultsUnion) AsEvaluationJobResultsEvaluationCompareResults() (v EvaluationJobResultsEvaluationCompareResults)

func (EvaluationJobResultsUnion) AsEvaluationJobResultsEvaluationScoreResults

func (u EvaluationJobResultsUnion) AsEvaluationJobResultsEvaluationScoreResults() (v EvaluationJobResultsEvaluationScoreResults)

func (EvaluationJobResultsUnion) RawJSON

func (u EvaluationJobResultsUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluationJobResultsUnion) UnmarshalJSON

func (r *EvaluationJobResultsUnion) UnmarshalJSON(data []byte) error

type EvaluationJobStatus

type EvaluationJobStatus string

Current status of the job

const (
	EvaluationJobStatusPending   EvaluationJobStatus = "pending"
	EvaluationJobStatusQueued    EvaluationJobStatus = "queued"
	EvaluationJobStatusRunning   EvaluationJobStatus = "running"
	EvaluationJobStatusCompleted EvaluationJobStatus = "completed"
	EvaluationJobStatusError     EvaluationJobStatus = "error"
	EvaluationJobStatusUserError EvaluationJobStatus = "user_error"
)

type EvaluationJobStatusUpdate

type EvaluationJobStatusUpdate struct {
	// Additional message for this update
	Message string `json:"message"`
	// The status at this update
	Status string `json:"status"`
	// When this update occurred
	Timestamp time.Time `json:"timestamp" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Status      respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EvaluationJobStatusUpdate) RawJSON

func (r EvaluationJobStatusUpdate) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvaluationJobStatusUpdate) UnmarshalJSON

func (r *EvaluationJobStatusUpdate) UnmarshalJSON(data []byte) error

type EvaluationJobType

type EvaluationJobType string

The type of evaluation

const (
	EvaluationJobTypeClassify EvaluationJobType = "classify"
	EvaluationJobTypeScore    EvaluationJobType = "score"
	EvaluationJobTypeCompare  EvaluationJobType = "compare"
)

type ExecuteResponseFailedExecution

type ExecuteResponseFailedExecution struct {
	Data   any                                        `json:"data,required"`
	Errors []ExecuteResponseFailedExecutionErrorUnion `json:"errors,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Errors      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExecuteResponseFailedExecution) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseFailedExecution) UnmarshalJSON

func (r *ExecuteResponseFailedExecution) UnmarshalJSON(data []byte) error

type ExecuteResponseFailedExecutionErrorUnion

type ExecuteResponseFailedExecutionErrorUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [any] instead of an object.
	OfExecuteResponseFailedExecutionErrorMapItem any `json:",inline"`
	JSON                                         struct {
		OfString                                     respjson.Field
		OfExecuteResponseFailedExecutionErrorMapItem respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ExecuteResponseFailedExecutionErrorUnion contains all possible properties and values from [string], [map[string]any].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfExecuteResponseFailedExecutionErrorMapItem]

func (ExecuteResponseFailedExecutionErrorUnion) AsAnyMap

func (ExecuteResponseFailedExecutionErrorUnion) AsString

func (ExecuteResponseFailedExecutionErrorUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseFailedExecutionErrorUnion) UnmarshalJSON

func (r *ExecuteResponseFailedExecutionErrorUnion) UnmarshalJSON(data []byte) error

type ExecuteResponseSuccessfulExecution

type ExecuteResponseSuccessfulExecution struct {
	Data   ExecuteResponseSuccessfulExecutionData `json:"data,required"`
	Errors any                                    `json:"errors,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Errors      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExecuteResponseSuccessfulExecution) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseSuccessfulExecution) UnmarshalJSON

func (r *ExecuteResponseSuccessfulExecution) UnmarshalJSON(data []byte) error

type ExecuteResponseSuccessfulExecutionData

type ExecuteResponseSuccessfulExecutionData struct {
	Outputs []ExecuteResponseSuccessfulExecutionDataOutputUnion `json:"outputs,required"`
	// Identifier of the current session. Used to make follow-up calls.
	SessionID string `json:"session_id,required"`
	// Status of the execution. Currently only supports success.
	//
	// Any of "success".
	Status string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Outputs     respjson.Field
		SessionID   respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExecuteResponseSuccessfulExecutionData) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseSuccessfulExecutionData) UnmarshalJSON

func (r *ExecuteResponseSuccessfulExecutionData) UnmarshalJSON(data []byte) error

type ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutput

type ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutput struct {
	Data ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData `json:"data,required"`
	// Any of "display_data", "execute_result".
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutput) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutput) UnmarshalJSON

type ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData

type ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData struct {
	ApplicationGeoJson           map[string]any `json:"application/geo+json"`
	ApplicationJavascript        string         `json:"application/javascript"`
	ApplicationJson              map[string]any `json:"application/json"`
	ApplicationPdf               string         `json:"application/pdf" format:"byte"`
	ApplicationVndVegaV5Json     map[string]any `json:"application/vnd.vega.v5+json"`
	ApplicationVndVegaliteV4Json map[string]any `json:"application/vnd.vegalite.v4+json"`
	ImageGif                     string         `json:"image/gif" format:"byte"`
	ImageJpeg                    string         `json:"image/jpeg" format:"byte"`
	ImagePng                     string         `json:"image/png" format:"byte"`
	ImageSvgXml                  string         `json:"image/svg+xml"`
	TextHTML                     string         `json:"text/html"`
	TextLatex                    string         `json:"text/latex"`
	TextMarkdown                 string         `json:"text/markdown"`
	TextPlain                    string         `json:"text/plain"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ApplicationGeoJson           respjson.Field
		ApplicationJavascript        respjson.Field
		ApplicationJson              respjson.Field
		ApplicationPdf               respjson.Field
		ApplicationVndVegaV5Json     respjson.Field
		ApplicationVndVegaliteV4Json respjson.Field
		ImageGif                     respjson.Field
		ImageJpeg                    respjson.Field
		ImagePng                     respjson.Field
		ImageSvgXml                  respjson.Field
		TextHTML                     respjson.Field
		TextLatex                    respjson.Field
		TextMarkdown                 respjson.Field
		TextPlain                    respjson.Field
		ExtraFields                  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData) UnmarshalJSON

type ExecuteResponseSuccessfulExecutionDataOutputError

type ExecuteResponseSuccessfulExecutionDataOutputError struct {
	Data string         `json:"data,required"`
	Type constant.Error `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Errors and exceptions that occurred. If this output type is present, your code did not execute successfully.

func (ExecuteResponseSuccessfulExecutionDataOutputError) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseSuccessfulExecutionDataOutputError) UnmarshalJSON

type ExecuteResponseSuccessfulExecutionDataOutputStreamOutput

type ExecuteResponseSuccessfulExecutionDataOutputStreamOutput struct {
	Data string `json:"data,required"`
	// Any of "stdout", "stderr".
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Outputs that were printed to stdout or stderr

func (ExecuteResponseSuccessfulExecutionDataOutputStreamOutput) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseSuccessfulExecutionDataOutputStreamOutput) UnmarshalJSON

type ExecuteResponseSuccessfulExecutionDataOutputUnion

type ExecuteResponseSuccessfulExecutionDataOutputUnion struct {
	// This field is a union of [string], [string],
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData]
	Data ExecuteResponseSuccessfulExecutionDataOutputUnionData `json:"data"`
	// Any of nil, "error", nil.
	Type string `json:"type"`
	JSON struct {
		Data respjson.Field
		Type respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ExecuteResponseSuccessfulExecutionDataOutputUnion contains all possible properties and values from ExecuteResponseSuccessfulExecutionDataOutputStreamOutput, ExecuteResponseSuccessfulExecutionDataOutputError, ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutput.

Use the [ExecuteResponseSuccessfulExecutionDataOutputUnion.AsAny] method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ExecuteResponseSuccessfulExecutionDataOutputUnion) AsDisplayorExecuteOutput

func (ExecuteResponseSuccessfulExecutionDataOutputUnion) AsError

func (ExecuteResponseSuccessfulExecutionDataOutputUnion) AsStreamOutput

func (ExecuteResponseSuccessfulExecutionDataOutputUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ExecuteResponseSuccessfulExecutionDataOutputUnion) UnmarshalJSON

type ExecuteResponseSuccessfulExecutionDataOutputUnionData

type ExecuteResponseSuccessfulExecutionDataOutputUnionData struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ApplicationGeoJson map[string]any `json:"application/geo+json"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ApplicationJavascript string `json:"application/javascript"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ApplicationJson map[string]any `json:"application/json"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ApplicationPdf string `json:"application/pdf"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ApplicationVndVegaV5Json map[string]any `json:"application/vnd.vega.v5+json"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ApplicationVndVegaliteV4Json map[string]any `json:"application/vnd.vegalite.v4+json"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ImageGif string `json:"image/gif"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ImageJpeg string `json:"image/jpeg"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ImagePng string `json:"image/png"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	ImageSvgXml string `json:"image/svg+xml"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	TextHTML string `json:"text/html"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	TextLatex string `json:"text/latex"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	TextMarkdown string `json:"text/markdown"`
	// This field is from variant
	// [ExecuteResponseSuccessfulExecutionDataOutputDisplayorExecuteOutputData].
	TextPlain string `json:"text/plain"`
	JSON      struct {
		OfString                     respjson.Field
		ApplicationGeoJson           respjson.Field
		ApplicationJavascript        respjson.Field
		ApplicationJson              respjson.Field
		ApplicationPdf               respjson.Field
		ApplicationVndVegaV5Json     respjson.Field
		ApplicationVndVegaliteV4Json respjson.Field
		ImageGif                     respjson.Field
		ImageJpeg                    respjson.Field
		ImagePng                     respjson.Field
		ImageSvgXml                  respjson.Field
		TextHTML                     respjson.Field
		TextLatex                    respjson.Field
		TextMarkdown                 respjson.Field
		TextPlain                    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ExecuteResponseSuccessfulExecutionDataOutputUnionData is an implicit subunion of ExecuteResponseSuccessfulExecutionDataOutputUnion. ExecuteResponseSuccessfulExecutionDataOutputUnionData provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ExecuteResponseSuccessfulExecutionDataOutputUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString]

func (*ExecuteResponseSuccessfulExecutionDataOutputUnionData) UnmarshalJSON

type ExecuteResponseUnion

type ExecuteResponseUnion struct {
	// This field is a union of [ExecuteResponseSuccessfulExecutionData], [any]
	Data ExecuteResponseUnionData `json:"data"`
	// This field is a union of [any], [[]ExecuteResponseFailedExecutionErrorUnion]
	Errors ExecuteResponseUnionErrors `json:"errors"`
	JSON   struct {
		Data   respjson.Field
		Errors respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ExecuteResponseUnion contains all possible properties and values from ExecuteResponseSuccessfulExecution, ExecuteResponseFailedExecution.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ExecuteResponseUnion) AsFailedExecution

func (u ExecuteResponseUnion) AsFailedExecution() (v ExecuteResponseFailedExecution)

func (ExecuteResponseUnion) AsSuccessfulExecution

func (u ExecuteResponseUnion) AsSuccessfulExecution() (v ExecuteResponseSuccessfulExecution)

func (ExecuteResponseUnion) RawJSON

func (u ExecuteResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ExecuteResponseUnion) UnmarshalJSON

func (r *ExecuteResponseUnion) UnmarshalJSON(data []byte) error

type ExecuteResponseUnionData

type ExecuteResponseUnionData struct {
	// This field will be present if the value is a [any] instead of an object.
	OfExecuteResponseFailedExecutionData any `json:",inline"`
	// This field is from variant [ExecuteResponseSuccessfulExecutionData].
	Outputs []ExecuteResponseSuccessfulExecutionDataOutputUnion `json:"outputs"`
	// This field is from variant [ExecuteResponseSuccessfulExecutionData].
	SessionID string `json:"session_id"`
	// This field is from variant [ExecuteResponseSuccessfulExecutionData].
	Status string `json:"status"`
	JSON   struct {
		OfExecuteResponseFailedExecutionData respjson.Field
		Outputs                              respjson.Field
		SessionID                            respjson.Field
		Status                               respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ExecuteResponseUnionData is an implicit subunion of ExecuteResponseUnion. ExecuteResponseUnionData provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ExecuteResponseUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfExecuteResponseFailedExecutionData]

func (*ExecuteResponseUnionData) UnmarshalJSON

func (r *ExecuteResponseUnionData) UnmarshalJSON(data []byte) error

type ExecuteResponseUnionErrors

type ExecuteResponseUnionErrors struct {
	// This field will be present if the value is a [any] instead of an object.
	OfExecuteResponseSuccessfulExecutionErrors any `json:",inline"`
	// This field will be present if the value is a
	// [[]ExecuteResponseFailedExecutionErrorUnion] instead of an object.
	OfExecuteResponseFailedExecutionErrors []ExecuteResponseFailedExecutionErrorUnion `json:",inline"`
	JSON                                   struct {
		OfExecuteResponseSuccessfulExecutionErrors respjson.Field
		OfExecuteResponseFailedExecutionErrors     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ExecuteResponseUnionErrors is an implicit subunion of ExecuteResponseUnion. ExecuteResponseUnionErrors provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ExecuteResponseUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfExecuteResponseSuccessfulExecutionErrors OfExecuteResponseFailedExecutionErrors]

func (*ExecuteResponseUnionErrors) UnmarshalJSON

func (r *ExecuteResponseUnionErrors) UnmarshalJSON(data []byte) error

type FileDeleteResponse

type FileDeleteResponse struct {
	ID      string `json:"id"`
	Deleted bool   `json:"deleted"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Deleted     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileDeleteResponse) RawJSON

func (r FileDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileDeleteResponse) UnmarshalJSON

func (r *FileDeleteResponse) UnmarshalJSON(data []byte) error

type FileList

type FileList struct {
	Data []FileResponse `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileList) RawJSON

func (r FileList) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileList) UnmarshalJSON

func (r *FileList) UnmarshalJSON(data []byte) error

type FilePurpose

type FilePurpose string

The purpose of the file

const (
	FilePurposeFineTune       FilePurpose = "fine-tune"
	FilePurposeEval           FilePurpose = "eval"
	FilePurposeEvalSample     FilePurpose = "eval-sample"
	FilePurposeEvalOutput     FilePurpose = "eval-output"
	FilePurposeEvalSummary    FilePurpose = "eval-summary"
	FilePurposeBatchGenerated FilePurpose = "batch-generated"
	FilePurposeBatchAPI       FilePurpose = "batch-api"
)

type FileResponse

type FileResponse struct {
	ID        string `json:"id,required"`
	Bytes     int64  `json:"bytes,required"`
	CreatedAt int64  `json:"created_at,required"`
	Filename  string `json:"filename,required"`
	// The type of the file
	//
	// Any of "csv", "jsonl", "parquet".
	FileType  FileType `json:"FileType,required"`
	LineCount int64    `json:"LineCount,required"`
	Object    string   `json:"object,required"`
	Processed bool     `json:"Processed,required"`
	// The purpose of the file
	//
	// Any of "fine-tune", "eval", "eval-sample", "eval-output", "eval-summary",
	// "batch-generated", "batch-api".
	Purpose FilePurpose `json:"purpose,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Bytes       respjson.Field
		CreatedAt   respjson.Field
		Filename    respjson.Field
		FileType    respjson.Field
		LineCount   respjson.Field
		Object      respjson.Field
		Processed   respjson.Field
		Purpose     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileResponse) RawJSON

func (r FileResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileResponse) UnmarshalJSON

func (r *FileResponse) UnmarshalJSON(data []byte) error

type FileService

type FileService struct {
	Options []option.RequestOption
}

FileService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFileService method instead.

func NewFileService

func NewFileService(opts ...option.RequestOption) (r FileService)

NewFileService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FileService) Content

func (r *FileService) Content(ctx context.Context, id string, opts ...option.RequestOption) (res *http.Response, err error)

Get the contents of a single uploaded data file.

func (*FileService) Delete

func (r *FileService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *FileDeleteResponse, err error)

Delete a previously uploaded data file.

func (*FileService) Get

func (r *FileService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *FileResponse, err error)

List the metadata for a single uploaded data file.

func (*FileService) List

func (r *FileService) List(ctx context.Context, opts ...option.RequestOption) (res *FileList, err error)

List the metadata for all uploaded data files.

func (*FileService) Upload

func (r *FileService) Upload(ctx context.Context, body FileUploadParams, opts ...option.RequestOption) (res *FileResponse, err error)

Upload a file with specified purpose, file name, and file type.

type FileType

type FileType string

The type of the file

const (
	FileTypeCsv     FileType = "csv"
	FileTypeJSONL   FileType = "jsonl"
	FileTypeParquet FileType = "parquet"
)

type FileUploadParams

type FileUploadParams struct {
	// The content of the file being uploaded
	File io.Reader `json:"file,omitzero,required" format:"binary"`
	// The name of the file being uploaded
	FileName string `json:"file_name,required"`
	// The purpose of the file
	//
	// Any of "fine-tune", "eval", "eval-sample", "eval-output", "eval-summary",
	// "batch-generated", "batch-api".
	Purpose FilePurpose `json:"purpose,omitzero,required"`
	// The type of the file
	//
	// Any of "csv", "jsonl", "parquet".
	FileType FileType `json:"file_type,omitzero"`
	// contains filtered or unexported fields
}

func (FileUploadParams) MarshalMultipart

func (r FileUploadParams) MarshalMultipart() (data []byte, contentType string, err error)

type FineTuningCancelResponse

type FineTuningCancelResponse struct {
	// Unique identifier for the fine-tune job
	ID string `json:"id,required"`
	// Creation timestamp of the fine-tune job
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Any of "pending", "queued", "running", "compressing", "uploading",
	// "cancel_requested", "cancelled", "error", "completed".
	Status FineTuningCancelResponseStatus `json:"status,required"`
	// Last update timestamp of the fine-tune job
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// Batch size used for training
	BatchSize int64 `json:"batch_size"`
	// Events related to this fine-tune job
	Events []FinetuneEvent `json:"events"`
	// Checkpoint used to continue training
	FromCheckpoint string `json:"from_checkpoint"`
	// Hugging Face Hub repo to start training from
	FromHfModel string `json:"from_hf_model"`
	// The revision of the Hugging Face Hub model to continue training from
	HfModelRevision string `json:"hf_model_revision"`
	// Learning rate used for training
	LearningRate float64 `json:"learning_rate"`
	// Learning rate scheduler configuration
	LrScheduler FineTuningCancelResponseLrScheduler `json:"lr_scheduler"`
	// Maximum gradient norm for clipping
	MaxGradNorm float64 `json:"max_grad_norm"`
	// Base model used for fine-tuning
	Model           string `json:"model"`
	ModelOutputName string `json:"model_output_name"`
	// Number of checkpoints saved during training
	NCheckpoints int64 `json:"n_checkpoints"`
	// Number of training epochs
	NEpochs int64 `json:"n_epochs"`
	// Number of evaluations during training
	NEvals int64 `json:"n_evals"`
	// Owner address information
	OwnerAddress string `json:"owner_address"`
	// Suffix added to the fine-tuned model name
	Suffix string `json:"suffix"`
	// Count of tokens processed
	TokenCount int64 `json:"token_count"`
	// Total price for the fine-tuning job
	TotalPrice int64 `json:"total_price"`
	// File-ID of the training file
	TrainingFile string `json:"training_file"`
	// Method of training used
	TrainingMethod FineTuningCancelResponseTrainingMethodUnion `json:"training_method"`
	// Type of training used (full or LoRA)
	TrainingType FineTuningCancelResponseTrainingTypeUnion `json:"training_type"`
	// Identifier for the user who created the job
	UserID string `json:"user_id"`
	// File-ID of the validation file
	ValidationFile string `json:"validation_file"`
	// Weights & Biases run name
	WandbName string `json:"wandb_name"`
	// Weights & Biases project name
	WandbProjectName string `json:"wandb_project_name"`
	// Ratio of warmup steps
	WarmupRatio float64 `json:"warmup_ratio"`
	// Weight decay value used
	WeightDecay float64 `json:"weight_decay"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		CreatedAt        respjson.Field
		Status           respjson.Field
		UpdatedAt        respjson.Field
		BatchSize        respjson.Field
		Events           respjson.Field
		FromCheckpoint   respjson.Field
		FromHfModel      respjson.Field
		HfModelRevision  respjson.Field
		LearningRate     respjson.Field
		LrScheduler      respjson.Field
		MaxGradNorm      respjson.Field
		Model            respjson.Field
		ModelOutputName  respjson.Field
		NCheckpoints     respjson.Field
		NEpochs          respjson.Field
		NEvals           respjson.Field
		OwnerAddress     respjson.Field
		Suffix           respjson.Field
		TokenCount       respjson.Field
		TotalPrice       respjson.Field
		TrainingFile     respjson.Field
		TrainingMethod   respjson.Field
		TrainingType     respjson.Field
		UserID           respjson.Field
		ValidationFile   respjson.Field
		WandbName        respjson.Field
		WandbProjectName respjson.Field
		WarmupRatio      respjson.Field
		WeightDecay      respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A truncated version of the fine-tune response, used for POST /fine-tunes, GET /fine-tunes and POST /fine-tunes/{id}/cancel endpoints

func (FineTuningCancelResponse) RawJSON

func (r FineTuningCancelResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponse) UnmarshalJSON

func (r *FineTuningCancelResponse) UnmarshalJSON(data []byte) error

type FineTuningCancelResponseLrScheduler

type FineTuningCancelResponseLrScheduler struct {
	// Any of "linear", "cosine".
	LrSchedulerType string                                                  `json:"lr_scheduler_type,required"`
	LrSchedulerArgs FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion `json:"lr_scheduler_args"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LrSchedulerType respjson.Field
		LrSchedulerArgs respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Learning rate scheduler configuration

func (FineTuningCancelResponseLrScheduler) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseLrScheduler) UnmarshalJSON

func (r *FineTuningCancelResponseLrScheduler) UnmarshalJSON(data []byte) error

type FineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

type FineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio,required"`
	// Number or fraction of cycles for the cosine learning rate scheduler
	NumCycles float64 `json:"num_cycles,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinLrRatio  respjson.Field
		NumCycles   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) UnmarshalJSON

type FineTuningCancelResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

type FineTuningCancelResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinLrRatio  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningCancelResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) UnmarshalJSON

type FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion

type FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion struct {
	MinLrRatio float64 `json:"min_lr_ratio"`
	// This field is from variant
	// [FineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs].
	NumCycles float64 `json:"num_cycles"`
	JSON      struct {
		MinLrRatio respjson.Field
		NumCycles  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion contains all possible properties and values from FineTuningCancelResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs, FineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion) AsFineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

func (u FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion) AsFineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs() (v FineTuningCancelResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs)

func (FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion) AsFineTuningCancelResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

func (u FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion) AsFineTuningCancelResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs() (v FineTuningCancelResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs)

func (FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseLrSchedulerLrSchedulerArgsUnion) UnmarshalJSON

type FineTuningCancelResponseStatus

type FineTuningCancelResponseStatus string
const (
	FineTuningCancelResponseStatusPending         FineTuningCancelResponseStatus = "pending"
	FineTuningCancelResponseStatusQueued          FineTuningCancelResponseStatus = "queued"
	FineTuningCancelResponseStatusRunning         FineTuningCancelResponseStatus = "running"
	FineTuningCancelResponseStatusCompressing     FineTuningCancelResponseStatus = "compressing"
	FineTuningCancelResponseStatusUploading       FineTuningCancelResponseStatus = "uploading"
	FineTuningCancelResponseStatusCancelRequested FineTuningCancelResponseStatus = "cancel_requested"
	FineTuningCancelResponseStatusCancelled       FineTuningCancelResponseStatus = "cancelled"
	FineTuningCancelResponseStatusError           FineTuningCancelResponseStatus = "error"
	FineTuningCancelResponseStatusCompleted       FineTuningCancelResponseStatus = "completed"
)

type FineTuningCancelResponseTrainingMethodTrainingMethodDpo

type FineTuningCancelResponseTrainingMethodTrainingMethodDpo struct {
	// Any of "dpo".
	Method                        string  `json:"method,required"`
	DpoBeta                       float64 `json:"dpo_beta"`
	DpoNormalizeLogratiosByLength bool    `json:"dpo_normalize_logratios_by_length"`
	DpoReferenceFree              bool    `json:"dpo_reference_free"`
	RpoAlpha                      float64 `json:"rpo_alpha"`
	SimpoGamma                    float64 `json:"simpo_gamma"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method                        respjson.Field
		DpoBeta                       respjson.Field
		DpoNormalizeLogratiosByLength respjson.Field
		DpoReferenceFree              respjson.Field
		RpoAlpha                      respjson.Field
		SimpoGamma                    respjson.Field
		ExtraFields                   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningCancelResponseTrainingMethodTrainingMethodDpo) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseTrainingMethodTrainingMethodDpo) UnmarshalJSON

type FineTuningCancelResponseTrainingMethodTrainingMethodSft

type FineTuningCancelResponseTrainingMethodTrainingMethodSft struct {
	// Any of "sft".
	Method string `json:"method,required"`
	// Whether to mask the user messages in conversational data or prompts in
	// instruction data.
	TrainOnInputs FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method        respjson.Field
		TrainOnInputs respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningCancelResponseTrainingMethodTrainingMethodSft) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseTrainingMethodTrainingMethodSft) UnmarshalJSON

type FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsString

type FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsString string
const (
	FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsStringAuto FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsString = "auto"
)

type FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion

type FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion struct {
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfFineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsString string `json:",inline"`
	JSON                                                                         struct {
		OfBool                                                                       respjson.Field
		OfFineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion contains all possible properties and values from [bool], [string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfBool OfFineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsString]

func (FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsBool

func (FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsFineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsString

func (u FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsFineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsString() (v string)

func (FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) UnmarshalJSON

type FineTuningCancelResponseTrainingMethodUnion

type FineTuningCancelResponseTrainingMethodUnion struct {
	Method string `json:"method"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingMethodTrainingMethodSft].
	TrainOnInputs FineTuningCancelResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingMethodTrainingMethodDpo].
	DpoBeta float64 `json:"dpo_beta"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingMethodTrainingMethodDpo].
	DpoNormalizeLogratiosByLength bool `json:"dpo_normalize_logratios_by_length"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingMethodTrainingMethodDpo].
	DpoReferenceFree bool `json:"dpo_reference_free"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingMethodTrainingMethodDpo].
	RpoAlpha float64 `json:"rpo_alpha"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingMethodTrainingMethodDpo].
	SimpoGamma float64 `json:"simpo_gamma"`
	JSON       struct {
		Method                        respjson.Field
		TrainOnInputs                 respjson.Field
		DpoBeta                       respjson.Field
		DpoNormalizeLogratiosByLength respjson.Field
		DpoReferenceFree              respjson.Field
		RpoAlpha                      respjson.Field
		SimpoGamma                    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningCancelResponseTrainingMethodUnion contains all possible properties and values from FineTuningCancelResponseTrainingMethodTrainingMethodSft, FineTuningCancelResponseTrainingMethodTrainingMethodDpo.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningCancelResponseTrainingMethodUnion) AsFineTuningCancelResponseTrainingMethodTrainingMethodDpo

func (u FineTuningCancelResponseTrainingMethodUnion) AsFineTuningCancelResponseTrainingMethodTrainingMethodDpo() (v FineTuningCancelResponseTrainingMethodTrainingMethodDpo)

func (FineTuningCancelResponseTrainingMethodUnion) AsFineTuningCancelResponseTrainingMethodTrainingMethodSft

func (u FineTuningCancelResponseTrainingMethodUnion) AsFineTuningCancelResponseTrainingMethodTrainingMethodSft() (v FineTuningCancelResponseTrainingMethodTrainingMethodSft)

func (FineTuningCancelResponseTrainingMethodUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseTrainingMethodUnion) UnmarshalJSON

func (r *FineTuningCancelResponseTrainingMethodUnion) UnmarshalJSON(data []byte) error

type FineTuningCancelResponseTrainingTypeFullTrainingType

type FineTuningCancelResponseTrainingTypeFullTrainingType struct {
	// Any of "Full".
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningCancelResponseTrainingTypeFullTrainingType) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseTrainingTypeFullTrainingType) UnmarshalJSON

type FineTuningCancelResponseTrainingTypeLoRaTrainingType

type FineTuningCancelResponseTrainingTypeLoRaTrainingType struct {
	LoraAlpha int64 `json:"lora_alpha,required"`
	LoraR     int64 `json:"lora_r,required"`
	// Any of "Lora".
	Type                 string  `json:"type,required"`
	LoraDropout          float64 `json:"lora_dropout"`
	LoraTrainableModules string  `json:"lora_trainable_modules"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LoraAlpha            respjson.Field
		LoraR                respjson.Field
		Type                 respjson.Field
		LoraDropout          respjson.Field
		LoraTrainableModules respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningCancelResponseTrainingTypeLoRaTrainingType) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseTrainingTypeLoRaTrainingType) UnmarshalJSON

type FineTuningCancelResponseTrainingTypeUnion

type FineTuningCancelResponseTrainingTypeUnion struct {
	Type string `json:"type"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingTypeLoRaTrainingType].
	LoraAlpha int64 `json:"lora_alpha"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingTypeLoRaTrainingType].
	LoraR int64 `json:"lora_r"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingTypeLoRaTrainingType].
	LoraDropout float64 `json:"lora_dropout"`
	// This field is from variant
	// [FineTuningCancelResponseTrainingTypeLoRaTrainingType].
	LoraTrainableModules string `json:"lora_trainable_modules"`
	JSON                 struct {
		Type                 respjson.Field
		LoraAlpha            respjson.Field
		LoraR                respjson.Field
		LoraDropout          respjson.Field
		LoraTrainableModules respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningCancelResponseTrainingTypeUnion contains all possible properties and values from FineTuningCancelResponseTrainingTypeFullTrainingType, FineTuningCancelResponseTrainingTypeLoRaTrainingType.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningCancelResponseTrainingTypeUnion) AsFineTuningCancelResponseTrainingTypeFullTrainingType

func (u FineTuningCancelResponseTrainingTypeUnion) AsFineTuningCancelResponseTrainingTypeFullTrainingType() (v FineTuningCancelResponseTrainingTypeFullTrainingType)

func (FineTuningCancelResponseTrainingTypeUnion) AsFineTuningCancelResponseTrainingTypeLoRaTrainingType

func (u FineTuningCancelResponseTrainingTypeUnion) AsFineTuningCancelResponseTrainingTypeLoRaTrainingType() (v FineTuningCancelResponseTrainingTypeLoRaTrainingType)

func (FineTuningCancelResponseTrainingTypeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningCancelResponseTrainingTypeUnion) UnmarshalJSON

func (r *FineTuningCancelResponseTrainingTypeUnion) UnmarshalJSON(data []byte) error

type FineTuningContentParams

type FineTuningContentParams struct {
	// Fine-tune ID to download. A string that starts with `ft-`.
	FtID string `query:"ft_id,required" json:"-"`
	// Specifies step number for checkpoint to download. Ignores `checkpoint` value if
	// set.
	CheckpointStep param.Opt[int64] `query:"checkpoint_step,omitzero" json:"-"`
	// Specifies checkpoint type to download - `merged` vs `adapter`. This field is
	// required if the checkpoint_step is not set.
	//
	// Any of "merged", "adapter", "model_output_path".
	Checkpoint FineTuningContentParamsCheckpoint `query:"checkpoint,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (FineTuningContentParams) URLQuery

func (r FineTuningContentParams) URLQuery() (v url.Values, err error)

URLQuery serializes FineTuningContentParams's query parameters as `url.Values`.

type FineTuningContentParamsCheckpoint

type FineTuningContentParamsCheckpoint string

Specifies checkpoint type to download - `merged` vs `adapter`. This field is required if the checkpoint_step is not set.

const (
	FineTuningContentParamsCheckpointMerged          FineTuningContentParamsCheckpoint = "merged"
	FineTuningContentParamsCheckpointAdapter         FineTuningContentParamsCheckpoint = "adapter"
	FineTuningContentParamsCheckpointModelOutputPath FineTuningContentParamsCheckpoint = "model_output_path"
)

type FineTuningDeleteParams

type FineTuningDeleteParams struct {
	Force param.Opt[bool] `query:"force,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (FineTuningDeleteParams) URLQuery

func (r FineTuningDeleteParams) URLQuery() (v url.Values, err error)

URLQuery serializes FineTuningDeleteParams's query parameters as `url.Values`.

type FineTuningDeleteResponse

type FineTuningDeleteResponse struct {
	// Message indicating the result of the deletion
	Message string `json:"message"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningDeleteResponse) RawJSON

func (r FineTuningDeleteResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuningDeleteResponse) UnmarshalJSON

func (r *FineTuningDeleteResponse) UnmarshalJSON(data []byte) error

type FineTuningListCheckpointsResponse

type FineTuningListCheckpointsResponse struct {
	Data []FineTuningListCheckpointsResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListCheckpointsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListCheckpointsResponse) UnmarshalJSON

func (r *FineTuningListCheckpointsResponse) UnmarshalJSON(data []byte) error

type FineTuningListCheckpointsResponseData

type FineTuningListCheckpointsResponseData struct {
	CheckpointType string `json:"checkpoint_type,required"`
	CreatedAt      string `json:"created_at,required"`
	Path           string `json:"path,required"`
	Step           int64  `json:"step,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CheckpointType respjson.Field
		CreatedAt      respjson.Field
		Path           respjson.Field
		Step           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListCheckpointsResponseData) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListCheckpointsResponseData) UnmarshalJSON

func (r *FineTuningListCheckpointsResponseData) UnmarshalJSON(data []byte) error

type FineTuningListEventsResponse

type FineTuningListEventsResponse struct {
	Data []FinetuneEvent `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListEventsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListEventsResponse) UnmarshalJSON

func (r *FineTuningListEventsResponse) UnmarshalJSON(data []byte) error

type FineTuningListResponse

type FineTuningListResponse struct {
	Data []FineTuningListResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListResponse) RawJSON

func (r FineTuningListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuningListResponse) UnmarshalJSON

func (r *FineTuningListResponse) UnmarshalJSON(data []byte) error

type FineTuningListResponseData

type FineTuningListResponseData struct {
	// Unique identifier for the fine-tune job
	ID string `json:"id,required"`
	// Creation timestamp of the fine-tune job
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Any of "pending", "queued", "running", "compressing", "uploading",
	// "cancel_requested", "cancelled", "error", "completed".
	Status string `json:"status,required"`
	// Last update timestamp of the fine-tune job
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// Batch size used for training
	BatchSize int64 `json:"batch_size"`
	// Events related to this fine-tune job
	Events []FinetuneEvent `json:"events"`
	// Checkpoint used to continue training
	FromCheckpoint string `json:"from_checkpoint"`
	// Hugging Face Hub repo to start training from
	FromHfModel string `json:"from_hf_model"`
	// The revision of the Hugging Face Hub model to continue training from
	HfModelRevision string `json:"hf_model_revision"`
	// Learning rate used for training
	LearningRate float64 `json:"learning_rate"`
	// Learning rate scheduler configuration
	LrScheduler FineTuningListResponseDataLrScheduler `json:"lr_scheduler"`
	// Maximum gradient norm for clipping
	MaxGradNorm float64 `json:"max_grad_norm"`
	// Base model used for fine-tuning
	Model           string `json:"model"`
	ModelOutputName string `json:"model_output_name"`
	// Number of checkpoints saved during training
	NCheckpoints int64 `json:"n_checkpoints"`
	// Number of training epochs
	NEpochs int64 `json:"n_epochs"`
	// Number of evaluations during training
	NEvals int64 `json:"n_evals"`
	// Owner address information
	OwnerAddress string `json:"owner_address"`
	// Suffix added to the fine-tuned model name
	Suffix string `json:"suffix"`
	// Count of tokens processed
	TokenCount int64 `json:"token_count"`
	// Total price for the fine-tuning job
	TotalPrice int64 `json:"total_price"`
	// File-ID of the training file
	TrainingFile string `json:"training_file"`
	// Method of training used
	TrainingMethod FineTuningListResponseDataTrainingMethodUnion `json:"training_method"`
	// Type of training used (full or LoRA)
	TrainingType FineTuningListResponseDataTrainingTypeUnion `json:"training_type"`
	// Identifier for the user who created the job
	UserID string `json:"user_id"`
	// File-ID of the validation file
	ValidationFile string `json:"validation_file"`
	// Weights & Biases run name
	WandbName string `json:"wandb_name"`
	// Weights & Biases project name
	WandbProjectName string `json:"wandb_project_name"`
	// Ratio of warmup steps
	WarmupRatio float64 `json:"warmup_ratio"`
	// Weight decay value used
	WeightDecay float64 `json:"weight_decay"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		CreatedAt        respjson.Field
		Status           respjson.Field
		UpdatedAt        respjson.Field
		BatchSize        respjson.Field
		Events           respjson.Field
		FromCheckpoint   respjson.Field
		FromHfModel      respjson.Field
		HfModelRevision  respjson.Field
		LearningRate     respjson.Field
		LrScheduler      respjson.Field
		MaxGradNorm      respjson.Field
		Model            respjson.Field
		ModelOutputName  respjson.Field
		NCheckpoints     respjson.Field
		NEpochs          respjson.Field
		NEvals           respjson.Field
		OwnerAddress     respjson.Field
		Suffix           respjson.Field
		TokenCount       respjson.Field
		TotalPrice       respjson.Field
		TrainingFile     respjson.Field
		TrainingMethod   respjson.Field
		TrainingType     respjson.Field
		UserID           respjson.Field
		ValidationFile   respjson.Field
		WandbName        respjson.Field
		WandbProjectName respjson.Field
		WarmupRatio      respjson.Field
		WeightDecay      respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A truncated version of the fine-tune response, used for POST /fine-tunes, GET /fine-tunes and POST /fine-tunes/{id}/cancel endpoints

func (FineTuningListResponseData) RawJSON

func (r FineTuningListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuningListResponseData) UnmarshalJSON

func (r *FineTuningListResponseData) UnmarshalJSON(data []byte) error

type FineTuningListResponseDataLrScheduler

type FineTuningListResponseDataLrScheduler struct {
	// Any of "linear", "cosine".
	LrSchedulerType string                                                    `json:"lr_scheduler_type,required"`
	LrSchedulerArgs FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion `json:"lr_scheduler_args"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LrSchedulerType respjson.Field
		LrSchedulerArgs respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Learning rate scheduler configuration

func (FineTuningListResponseDataLrScheduler) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataLrScheduler) UnmarshalJSON

func (r *FineTuningListResponseDataLrScheduler) UnmarshalJSON(data []byte) error

type FineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

type FineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio,required"`
	// Number or fraction of cycles for the cosine learning rate scheduler
	NumCycles float64 `json:"num_cycles,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinLrRatio  respjson.Field
		NumCycles   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) UnmarshalJSON

type FineTuningListResponseDataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

type FineTuningListResponseDataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinLrRatio  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListResponseDataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) UnmarshalJSON

type FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion

type FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion struct {
	MinLrRatio float64 `json:"min_lr_ratio"`
	// This field is from variant
	// [FineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs].
	NumCycles float64 `json:"num_cycles"`
	JSON      struct {
		MinLrRatio respjson.Field
		NumCycles  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion contains all possible properties and values from FineTuningListResponseDataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs, FineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion) AsFineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

func (u FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion) AsFineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs() (v FineTuningListResponseDataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs)

func (FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion) AsFineTuningListResponseDataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

func (u FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion) AsFineTuningListResponseDataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs() (v FineTuningListResponseDataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs)

func (FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataLrSchedulerLrSchedulerArgsUnion) UnmarshalJSON

type FineTuningListResponseDataTrainingMethodTrainingMethodDpo

type FineTuningListResponseDataTrainingMethodTrainingMethodDpo struct {
	// Any of "dpo".
	Method                        string  `json:"method,required"`
	DpoBeta                       float64 `json:"dpo_beta"`
	DpoNormalizeLogratiosByLength bool    `json:"dpo_normalize_logratios_by_length"`
	DpoReferenceFree              bool    `json:"dpo_reference_free"`
	RpoAlpha                      float64 `json:"rpo_alpha"`
	SimpoGamma                    float64 `json:"simpo_gamma"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method                        respjson.Field
		DpoBeta                       respjson.Field
		DpoNormalizeLogratiosByLength respjson.Field
		DpoReferenceFree              respjson.Field
		RpoAlpha                      respjson.Field
		SimpoGamma                    respjson.Field
		ExtraFields                   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListResponseDataTrainingMethodTrainingMethodDpo) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataTrainingMethodTrainingMethodDpo) UnmarshalJSON

type FineTuningListResponseDataTrainingMethodTrainingMethodSft

type FineTuningListResponseDataTrainingMethodTrainingMethodSft struct {
	// Any of "sft".
	Method string `json:"method,required"`
	// Whether to mask the user messages in conversational data or prompts in
	// instruction data.
	TrainOnInputs FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method        respjson.Field
		TrainOnInputs respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListResponseDataTrainingMethodTrainingMethodSft) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataTrainingMethodTrainingMethodSft) UnmarshalJSON

type FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsString

type FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsString string
const (
	FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsStringAuto FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsString = "auto"
)

type FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion

type FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion struct {
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfFineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsString string `json:",inline"`
	JSON                                                                           struct {
		OfBool                                                                         respjson.Field
		OfFineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion contains all possible properties and values from [bool], [string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfBool OfFineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsString]

func (FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsBool

func (FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsFineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsString

func (u FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsFineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsString() (v string)

func (FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion) UnmarshalJSON

type FineTuningListResponseDataTrainingMethodUnion

type FineTuningListResponseDataTrainingMethodUnion struct {
	Method string `json:"method"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingMethodTrainingMethodSft].
	TrainOnInputs FineTuningListResponseDataTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingMethodTrainingMethodDpo].
	DpoBeta float64 `json:"dpo_beta"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingMethodTrainingMethodDpo].
	DpoNormalizeLogratiosByLength bool `json:"dpo_normalize_logratios_by_length"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingMethodTrainingMethodDpo].
	DpoReferenceFree bool `json:"dpo_reference_free"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingMethodTrainingMethodDpo].
	RpoAlpha float64 `json:"rpo_alpha"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingMethodTrainingMethodDpo].
	SimpoGamma float64 `json:"simpo_gamma"`
	JSON       struct {
		Method                        respjson.Field
		TrainOnInputs                 respjson.Field
		DpoBeta                       respjson.Field
		DpoNormalizeLogratiosByLength respjson.Field
		DpoReferenceFree              respjson.Field
		RpoAlpha                      respjson.Field
		SimpoGamma                    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningListResponseDataTrainingMethodUnion contains all possible properties and values from FineTuningListResponseDataTrainingMethodTrainingMethodSft, FineTuningListResponseDataTrainingMethodTrainingMethodDpo.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningListResponseDataTrainingMethodUnion) AsFineTuningListResponseDataTrainingMethodTrainingMethodDpo

func (u FineTuningListResponseDataTrainingMethodUnion) AsFineTuningListResponseDataTrainingMethodTrainingMethodDpo() (v FineTuningListResponseDataTrainingMethodTrainingMethodDpo)

func (FineTuningListResponseDataTrainingMethodUnion) AsFineTuningListResponseDataTrainingMethodTrainingMethodSft

func (u FineTuningListResponseDataTrainingMethodUnion) AsFineTuningListResponseDataTrainingMethodTrainingMethodSft() (v FineTuningListResponseDataTrainingMethodTrainingMethodSft)

func (FineTuningListResponseDataTrainingMethodUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataTrainingMethodUnion) UnmarshalJSON

func (r *FineTuningListResponseDataTrainingMethodUnion) UnmarshalJSON(data []byte) error

type FineTuningListResponseDataTrainingTypeFullTrainingType

type FineTuningListResponseDataTrainingTypeFullTrainingType struct {
	// Any of "Full".
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListResponseDataTrainingTypeFullTrainingType) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataTrainingTypeFullTrainingType) UnmarshalJSON

type FineTuningListResponseDataTrainingTypeLoRaTrainingType

type FineTuningListResponseDataTrainingTypeLoRaTrainingType struct {
	LoraAlpha int64 `json:"lora_alpha,required"`
	LoraR     int64 `json:"lora_r,required"`
	// Any of "Lora".
	Type                 string  `json:"type,required"`
	LoraDropout          float64 `json:"lora_dropout"`
	LoraTrainableModules string  `json:"lora_trainable_modules"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LoraAlpha            respjson.Field
		LoraR                respjson.Field
		Type                 respjson.Field
		LoraDropout          respjson.Field
		LoraTrainableModules respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningListResponseDataTrainingTypeLoRaTrainingType) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataTrainingTypeLoRaTrainingType) UnmarshalJSON

type FineTuningListResponseDataTrainingTypeUnion

type FineTuningListResponseDataTrainingTypeUnion struct {
	Type string `json:"type"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingTypeLoRaTrainingType].
	LoraAlpha int64 `json:"lora_alpha"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingTypeLoRaTrainingType].
	LoraR int64 `json:"lora_r"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingTypeLoRaTrainingType].
	LoraDropout float64 `json:"lora_dropout"`
	// This field is from variant
	// [FineTuningListResponseDataTrainingTypeLoRaTrainingType].
	LoraTrainableModules string `json:"lora_trainable_modules"`
	JSON                 struct {
		Type                 respjson.Field
		LoraAlpha            respjson.Field
		LoraR                respjson.Field
		LoraDropout          respjson.Field
		LoraTrainableModules respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningListResponseDataTrainingTypeUnion contains all possible properties and values from FineTuningListResponseDataTrainingTypeFullTrainingType, FineTuningListResponseDataTrainingTypeLoRaTrainingType.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningListResponseDataTrainingTypeUnion) AsFineTuningListResponseDataTrainingTypeFullTrainingType

func (u FineTuningListResponseDataTrainingTypeUnion) AsFineTuningListResponseDataTrainingTypeFullTrainingType() (v FineTuningListResponseDataTrainingTypeFullTrainingType)

func (FineTuningListResponseDataTrainingTypeUnion) AsFineTuningListResponseDataTrainingTypeLoRaTrainingType

func (u FineTuningListResponseDataTrainingTypeUnion) AsFineTuningListResponseDataTrainingTypeLoRaTrainingType() (v FineTuningListResponseDataTrainingTypeLoRaTrainingType)

func (FineTuningListResponseDataTrainingTypeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningListResponseDataTrainingTypeUnion) UnmarshalJSON

func (r *FineTuningListResponseDataTrainingTypeUnion) UnmarshalJSON(data []byte) error

type FineTuningNewParams

type FineTuningNewParams struct {
	// Name of the base model to run fine-tune job on
	Model string `json:"model,required"`
	// File-ID of a training file uploaded to the Together API
	TrainingFile string `json:"training_file,required"`
	// The checkpoint identifier to continue training from a previous fine-tuning job.
	// Format is `{$JOB_ID}` or `{$OUTPUT_MODEL_NAME}` or `{$JOB_ID}:{$STEP}` or
	// `{$OUTPUT_MODEL_NAME}:{$STEP}`. The step value is optional; without it, the
	// final checkpoint will be used.
	FromCheckpoint param.Opt[string] `json:"from_checkpoint,omitzero"`
	// The Hugging Face Hub repo to start training from. Should be as close as possible
	// to the base model (specified by the `model` argument) in terms of architecture
	// and size.
	FromHfModel param.Opt[string] `json:"from_hf_model,omitzero"`
	// The API token for the Hugging Face Hub.
	HfAPIToken param.Opt[string] `json:"hf_api_token,omitzero"`
	// The revision of the Hugging Face Hub model to continue training from. E.g.,
	// hf_model_revision=main (default, used if the argument is not provided) or
	// hf_model_revision='607a30d783dfa663caf39e06633721c8d4cfcd7e' (specific commit).
	HfModelRevision param.Opt[string] `json:"hf_model_revision,omitzero"`
	// The name of the Hugging Face repository to upload the fine-tuned model to.
	HfOutputRepoName param.Opt[string] `json:"hf_output_repo_name,omitzero"`
	// Controls how quickly the model adapts to new information (too high may cause
	// instability, too low may slow convergence)
	LearningRate param.Opt[float64] `json:"learning_rate,omitzero"`
	// Max gradient norm to be used for gradient clipping. Set to 0 to disable.
	MaxGradNorm param.Opt[float64] `json:"max_grad_norm,omitzero"`
	// Number of intermediate model versions saved during training for evaluation
	NCheckpoints param.Opt[int64] `json:"n_checkpoints,omitzero"`
	// Number of complete passes through the training dataset (higher values may
	// improve results but increase cost and risk of overfitting)
	NEpochs param.Opt[int64] `json:"n_epochs,omitzero"`
	// Number of evaluations to be run on a given validation set during training
	NEvals param.Opt[int64] `json:"n_evals,omitzero"`
	// Suffix that will be added to your fine-tuned model name
	Suffix param.Opt[string] `json:"suffix,omitzero"`
	// File-ID of a validation file uploaded to the Together API
	ValidationFile param.Opt[string] `json:"validation_file,omitzero"`
	// Integration key for tracking experiments and model metrics on W&B platform
	WandbAPIKey param.Opt[string] `json:"wandb_api_key,omitzero"`
	// The base URL of a dedicated Weights & Biases instance.
	WandbBaseURL param.Opt[string] `json:"wandb_base_url,omitzero"`
	// The Weights & Biases name for your run.
	WandbName param.Opt[string] `json:"wandb_name,omitzero"`
	// The Weights & Biases project for your run. If not specified, will use `together`
	// as the project name.
	WandbProjectName param.Opt[string] `json:"wandb_project_name,omitzero"`
	// The percent of steps at the start of training to linearly increase the learning
	// rate.
	WarmupRatio param.Opt[float64] `json:"warmup_ratio,omitzero"`
	// Weight decay. Regularization parameter for the optimizer.
	WeightDecay param.Opt[float64] `json:"weight_decay,omitzero"`
	// Number of training examples processed together (larger batches use more memory
	// but may train faster). Defaults to "max". We use training optimizations like
	// packing, so the effective batch size may be different than the value you set.
	BatchSize FineTuningNewParamsBatchSizeUnion `json:"batch_size,omitzero"`
	// The learning rate scheduler to use. It specifies how the learning rate is
	// adjusted during training.
	LrScheduler FineTuningNewParamsLrScheduler `json:"lr_scheduler,omitzero"`
	// Whether to mask the user messages in conversational data or prompts in
	// instruction data.
	TrainOnInputs FineTuningNewParamsTrainOnInputsUnion `json:"train_on_inputs,omitzero"`
	// The training method to use. 'sft' for Supervised Fine-Tuning or 'dpo' for Direct
	// Preference Optimization.
	TrainingMethod FineTuningNewParamsTrainingMethodUnion `json:"training_method,omitzero"`
	TrainingType   FineTuningNewParamsTrainingTypeUnion   `json:"training_type,omitzero"`
	// contains filtered or unexported fields
}

func (FineTuningNewParams) MarshalJSON

func (r FineTuningNewParams) MarshalJSON() (data []byte, err error)

func (*FineTuningNewParams) UnmarshalJSON

func (r *FineTuningNewParams) UnmarshalJSON(data []byte) error

type FineTuningNewParamsBatchSizeString

type FineTuningNewParamsBatchSizeString string
const (
	FineTuningNewParamsBatchSizeStringMax FineTuningNewParamsBatchSizeString = "max"
)

type FineTuningNewParamsBatchSizeUnion

type FineTuningNewParamsBatchSizeUnion struct {
	OfInt param.Opt[int64] `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfFineTuningNewsBatchSizeString)
	OfFineTuningNewsBatchSizeString param.Opt[string] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (FineTuningNewParamsBatchSizeUnion) MarshalJSON

func (u FineTuningNewParamsBatchSizeUnion) MarshalJSON() ([]byte, error)

func (*FineTuningNewParamsBatchSizeUnion) UnmarshalJSON

func (u *FineTuningNewParamsBatchSizeUnion) UnmarshalJSON(data []byte) error

type FineTuningNewParamsLrScheduler

type FineTuningNewParamsLrScheduler struct {
	// Any of "linear", "cosine".
	LrSchedulerType string                                             `json:"lr_scheduler_type,omitzero,required"`
	LrSchedulerArgs FineTuningNewParamsLrSchedulerLrSchedulerArgsUnion `json:"lr_scheduler_args,omitzero"`
	// contains filtered or unexported fields
}

The learning rate scheduler to use. It specifies how the learning rate is adjusted during training.

The property LrSchedulerType is required.

func (FineTuningNewParamsLrScheduler) MarshalJSON

func (r FineTuningNewParamsLrScheduler) MarshalJSON() (data []byte, err error)

func (*FineTuningNewParamsLrScheduler) UnmarshalJSON

func (r *FineTuningNewParamsLrScheduler) UnmarshalJSON(data []byte) error

type FineTuningNewParamsLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

type FineTuningNewParamsLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio,required"`
	// Number or fraction of cycles for the cosine learning rate scheduler
	NumCycles float64 `json:"num_cycles,required"`
	// contains filtered or unexported fields
}

The properties MinLrRatio, NumCycles are required.

func (FineTuningNewParamsLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) MarshalJSON

func (*FineTuningNewParamsLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) UnmarshalJSON

type FineTuningNewParamsLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

type FineTuningNewParamsLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio param.Opt[float64] `json:"min_lr_ratio,omitzero"`
	// contains filtered or unexported fields
}

func (FineTuningNewParamsLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) MarshalJSON

func (*FineTuningNewParamsLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) UnmarshalJSON

type FineTuningNewParamsLrSchedulerLrSchedulerArgsUnion

type FineTuningNewParamsLrSchedulerLrSchedulerArgsUnion struct {
	OfFineTuningNewsLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs *FineTuningNewParamsLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs `json:",omitzero,inline"`
	OfFineTuningNewsLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs *FineTuningNewParamsLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (FineTuningNewParamsLrSchedulerLrSchedulerArgsUnion) GetMinLrRatio

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsLrSchedulerLrSchedulerArgsUnion) GetNumCycles

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsLrSchedulerLrSchedulerArgsUnion) MarshalJSON

func (*FineTuningNewParamsLrSchedulerLrSchedulerArgsUnion) UnmarshalJSON

type FineTuningNewParamsTrainOnInputsString

type FineTuningNewParamsTrainOnInputsString string
const (
	FineTuningNewParamsTrainOnInputsStringAuto FineTuningNewParamsTrainOnInputsString = "auto"
)

type FineTuningNewParamsTrainOnInputsUnion

type FineTuningNewParamsTrainOnInputsUnion struct {
	OfBool param.Opt[bool] `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfFineTuningNewsTrainOnInputsString)
	OfFineTuningNewsTrainOnInputsString param.Opt[string] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (FineTuningNewParamsTrainOnInputsUnion) MarshalJSON

func (u FineTuningNewParamsTrainOnInputsUnion) MarshalJSON() ([]byte, error)

func (*FineTuningNewParamsTrainOnInputsUnion) UnmarshalJSON

func (u *FineTuningNewParamsTrainOnInputsUnion) UnmarshalJSON(data []byte) error

type FineTuningNewParamsTrainingMethodTrainingMethodDpo

type FineTuningNewParamsTrainingMethodTrainingMethodDpo struct {
	// Any of "dpo".
	Method                        string             `json:"method,omitzero,required"`
	DpoBeta                       param.Opt[float64] `json:"dpo_beta,omitzero"`
	DpoNormalizeLogratiosByLength param.Opt[bool]    `json:"dpo_normalize_logratios_by_length,omitzero"`
	DpoReferenceFree              param.Opt[bool]    `json:"dpo_reference_free,omitzero"`
	RpoAlpha                      param.Opt[float64] `json:"rpo_alpha,omitzero"`
	SimpoGamma                    param.Opt[float64] `json:"simpo_gamma,omitzero"`
	// contains filtered or unexported fields
}

The property Method is required.

func (FineTuningNewParamsTrainingMethodTrainingMethodDpo) MarshalJSON

func (r FineTuningNewParamsTrainingMethodTrainingMethodDpo) MarshalJSON() (data []byte, err error)

func (*FineTuningNewParamsTrainingMethodTrainingMethodDpo) UnmarshalJSON

type FineTuningNewParamsTrainingMethodTrainingMethodSft

type FineTuningNewParamsTrainingMethodTrainingMethodSft struct {
	// Any of "sft".
	Method string `json:"method,omitzero,required"`
	// Whether to mask the user messages in conversational data or prompts in
	// instruction data.
	TrainOnInputs FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs,omitzero,required"`
	// contains filtered or unexported fields
}

The properties Method, TrainOnInputs are required.

func (FineTuningNewParamsTrainingMethodTrainingMethodSft) MarshalJSON

func (r FineTuningNewParamsTrainingMethodTrainingMethodSft) MarshalJSON() (data []byte, err error)

func (*FineTuningNewParamsTrainingMethodTrainingMethodSft) UnmarshalJSON

type FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsString

type FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsString string
const (
	FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsStringAuto FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsString = "auto"
)

type FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsUnion

type FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsUnion struct {
	OfBool param.Opt[bool] `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfFineTuningNewsTrainingMethodTrainingMethodSftTrainOnInputsString)
	OfFineTuningNewsTrainingMethodTrainingMethodSftTrainOnInputsString param.Opt[string] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsUnion) MarshalJSON

func (*FineTuningNewParamsTrainingMethodTrainingMethodSftTrainOnInputsUnion) UnmarshalJSON

type FineTuningNewParamsTrainingMethodUnion

type FineTuningNewParamsTrainingMethodUnion struct {
	OfFineTuningNewsTrainingMethodTrainingMethodSft *FineTuningNewParamsTrainingMethodTrainingMethodSft `json:",omitzero,inline"`
	OfFineTuningNewsTrainingMethodTrainingMethodDpo *FineTuningNewParamsTrainingMethodTrainingMethodDpo `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (FineTuningNewParamsTrainingMethodUnion) GetDpoBeta

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingMethodUnion) GetDpoNormalizeLogratiosByLength

func (u FineTuningNewParamsTrainingMethodUnion) GetDpoNormalizeLogratiosByLength() *bool

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingMethodUnion) GetDpoReferenceFree

func (u FineTuningNewParamsTrainingMethodUnion) GetDpoReferenceFree() *bool

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingMethodUnion) GetMethod

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingMethodUnion) GetRpoAlpha

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingMethodUnion) GetSimpoGamma

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingMethodUnion) GetTrainOnInputs

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingMethodUnion) MarshalJSON

func (u FineTuningNewParamsTrainingMethodUnion) MarshalJSON() ([]byte, error)

func (*FineTuningNewParamsTrainingMethodUnion) UnmarshalJSON

func (u *FineTuningNewParamsTrainingMethodUnion) UnmarshalJSON(data []byte) error

type FineTuningNewParamsTrainingTypeFullTrainingType

type FineTuningNewParamsTrainingTypeFullTrainingType struct {
	// Any of "Full".
	Type string `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

The property Type is required.

func (FineTuningNewParamsTrainingTypeFullTrainingType) MarshalJSON

func (r FineTuningNewParamsTrainingTypeFullTrainingType) MarshalJSON() (data []byte, err error)

func (*FineTuningNewParamsTrainingTypeFullTrainingType) UnmarshalJSON

type FineTuningNewParamsTrainingTypeLoRaTrainingType

type FineTuningNewParamsTrainingTypeLoRaTrainingType struct {
	LoraAlpha int64 `json:"lora_alpha,required"`
	LoraR     int64 `json:"lora_r,required"`
	// Any of "Lora".
	Type                 string             `json:"type,omitzero,required"`
	LoraDropout          param.Opt[float64] `json:"lora_dropout,omitzero"`
	LoraTrainableModules param.Opt[string]  `json:"lora_trainable_modules,omitzero"`
	// contains filtered or unexported fields
}

The properties LoraAlpha, LoraR, Type are required.

func (FineTuningNewParamsTrainingTypeLoRaTrainingType) MarshalJSON

func (r FineTuningNewParamsTrainingTypeLoRaTrainingType) MarshalJSON() (data []byte, err error)

func (*FineTuningNewParamsTrainingTypeLoRaTrainingType) UnmarshalJSON

type FineTuningNewParamsTrainingTypeUnion

type FineTuningNewParamsTrainingTypeUnion struct {
	OfFineTuningNewsTrainingTypeFullTrainingType *FineTuningNewParamsTrainingTypeFullTrainingType `json:",omitzero,inline"`
	OfFineTuningNewsTrainingTypeLoRaTrainingType *FineTuningNewParamsTrainingTypeLoRaTrainingType `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (FineTuningNewParamsTrainingTypeUnion) GetLoraAlpha

func (u FineTuningNewParamsTrainingTypeUnion) GetLoraAlpha() *int64

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingTypeUnion) GetLoraDropout

func (u FineTuningNewParamsTrainingTypeUnion) GetLoraDropout() *float64

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingTypeUnion) GetLoraR

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingTypeUnion) GetLoraTrainableModules

func (u FineTuningNewParamsTrainingTypeUnion) GetLoraTrainableModules() *string

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingTypeUnion) GetType

Returns a pointer to the underlying variant's property, if present.

func (FineTuningNewParamsTrainingTypeUnion) MarshalJSON

func (u FineTuningNewParamsTrainingTypeUnion) MarshalJSON() ([]byte, error)

func (*FineTuningNewParamsTrainingTypeUnion) UnmarshalJSON

func (u *FineTuningNewParamsTrainingTypeUnion) UnmarshalJSON(data []byte) error

type FineTuningNewResponse

type FineTuningNewResponse struct {
	// Unique identifier for the fine-tune job
	ID string `json:"id,required"`
	// Creation timestamp of the fine-tune job
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Any of "pending", "queued", "running", "compressing", "uploading",
	// "cancel_requested", "cancelled", "error", "completed".
	Status FineTuningNewResponseStatus `json:"status,required"`
	// Last update timestamp of the fine-tune job
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// Batch size used for training
	BatchSize int64 `json:"batch_size"`
	// Events related to this fine-tune job
	Events []FinetuneEvent `json:"events"`
	// Checkpoint used to continue training
	FromCheckpoint string `json:"from_checkpoint"`
	// Hugging Face Hub repo to start training from
	FromHfModel string `json:"from_hf_model"`
	// The revision of the Hugging Face Hub model to continue training from
	HfModelRevision string `json:"hf_model_revision"`
	// Learning rate used for training
	LearningRate float64 `json:"learning_rate"`
	// Learning rate scheduler configuration
	LrScheduler FineTuningNewResponseLrScheduler `json:"lr_scheduler"`
	// Maximum gradient norm for clipping
	MaxGradNorm float64 `json:"max_grad_norm"`
	// Base model used for fine-tuning
	Model           string `json:"model"`
	ModelOutputName string `json:"model_output_name"`
	// Number of checkpoints saved during training
	NCheckpoints int64 `json:"n_checkpoints"`
	// Number of training epochs
	NEpochs int64 `json:"n_epochs"`
	// Number of evaluations during training
	NEvals int64 `json:"n_evals"`
	// Owner address information
	OwnerAddress string `json:"owner_address"`
	// Suffix added to the fine-tuned model name
	Suffix string `json:"suffix"`
	// Count of tokens processed
	TokenCount int64 `json:"token_count"`
	// Total price for the fine-tuning job
	TotalPrice int64 `json:"total_price"`
	// File-ID of the training file
	TrainingFile string `json:"training_file"`
	// Method of training used
	TrainingMethod FineTuningNewResponseTrainingMethodUnion `json:"training_method"`
	// Type of training used (full or LoRA)
	TrainingType FineTuningNewResponseTrainingTypeUnion `json:"training_type"`
	// Identifier for the user who created the job
	UserID string `json:"user_id"`
	// File-ID of the validation file
	ValidationFile string `json:"validation_file"`
	// Weights & Biases run name
	WandbName string `json:"wandb_name"`
	// Weights & Biases project name
	WandbProjectName string `json:"wandb_project_name"`
	// Ratio of warmup steps
	WarmupRatio float64 `json:"warmup_ratio"`
	// Weight decay value used
	WeightDecay float64 `json:"weight_decay"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		CreatedAt        respjson.Field
		Status           respjson.Field
		UpdatedAt        respjson.Field
		BatchSize        respjson.Field
		Events           respjson.Field
		FromCheckpoint   respjson.Field
		FromHfModel      respjson.Field
		HfModelRevision  respjson.Field
		LearningRate     respjson.Field
		LrScheduler      respjson.Field
		MaxGradNorm      respjson.Field
		Model            respjson.Field
		ModelOutputName  respjson.Field
		NCheckpoints     respjson.Field
		NEpochs          respjson.Field
		NEvals           respjson.Field
		OwnerAddress     respjson.Field
		Suffix           respjson.Field
		TokenCount       respjson.Field
		TotalPrice       respjson.Field
		TrainingFile     respjson.Field
		TrainingMethod   respjson.Field
		TrainingType     respjson.Field
		UserID           respjson.Field
		ValidationFile   respjson.Field
		WandbName        respjson.Field
		WandbProjectName respjson.Field
		WarmupRatio      respjson.Field
		WeightDecay      respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A truncated version of the fine-tune response, used for POST /fine-tunes, GET /fine-tunes and POST /fine-tunes/{id}/cancel endpoints

func (FineTuningNewResponse) RawJSON

func (r FineTuningNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuningNewResponse) UnmarshalJSON

func (r *FineTuningNewResponse) UnmarshalJSON(data []byte) error

type FineTuningNewResponseLrScheduler

type FineTuningNewResponseLrScheduler struct {
	// Any of "linear", "cosine".
	LrSchedulerType string                                               `json:"lr_scheduler_type,required"`
	LrSchedulerArgs FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion `json:"lr_scheduler_args"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LrSchedulerType respjson.Field
		LrSchedulerArgs respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Learning rate scheduler configuration

func (FineTuningNewResponseLrScheduler) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseLrScheduler) UnmarshalJSON

func (r *FineTuningNewResponseLrScheduler) UnmarshalJSON(data []byte) error

type FineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

type FineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio,required"`
	// Number or fraction of cycles for the cosine learning rate scheduler
	NumCycles float64 `json:"num_cycles,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinLrRatio  respjson.Field
		NumCycles   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) UnmarshalJSON

type FineTuningNewResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

type FineTuningNewResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinLrRatio  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningNewResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) UnmarshalJSON

type FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion

type FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion struct {
	MinLrRatio float64 `json:"min_lr_ratio"`
	// This field is from variant
	// [FineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs].
	NumCycles float64 `json:"num_cycles"`
	JSON      struct {
		MinLrRatio respjson.Field
		NumCycles  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion contains all possible properties and values from FineTuningNewResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs, FineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion) AsFineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

func (u FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion) AsFineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs() (v FineTuningNewResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs)

func (FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion) AsFineTuningNewResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

func (u FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion) AsFineTuningNewResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs() (v FineTuningNewResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs)

func (FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseLrSchedulerLrSchedulerArgsUnion) UnmarshalJSON

type FineTuningNewResponseStatus

type FineTuningNewResponseStatus string
const (
	FineTuningNewResponseStatusPending         FineTuningNewResponseStatus = "pending"
	FineTuningNewResponseStatusQueued          FineTuningNewResponseStatus = "queued"
	FineTuningNewResponseStatusRunning         FineTuningNewResponseStatus = "running"
	FineTuningNewResponseStatusCompressing     FineTuningNewResponseStatus = "compressing"
	FineTuningNewResponseStatusUploading       FineTuningNewResponseStatus = "uploading"
	FineTuningNewResponseStatusCancelRequested FineTuningNewResponseStatus = "cancel_requested"
	FineTuningNewResponseStatusCancelled       FineTuningNewResponseStatus = "cancelled"
	FineTuningNewResponseStatusError           FineTuningNewResponseStatus = "error"
	FineTuningNewResponseStatusCompleted       FineTuningNewResponseStatus = "completed"
)

type FineTuningNewResponseTrainingMethodTrainingMethodDpo

type FineTuningNewResponseTrainingMethodTrainingMethodDpo struct {
	// Any of "dpo".
	Method                        string  `json:"method,required"`
	DpoBeta                       float64 `json:"dpo_beta"`
	DpoNormalizeLogratiosByLength bool    `json:"dpo_normalize_logratios_by_length"`
	DpoReferenceFree              bool    `json:"dpo_reference_free"`
	RpoAlpha                      float64 `json:"rpo_alpha"`
	SimpoGamma                    float64 `json:"simpo_gamma"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method                        respjson.Field
		DpoBeta                       respjson.Field
		DpoNormalizeLogratiosByLength respjson.Field
		DpoReferenceFree              respjson.Field
		RpoAlpha                      respjson.Field
		SimpoGamma                    respjson.Field
		ExtraFields                   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningNewResponseTrainingMethodTrainingMethodDpo) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseTrainingMethodTrainingMethodDpo) UnmarshalJSON

type FineTuningNewResponseTrainingMethodTrainingMethodSft

type FineTuningNewResponseTrainingMethodTrainingMethodSft struct {
	// Any of "sft".
	Method string `json:"method,required"`
	// Whether to mask the user messages in conversational data or prompts in
	// instruction data.
	TrainOnInputs FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method        respjson.Field
		TrainOnInputs respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningNewResponseTrainingMethodTrainingMethodSft) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseTrainingMethodTrainingMethodSft) UnmarshalJSON

type FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsString

type FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsString string
const (
	FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsStringAuto FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsString = "auto"
)

type FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion

type FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion struct {
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfFineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsString string `json:",inline"`
	JSON                                                                      struct {
		OfBool                                                                    respjson.Field
		OfFineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion contains all possible properties and values from [bool], [string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfBool OfFineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsString]

func (FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsBool

func (FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsFineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsString

func (u FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsFineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsString() (v string)

func (FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) UnmarshalJSON

type FineTuningNewResponseTrainingMethodUnion

type FineTuningNewResponseTrainingMethodUnion struct {
	Method string `json:"method"`
	// This field is from variant
	// [FineTuningNewResponseTrainingMethodTrainingMethodSft].
	TrainOnInputs FineTuningNewResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs"`
	// This field is from variant
	// [FineTuningNewResponseTrainingMethodTrainingMethodDpo].
	DpoBeta float64 `json:"dpo_beta"`
	// This field is from variant
	// [FineTuningNewResponseTrainingMethodTrainingMethodDpo].
	DpoNormalizeLogratiosByLength bool `json:"dpo_normalize_logratios_by_length"`
	// This field is from variant
	// [FineTuningNewResponseTrainingMethodTrainingMethodDpo].
	DpoReferenceFree bool `json:"dpo_reference_free"`
	// This field is from variant
	// [FineTuningNewResponseTrainingMethodTrainingMethodDpo].
	RpoAlpha float64 `json:"rpo_alpha"`
	// This field is from variant
	// [FineTuningNewResponseTrainingMethodTrainingMethodDpo].
	SimpoGamma float64 `json:"simpo_gamma"`
	JSON       struct {
		Method                        respjson.Field
		TrainOnInputs                 respjson.Field
		DpoBeta                       respjson.Field
		DpoNormalizeLogratiosByLength respjson.Field
		DpoReferenceFree              respjson.Field
		RpoAlpha                      respjson.Field
		SimpoGamma                    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningNewResponseTrainingMethodUnion contains all possible properties and values from FineTuningNewResponseTrainingMethodTrainingMethodSft, FineTuningNewResponseTrainingMethodTrainingMethodDpo.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningNewResponseTrainingMethodUnion) AsFineTuningNewResponseTrainingMethodTrainingMethodDpo

func (u FineTuningNewResponseTrainingMethodUnion) AsFineTuningNewResponseTrainingMethodTrainingMethodDpo() (v FineTuningNewResponseTrainingMethodTrainingMethodDpo)

func (FineTuningNewResponseTrainingMethodUnion) AsFineTuningNewResponseTrainingMethodTrainingMethodSft

func (u FineTuningNewResponseTrainingMethodUnion) AsFineTuningNewResponseTrainingMethodTrainingMethodSft() (v FineTuningNewResponseTrainingMethodTrainingMethodSft)

func (FineTuningNewResponseTrainingMethodUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseTrainingMethodUnion) UnmarshalJSON

func (r *FineTuningNewResponseTrainingMethodUnion) UnmarshalJSON(data []byte) error

type FineTuningNewResponseTrainingTypeFullTrainingType

type FineTuningNewResponseTrainingTypeFullTrainingType struct {
	// Any of "Full".
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningNewResponseTrainingTypeFullTrainingType) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseTrainingTypeFullTrainingType) UnmarshalJSON

type FineTuningNewResponseTrainingTypeLoRaTrainingType

type FineTuningNewResponseTrainingTypeLoRaTrainingType struct {
	LoraAlpha int64 `json:"lora_alpha,required"`
	LoraR     int64 `json:"lora_r,required"`
	// Any of "Lora".
	Type                 string  `json:"type,required"`
	LoraDropout          float64 `json:"lora_dropout"`
	LoraTrainableModules string  `json:"lora_trainable_modules"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LoraAlpha            respjson.Field
		LoraR                respjson.Field
		Type                 respjson.Field
		LoraDropout          respjson.Field
		LoraTrainableModules respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuningNewResponseTrainingTypeLoRaTrainingType) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseTrainingTypeLoRaTrainingType) UnmarshalJSON

type FineTuningNewResponseTrainingTypeUnion

type FineTuningNewResponseTrainingTypeUnion struct {
	Type string `json:"type"`
	// This field is from variant [FineTuningNewResponseTrainingTypeLoRaTrainingType].
	LoraAlpha int64 `json:"lora_alpha"`
	// This field is from variant [FineTuningNewResponseTrainingTypeLoRaTrainingType].
	LoraR int64 `json:"lora_r"`
	// This field is from variant [FineTuningNewResponseTrainingTypeLoRaTrainingType].
	LoraDropout float64 `json:"lora_dropout"`
	// This field is from variant [FineTuningNewResponseTrainingTypeLoRaTrainingType].
	LoraTrainableModules string `json:"lora_trainable_modules"`
	JSON                 struct {
		Type                 respjson.Field
		LoraAlpha            respjson.Field
		LoraR                respjson.Field
		LoraDropout          respjson.Field
		LoraTrainableModules respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuningNewResponseTrainingTypeUnion contains all possible properties and values from FineTuningNewResponseTrainingTypeFullTrainingType, FineTuningNewResponseTrainingTypeLoRaTrainingType.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FineTuningNewResponseTrainingTypeUnion) AsFineTuningNewResponseTrainingTypeFullTrainingType

func (u FineTuningNewResponseTrainingTypeUnion) AsFineTuningNewResponseTrainingTypeFullTrainingType() (v FineTuningNewResponseTrainingTypeFullTrainingType)

func (FineTuningNewResponseTrainingTypeUnion) AsFineTuningNewResponseTrainingTypeLoRaTrainingType

func (u FineTuningNewResponseTrainingTypeUnion) AsFineTuningNewResponseTrainingTypeLoRaTrainingType() (v FineTuningNewResponseTrainingTypeLoRaTrainingType)

func (FineTuningNewResponseTrainingTypeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuningNewResponseTrainingTypeUnion) UnmarshalJSON

func (r *FineTuningNewResponseTrainingTypeUnion) UnmarshalJSON(data []byte) error

type FineTuningService

type FineTuningService struct {
	Options []option.RequestOption
}

FineTuningService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFineTuningService method instead.

func NewFineTuningService

func NewFineTuningService(opts ...option.RequestOption) (r FineTuningService)

NewFineTuningService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FineTuningService) Cancel

Cancel a currently running fine-tuning job. Returns a FinetuneResponseTruncated object.

func (*FineTuningService) Content

func (r *FineTuningService) Content(ctx context.Context, query FineTuningContentParams, opts ...option.RequestOption) (res *http.Response, err error)

Receive a compressed fine-tuned model or checkpoint.

func (*FineTuningService) Delete

Delete a fine-tuning job.

func (*FineTuningService) Get

func (r *FineTuningService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *FinetuneResponse, err error)

List the metadata for a single fine-tuning job.

func (*FineTuningService) List

List the metadata for all fine-tuning jobs. Returns a list of FinetuneResponseTruncated objects.

func (*FineTuningService) ListCheckpoints

func (r *FineTuningService) ListCheckpoints(ctx context.Context, id string, opts ...option.RequestOption) (res *FineTuningListCheckpointsResponse, err error)

List the checkpoints for a single fine-tuning job.

func (*FineTuningService) ListEvents

func (r *FineTuningService) ListEvents(ctx context.Context, id string, opts ...option.RequestOption) (res *FineTuningListEventsResponse, err error)

List the events for a single fine-tuning job.

func (*FineTuningService) New

Create a fine-tuning job with the provided model and training data.

type FinetuneEvent

type FinetuneEvent struct {
	CheckpointPath string `json:"checkpoint_path,required"`
	CreatedAt      string `json:"created_at,required"`
	Hash           string `json:"hash,required"`
	Message        string `json:"message,required"`
	ModelPath      string `json:"model_path,required"`
	// Any of "fine-tune-event".
	Object         FinetuneEventObject `json:"object,required"`
	ParamCount     int64               `json:"param_count,required"`
	Step           int64               `json:"step,required"`
	TokenCount     int64               `json:"token_count,required"`
	TotalSteps     int64               `json:"total_steps,required"`
	TrainingOffset int64               `json:"training_offset,required"`
	// Any of "job_pending", "job_start", "job_stopped", "model_downloading",
	// "model_download_complete", "training_data_downloading",
	// "training_data_download_complete", "validation_data_downloading",
	// "validation_data_download_complete", "wandb_init", "training_start",
	// "checkpoint_save", "billing_limit", "epoch_complete", "training_complete",
	// "model_compressing", "model_compression_complete", "model_uploading",
	// "model_upload_complete", "job_complete", "job_error", "cancel_requested",
	// "job_restarted", "refund", "warning".
	Type     FinetuneEventType `json:"type,required"`
	WandbURL string            `json:"wandb_url,required"`
	// Any of "info", "warning", "error", "legacy_info", "legacy_iwarning",
	// "legacy_ierror".
	Level FinetuneEventLevel `json:"level,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CheckpointPath respjson.Field
		CreatedAt      respjson.Field
		Hash           respjson.Field
		Message        respjson.Field
		ModelPath      respjson.Field
		Object         respjson.Field
		ParamCount     respjson.Field
		Step           respjson.Field
		TokenCount     respjson.Field
		TotalSteps     respjson.Field
		TrainingOffset respjson.Field
		Type           respjson.Field
		WandbURL       respjson.Field
		Level          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneEvent) RawJSON

func (r FinetuneEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*FinetuneEvent) UnmarshalJSON

func (r *FinetuneEvent) UnmarshalJSON(data []byte) error

type FinetuneEventLevel

type FinetuneEventLevel string
const (
	FinetuneEventLevelInfo           FinetuneEventLevel = "info"
	FinetuneEventLevelWarning        FinetuneEventLevel = "warning"
	FinetuneEventLevelError          FinetuneEventLevel = "error"
	FinetuneEventLevelLegacyInfo     FinetuneEventLevel = "legacy_info"
	FinetuneEventLevelLegacyIwarning FinetuneEventLevel = "legacy_iwarning"
	FinetuneEventLevelLegacyIerror   FinetuneEventLevel = "legacy_ierror"
)

type FinetuneEventObject

type FinetuneEventObject string
const (
	FinetuneEventObjectFineTuneEvent FinetuneEventObject = "fine-tune-event"
)

type FinetuneEventType

type FinetuneEventType string
const (
	FinetuneEventTypeJobPending                     FinetuneEventType = "job_pending"
	FinetuneEventTypeJobStart                       FinetuneEventType = "job_start"
	FinetuneEventTypeJobStopped                     FinetuneEventType = "job_stopped"
	FinetuneEventTypeModelDownloading               FinetuneEventType = "model_downloading"
	FinetuneEventTypeModelDownloadComplete          FinetuneEventType = "model_download_complete"
	FinetuneEventTypeTrainingDataDownloading        FinetuneEventType = "training_data_downloading"
	FinetuneEventTypeTrainingDataDownloadComplete   FinetuneEventType = "training_data_download_complete"
	FinetuneEventTypeValidationDataDownloading      FinetuneEventType = "validation_data_downloading"
	FinetuneEventTypeValidationDataDownloadComplete FinetuneEventType = "validation_data_download_complete"
	FinetuneEventTypeWandbInit                      FinetuneEventType = "wandb_init"
	FinetuneEventTypeTrainingStart                  FinetuneEventType = "training_start"
	FinetuneEventTypeCheckpointSave                 FinetuneEventType = "checkpoint_save"
	FinetuneEventTypeBillingLimit                   FinetuneEventType = "billing_limit"
	FinetuneEventTypeEpochComplete                  FinetuneEventType = "epoch_complete"
	FinetuneEventTypeTrainingComplete               FinetuneEventType = "training_complete"
	FinetuneEventTypeModelCompressing               FinetuneEventType = "model_compressing"
	FinetuneEventTypeModelCompressionComplete       FinetuneEventType = "model_compression_complete"
	FinetuneEventTypeModelUploading                 FinetuneEventType = "model_uploading"
	FinetuneEventTypeModelUploadComplete            FinetuneEventType = "model_upload_complete"
	FinetuneEventTypeJobComplete                    FinetuneEventType = "job_complete"
	FinetuneEventTypeJobError                       FinetuneEventType = "job_error"
	FinetuneEventTypeCancelRequested                FinetuneEventType = "cancel_requested"
	FinetuneEventTypeJobRestarted                   FinetuneEventType = "job_restarted"
	FinetuneEventTypeRefund                         FinetuneEventType = "refund"
	FinetuneEventTypeWarning                        FinetuneEventType = "warning"
)

type FinetuneResponse

type FinetuneResponse struct {
	ID string `json:"id,required" format:"uuid"`
	// Any of "pending", "queued", "running", "compressing", "uploading",
	// "cancel_requested", "cancelled", "error", "completed".
	Status               FinetuneResponseStatus              `json:"status,required"`
	BatchSize            FinetuneResponseBatchSizeUnion      `json:"batch_size"`
	CreatedAt            string                              `json:"created_at"`
	EpochsCompleted      int64                               `json:"epochs_completed"`
	EvalSteps            int64                               `json:"eval_steps"`
	Events               []FinetuneEvent                     `json:"events"`
	FromCheckpoint       string                              `json:"from_checkpoint"`
	FromHfModel          string                              `json:"from_hf_model"`
	HfModelRevision      string                              `json:"hf_model_revision"`
	JobID                string                              `json:"job_id"`
	LearningRate         float64                             `json:"learning_rate"`
	LrScheduler          FinetuneResponseLrScheduler         `json:"lr_scheduler"`
	MaxGradNorm          float64                             `json:"max_grad_norm"`
	Model                string                              `json:"model"`
	ModelOutputName      string                              `json:"model_output_name"`
	ModelOutputPath      string                              `json:"model_output_path"`
	NCheckpoints         int64                               `json:"n_checkpoints"`
	NEpochs              int64                               `json:"n_epochs"`
	NEvals               int64                               `json:"n_evals"`
	ParamCount           int64                               `json:"param_count"`
	QueueDepth           int64                               `json:"queue_depth"`
	TokenCount           int64                               `json:"token_count"`
	TotalPrice           int64                               `json:"total_price"`
	TrainOnInputs        FinetuneResponseTrainOnInputsUnion  `json:"train_on_inputs"`
	TrainingFile         string                              `json:"training_file"`
	TrainingMethod       FinetuneResponseTrainingMethodUnion `json:"training_method"`
	TrainingType         FinetuneResponseTrainingTypeUnion   `json:"training_type"`
	TrainingfileNumlines int64                               `json:"trainingfile_numlines"`
	TrainingfileSize     int64                               `json:"trainingfile_size"`
	UpdatedAt            string                              `json:"updated_at"`
	ValidationFile       string                              `json:"validation_file"`
	WandbProjectName     string                              `json:"wandb_project_name"`
	WandbURL             string                              `json:"wandb_url"`
	WarmupRatio          float64                             `json:"warmup_ratio"`
	WeightDecay          float64                             `json:"weight_decay"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                   respjson.Field
		Status               respjson.Field
		BatchSize            respjson.Field
		CreatedAt            respjson.Field
		EpochsCompleted      respjson.Field
		EvalSteps            respjson.Field
		Events               respjson.Field
		FromCheckpoint       respjson.Field
		FromHfModel          respjson.Field
		HfModelRevision      respjson.Field
		JobID                respjson.Field
		LearningRate         respjson.Field
		LrScheduler          respjson.Field
		MaxGradNorm          respjson.Field
		Model                respjson.Field
		ModelOutputName      respjson.Field
		ModelOutputPath      respjson.Field
		NCheckpoints         respjson.Field
		NEpochs              respjson.Field
		NEvals               respjson.Field
		ParamCount           respjson.Field
		QueueDepth           respjson.Field
		TokenCount           respjson.Field
		TotalPrice           respjson.Field
		TrainOnInputs        respjson.Field
		TrainingFile         respjson.Field
		TrainingMethod       respjson.Field
		TrainingType         respjson.Field
		TrainingfileNumlines respjson.Field
		TrainingfileSize     respjson.Field
		UpdatedAt            respjson.Field
		ValidationFile       respjson.Field
		WandbProjectName     respjson.Field
		WandbURL             respjson.Field
		WarmupRatio          respjson.Field
		WeightDecay          respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneResponse) RawJSON

func (r FinetuneResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FinetuneResponse) UnmarshalJSON

func (r *FinetuneResponse) UnmarshalJSON(data []byte) error

type FinetuneResponseBatchSizeString

type FinetuneResponseBatchSizeString string
const (
	FinetuneResponseBatchSizeStringMax FinetuneResponseBatchSizeString = "max"
)

type FinetuneResponseBatchSizeUnion

type FinetuneResponseBatchSizeUnion struct {
	// This field will be present if the value is a [int64] instead of an object.
	OfInt int64 `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfFinetuneResponseBatchSizeString string `json:",inline"`
	JSON                              struct {
		OfInt                             respjson.Field
		OfFinetuneResponseBatchSizeString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FinetuneResponseBatchSizeUnion contains all possible properties and values from [int64], [string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfInt OfFinetuneResponseBatchSizeString]

func (FinetuneResponseBatchSizeUnion) AsFinetuneResponseBatchSizeString

func (u FinetuneResponseBatchSizeUnion) AsFinetuneResponseBatchSizeString() (v string)

func (FinetuneResponseBatchSizeUnion) AsInt

func (u FinetuneResponseBatchSizeUnion) AsInt() (v int64)

func (FinetuneResponseBatchSizeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseBatchSizeUnion) UnmarshalJSON

func (r *FinetuneResponseBatchSizeUnion) UnmarshalJSON(data []byte) error

type FinetuneResponseLrScheduler

type FinetuneResponseLrScheduler struct {
	// Any of "linear", "cosine".
	LrSchedulerType string                                          `json:"lr_scheduler_type,required"`
	LrSchedulerArgs FinetuneResponseLrSchedulerLrSchedulerArgsUnion `json:"lr_scheduler_args"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LrSchedulerType respjson.Field
		LrSchedulerArgs respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneResponseLrScheduler) RawJSON

func (r FinetuneResponseLrScheduler) RawJSON() string

Returns the unmodified JSON received from the API

func (*FinetuneResponseLrScheduler) UnmarshalJSON

func (r *FinetuneResponseLrScheduler) UnmarshalJSON(data []byte) error

type FinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

type FinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio,required"`
	// Number or fraction of cycles for the cosine learning rate scheduler
	NumCycles float64 `json:"num_cycles,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinLrRatio  respjson.Field
		NumCycles   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs) UnmarshalJSON

type FinetuneResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

type FinetuneResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs struct {
	// The ratio of the final learning rate to the peak learning rate
	MinLrRatio float64 `json:"min_lr_ratio"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MinLrRatio  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs) UnmarshalJSON

type FinetuneResponseLrSchedulerLrSchedulerArgsUnion

type FinetuneResponseLrSchedulerLrSchedulerArgsUnion struct {
	MinLrRatio float64 `json:"min_lr_ratio"`
	// This field is from variant
	// [FinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs].
	NumCycles float64 `json:"num_cycles"`
	JSON      struct {
		MinLrRatio respjson.Field
		NumCycles  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FinetuneResponseLrSchedulerLrSchedulerArgsUnion contains all possible properties and values from FinetuneResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs, FinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FinetuneResponseLrSchedulerLrSchedulerArgsUnion) AsFinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs

func (u FinetuneResponseLrSchedulerLrSchedulerArgsUnion) AsFinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs() (v FinetuneResponseLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs)

func (FinetuneResponseLrSchedulerLrSchedulerArgsUnion) AsFinetuneResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs

func (u FinetuneResponseLrSchedulerLrSchedulerArgsUnion) AsFinetuneResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs() (v FinetuneResponseLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs)

func (FinetuneResponseLrSchedulerLrSchedulerArgsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseLrSchedulerLrSchedulerArgsUnion) UnmarshalJSON

type FinetuneResponseStatus

type FinetuneResponseStatus string
const (
	FinetuneResponseStatusPending         FinetuneResponseStatus = "pending"
	FinetuneResponseStatusQueued          FinetuneResponseStatus = "queued"
	FinetuneResponseStatusRunning         FinetuneResponseStatus = "running"
	FinetuneResponseStatusCompressing     FinetuneResponseStatus = "compressing"
	FinetuneResponseStatusUploading       FinetuneResponseStatus = "uploading"
	FinetuneResponseStatusCancelRequested FinetuneResponseStatus = "cancel_requested"
	FinetuneResponseStatusCancelled       FinetuneResponseStatus = "cancelled"
	FinetuneResponseStatusError           FinetuneResponseStatus = "error"
	FinetuneResponseStatusCompleted       FinetuneResponseStatus = "completed"
)

type FinetuneResponseTrainOnInputsString

type FinetuneResponseTrainOnInputsString string
const (
	FinetuneResponseTrainOnInputsStringAuto FinetuneResponseTrainOnInputsString = "auto"
)

type FinetuneResponseTrainOnInputsUnion

type FinetuneResponseTrainOnInputsUnion struct {
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfFinetuneResponseTrainOnInputsString string `json:",inline"`
	JSON                                  struct {
		OfBool                                respjson.Field
		OfFinetuneResponseTrainOnInputsString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FinetuneResponseTrainOnInputsUnion contains all possible properties and values from [bool], [string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfBool OfFinetuneResponseTrainOnInputsString]

func (FinetuneResponseTrainOnInputsUnion) AsBool

func (FinetuneResponseTrainOnInputsUnion) AsFinetuneResponseTrainOnInputsString

func (u FinetuneResponseTrainOnInputsUnion) AsFinetuneResponseTrainOnInputsString() (v string)

func (FinetuneResponseTrainOnInputsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseTrainOnInputsUnion) UnmarshalJSON

func (r *FinetuneResponseTrainOnInputsUnion) UnmarshalJSON(data []byte) error

type FinetuneResponseTrainingMethodTrainingMethodDpo

type FinetuneResponseTrainingMethodTrainingMethodDpo struct {
	// Any of "dpo".
	Method                        string  `json:"method,required"`
	DpoBeta                       float64 `json:"dpo_beta"`
	DpoNormalizeLogratiosByLength bool    `json:"dpo_normalize_logratios_by_length"`
	DpoReferenceFree              bool    `json:"dpo_reference_free"`
	RpoAlpha                      float64 `json:"rpo_alpha"`
	SimpoGamma                    float64 `json:"simpo_gamma"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method                        respjson.Field
		DpoBeta                       respjson.Field
		DpoNormalizeLogratiosByLength respjson.Field
		DpoReferenceFree              respjson.Field
		RpoAlpha                      respjson.Field
		SimpoGamma                    respjson.Field
		ExtraFields                   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneResponseTrainingMethodTrainingMethodDpo) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseTrainingMethodTrainingMethodDpo) UnmarshalJSON

type FinetuneResponseTrainingMethodTrainingMethodSft

type FinetuneResponseTrainingMethodTrainingMethodSft struct {
	// Any of "sft".
	Method string `json:"method,required"`
	// Whether to mask the user messages in conversational data or prompts in
	// instruction data.
	TrainOnInputs FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Method        respjson.Field
		TrainOnInputs respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneResponseTrainingMethodTrainingMethodSft) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseTrainingMethodTrainingMethodSft) UnmarshalJSON

type FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsString

type FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsString string
const (
	FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsStringAuto FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsString = "auto"
)

type FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion

type FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion struct {
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	// This field will be present if the value is a [string] instead of an object.
	OfFinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsString string `json:",inline"`
	JSON                                                                 struct {
		OfBool                                                               respjson.Field
		OfFinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion contains all possible properties and values from [bool], [string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfBool OfFinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsString]

func (FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsBool

func (FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsFinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsString

func (u FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) AsFinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsString() (v string)

func (FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion) UnmarshalJSON

type FinetuneResponseTrainingMethodUnion

type FinetuneResponseTrainingMethodUnion struct {
	Method string `json:"method"`
	// This field is from variant [FinetuneResponseTrainingMethodTrainingMethodSft].
	TrainOnInputs FinetuneResponseTrainingMethodTrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs"`
	// This field is from variant [FinetuneResponseTrainingMethodTrainingMethodDpo].
	DpoBeta float64 `json:"dpo_beta"`
	// This field is from variant [FinetuneResponseTrainingMethodTrainingMethodDpo].
	DpoNormalizeLogratiosByLength bool `json:"dpo_normalize_logratios_by_length"`
	// This field is from variant [FinetuneResponseTrainingMethodTrainingMethodDpo].
	DpoReferenceFree bool `json:"dpo_reference_free"`
	// This field is from variant [FinetuneResponseTrainingMethodTrainingMethodDpo].
	RpoAlpha float64 `json:"rpo_alpha"`
	// This field is from variant [FinetuneResponseTrainingMethodTrainingMethodDpo].
	SimpoGamma float64 `json:"simpo_gamma"`
	JSON       struct {
		Method                        respjson.Field
		TrainOnInputs                 respjson.Field
		DpoBeta                       respjson.Field
		DpoNormalizeLogratiosByLength respjson.Field
		DpoReferenceFree              respjson.Field
		RpoAlpha                      respjson.Field
		SimpoGamma                    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FinetuneResponseTrainingMethodUnion contains all possible properties and values from FinetuneResponseTrainingMethodTrainingMethodSft, FinetuneResponseTrainingMethodTrainingMethodDpo.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FinetuneResponseTrainingMethodUnion) AsFinetuneResponseTrainingMethodTrainingMethodDpo

func (u FinetuneResponseTrainingMethodUnion) AsFinetuneResponseTrainingMethodTrainingMethodDpo() (v FinetuneResponseTrainingMethodTrainingMethodDpo)

func (FinetuneResponseTrainingMethodUnion) AsFinetuneResponseTrainingMethodTrainingMethodSft

func (u FinetuneResponseTrainingMethodUnion) AsFinetuneResponseTrainingMethodTrainingMethodSft() (v FinetuneResponseTrainingMethodTrainingMethodSft)

func (FinetuneResponseTrainingMethodUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseTrainingMethodUnion) UnmarshalJSON

func (r *FinetuneResponseTrainingMethodUnion) UnmarshalJSON(data []byte) error

type FinetuneResponseTrainingTypeFullTrainingType

type FinetuneResponseTrainingTypeFullTrainingType struct {
	// Any of "Full".
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneResponseTrainingTypeFullTrainingType) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseTrainingTypeFullTrainingType) UnmarshalJSON

func (r *FinetuneResponseTrainingTypeFullTrainingType) UnmarshalJSON(data []byte) error

type FinetuneResponseTrainingTypeLoRaTrainingType

type FinetuneResponseTrainingTypeLoRaTrainingType struct {
	LoraAlpha int64 `json:"lora_alpha,required"`
	LoraR     int64 `json:"lora_r,required"`
	// Any of "Lora".
	Type                 string  `json:"type,required"`
	LoraDropout          float64 `json:"lora_dropout"`
	LoraTrainableModules string  `json:"lora_trainable_modules"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LoraAlpha            respjson.Field
		LoraR                respjson.Field
		Type                 respjson.Field
		LoraDropout          respjson.Field
		LoraTrainableModules respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FinetuneResponseTrainingTypeLoRaTrainingType) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseTrainingTypeLoRaTrainingType) UnmarshalJSON

func (r *FinetuneResponseTrainingTypeLoRaTrainingType) UnmarshalJSON(data []byte) error

type FinetuneResponseTrainingTypeUnion

type FinetuneResponseTrainingTypeUnion struct {
	Type string `json:"type"`
	// This field is from variant [FinetuneResponseTrainingTypeLoRaTrainingType].
	LoraAlpha int64 `json:"lora_alpha"`
	// This field is from variant [FinetuneResponseTrainingTypeLoRaTrainingType].
	LoraR int64 `json:"lora_r"`
	// This field is from variant [FinetuneResponseTrainingTypeLoRaTrainingType].
	LoraDropout float64 `json:"lora_dropout"`
	// This field is from variant [FinetuneResponseTrainingTypeLoRaTrainingType].
	LoraTrainableModules string `json:"lora_trainable_modules"`
	JSON                 struct {
		Type                 respjson.Field
		LoraAlpha            respjson.Field
		LoraR                respjson.Field
		LoraDropout          respjson.Field
		LoraTrainableModules respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FinetuneResponseTrainingTypeUnion contains all possible properties and values from FinetuneResponseTrainingTypeFullTrainingType, FinetuneResponseTrainingTypeLoRaTrainingType.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FinetuneResponseTrainingTypeUnion) AsFinetuneResponseTrainingTypeFullTrainingType

func (u FinetuneResponseTrainingTypeUnion) AsFinetuneResponseTrainingTypeFullTrainingType() (v FinetuneResponseTrainingTypeFullTrainingType)

func (FinetuneResponseTrainingTypeUnion) AsFinetuneResponseTrainingTypeLoRaTrainingType

func (u FinetuneResponseTrainingTypeUnion) AsFinetuneResponseTrainingTypeLoRaTrainingType() (v FinetuneResponseTrainingTypeLoRaTrainingType)

func (FinetuneResponseTrainingTypeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FinetuneResponseTrainingTypeUnion) UnmarshalJSON

func (r *FinetuneResponseTrainingTypeUnion) UnmarshalJSON(data []byte) error

type HardwareListParams

type HardwareListParams struct {
	// Filter hardware configurations by model compatibility. When provided, the
	// response includes availability status for each compatible configuration.
	Model param.Opt[string] `query:"model,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (HardwareListParams) URLQuery

func (r HardwareListParams) URLQuery() (v url.Values, err error)

URLQuery serializes HardwareListParams's query parameters as `url.Values`.

type HardwareListResponse

type HardwareListResponse struct {
	Data []HardwareListResponseData `json:"data,required"`
	// Any of "list".
	Object HardwareListResponseObject `json:"object,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Object      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (HardwareListResponse) RawJSON

func (r HardwareListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*HardwareListResponse) UnmarshalJSON

func (r *HardwareListResponse) UnmarshalJSON(data []byte) error

type HardwareListResponseData

type HardwareListResponseData struct {
	// Unique identifier for the hardware configuration
	ID string `json:"id,required"`
	// Any of "hardware".
	Object string `json:"object,required"`
	// Pricing details for using an endpoint
	Pricing HardwareListResponseDataPricing `json:"pricing,required"`
	// Detailed specifications of a hardware configuration
	Specs HardwareListResponseDataSpecs `json:"specs,required"`
	// Timestamp of when the hardware status was last updated
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// Indicates the current availability status of a hardware configuration
	Availability HardwareListResponseDataAvailability `json:"availability"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Object       respjson.Field
		Pricing      respjson.Field
		Specs        respjson.Field
		UpdatedAt    respjson.Field
		Availability respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Hardware configuration details with optional availability status

func (HardwareListResponseData) RawJSON

func (r HardwareListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*HardwareListResponseData) UnmarshalJSON

func (r *HardwareListResponseData) UnmarshalJSON(data []byte) error

type HardwareListResponseDataAvailability

type HardwareListResponseDataAvailability struct {
	// The availability status of the hardware configuration
	//
	// Any of "available", "unavailable", "insufficient".
	Status string `json:"status,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Indicates the current availability status of a hardware configuration

func (HardwareListResponseDataAvailability) RawJSON

Returns the unmodified JSON received from the API

func (*HardwareListResponseDataAvailability) UnmarshalJSON

func (r *HardwareListResponseDataAvailability) UnmarshalJSON(data []byte) error

type HardwareListResponseDataPricing

type HardwareListResponseDataPricing struct {
	// Cost per minute of endpoint uptime in cents
	CentsPerMinute float64 `json:"cents_per_minute,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CentsPerMinute respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Pricing details for using an endpoint

func (HardwareListResponseDataPricing) RawJSON

Returns the unmodified JSON received from the API

func (*HardwareListResponseDataPricing) UnmarshalJSON

func (r *HardwareListResponseDataPricing) UnmarshalJSON(data []byte) error

type HardwareListResponseDataSpecs

type HardwareListResponseDataSpecs struct {
	// Number of GPUs in this configuration
	GPUCount int64 `json:"gpu_count,required"`
	// The GPU interconnect technology
	GPULink string `json:"gpu_link,required"`
	// Amount of GPU memory in GB
	GPUMemory float64 `json:"gpu_memory,required"`
	// The type/model of GPU
	GPUType string `json:"gpu_type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GPUCount    respjson.Field
		GPULink     respjson.Field
		GPUMemory   respjson.Field
		GPUType     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Detailed specifications of a hardware configuration

func (HardwareListResponseDataSpecs) RawJSON

Returns the unmodified JSON received from the API

func (*HardwareListResponseDataSpecs) UnmarshalJSON

func (r *HardwareListResponseDataSpecs) UnmarshalJSON(data []byte) error

type HardwareListResponseObject

type HardwareListResponseObject string
const (
	HardwareListResponseObjectList HardwareListResponseObject = "list"
)

type HardwareService

type HardwareService struct {
	Options []option.RequestOption
}

HardwareService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewHardwareService method instead.

func NewHardwareService

func NewHardwareService(opts ...option.RequestOption) (r HardwareService)

NewHardwareService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*HardwareService) List

Returns a list of available hardware configurations for deploying models. When a model parameter is provided, it returns only hardware configurations compatible with that model, including their current availability status.

type ImageDataB64

type ImageDataB64 struct {
	B64Json string `json:"b64_json,required"`
	Index   int64  `json:"index,required"`
	// Any of "b64_json".
	Type ImageDataB64Type `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		B64Json     respjson.Field
		Index       respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ImageDataB64) RawJSON

func (r ImageDataB64) RawJSON() string

Returns the unmodified JSON received from the API

func (*ImageDataB64) UnmarshalJSON

func (r *ImageDataB64) UnmarshalJSON(data []byte) error

type ImageDataB64Type

type ImageDataB64Type string
const (
	ImageDataB64TypeB64Json ImageDataB64Type = "b64_json"
)

type ImageDataURL

type ImageDataURL struct {
	Index int64 `json:"index,required"`
	// Any of "url".
	Type ImageDataURLType `json:"type,required"`
	URL  string           `json:"url,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Index       respjson.Field
		Type        respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ImageDataURL) RawJSON

func (r ImageDataURL) RawJSON() string

Returns the unmodified JSON received from the API

func (*ImageDataURL) UnmarshalJSON

func (r *ImageDataURL) UnmarshalJSON(data []byte) error

type ImageDataURLType

type ImageDataURLType string
const (
	ImageDataURLTypeURL ImageDataURLType = "url"
)

type ImageFile

type ImageFile struct {
	ID    string               `json:"id,required"`
	Data  []ImageFileDataUnion `json:"data,required"`
	Model string               `json:"model,required"`
	// Any of "list".
	Object ImageFileObject `json:"object,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Data        respjson.Field
		Model       respjson.Field
		Object      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ImageFile) RawJSON

func (r ImageFile) RawJSON() string

Returns the unmodified JSON received from the API

func (*ImageFile) UnmarshalJSON

func (r *ImageFile) UnmarshalJSON(data []byte) error

type ImageFileDataUnion

type ImageFileDataUnion struct {
	// This field is from variant [ImageDataB64].
	B64Json string `json:"b64_json"`
	Index   int64  `json:"index"`
	// Any of "b64_json", "url".
	Type string `json:"type"`
	// This field is from variant [ImageDataURL].
	URL  string `json:"url"`
	JSON struct {
		B64Json respjson.Field
		Index   respjson.Field
		Type    respjson.Field
		URL     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ImageFileDataUnion contains all possible properties and values from ImageDataB64, ImageDataURL.

Use the ImageFileDataUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ImageFileDataUnion) AsAny

func (u ImageFileDataUnion) AsAny() anyImageFileData

Use the following switch statement to find the correct variant

switch variant := ImageFileDataUnion.AsAny().(type) {
case together.ImageDataB64:
case together.ImageDataURL:
default:
  fmt.Errorf("no variant present")
}

func (ImageFileDataUnion) AsB64Json

func (u ImageFileDataUnion) AsB64Json() (v ImageDataB64)

func (ImageFileDataUnion) AsURL

func (u ImageFileDataUnion) AsURL() (v ImageDataURL)

func (ImageFileDataUnion) RawJSON

func (u ImageFileDataUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ImageFileDataUnion) UnmarshalJSON

func (r *ImageFileDataUnion) UnmarshalJSON(data []byte) error

type ImageFileObject

type ImageFileObject string
const (
	ImageFileObjectList ImageFileObject = "list"
)

type ImageGenerateParams

type ImageGenerateParams struct {
	// The model to use for image generation.
	//
	// [See all of Together AI's image models](https://docs.together.ai/docs/serverless-models#image-models)
	Model ImageGenerateParamsModel `json:"model,omitzero,required"`
	// A description of the desired images. Maximum length varies by model.
	Prompt string `json:"prompt,required"`
	// If true, disables the safety checker for image generation.
	DisableSafetyChecker param.Opt[bool] `json:"disable_safety_checker,omitzero"`
	// Adjusts the alignment of the generated image with the input prompt. Higher
	// values (e.g., 8-10) make the output more faithful to the prompt, while lower
	// values (e.g., 1-5) encourage more creative freedom.
	GuidanceScale param.Opt[float64] `json:"guidance_scale,omitzero"`
	// Height of the image to generate in number of pixels.
	Height param.Opt[int64] `json:"height,omitzero"`
	// URL of an image to use for image models that support it.
	ImageURL param.Opt[string] `json:"image_url,omitzero"`
	// Number of image results to generate.
	N param.Opt[int64] `json:"n,omitzero"`
	// The prompt or prompts not to guide the image generation.
	NegativePrompt param.Opt[string] `json:"negative_prompt,omitzero"`
	// Seed used for generation. Can be used to reproduce image generations.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// Number of generation steps.
	Steps param.Opt[int64] `json:"steps,omitzero"`
	// Width of the image to generate in number of pixels.
	Width param.Opt[int64] `json:"width,omitzero"`
	// An array of objects that define LoRAs (Low-Rank Adaptations) to influence the
	// generated image.
	ImageLoras []ImageGenerateParamsImageLora `json:"image_loras,omitzero"`
	// The format of the image response. Can be either be `jpeg` or `png`. Defaults to
	// `jpeg`.
	//
	// Any of "jpeg", "png".
	OutputFormat ImageGenerateParamsOutputFormat `json:"output_format,omitzero"`
	// An array of image URLs that guide the overall appearance and style of the
	// generated image. These reference images influence the visual characteristics
	// consistently across the generation.
	ReferenceImages []string `json:"reference_images,omitzero"`
	// Format of the image response. Can be either a base64 string or a URL.
	//
	// Any of "base64", "url".
	ResponseFormat ImageGenerateParamsResponseFormat `json:"response_format,omitzero"`
	// contains filtered or unexported fields
}

func (ImageGenerateParams) MarshalJSON

func (r ImageGenerateParams) MarshalJSON() (data []byte, err error)

func (*ImageGenerateParams) UnmarshalJSON

func (r *ImageGenerateParams) UnmarshalJSON(data []byte) error

type ImageGenerateParamsImageLora

type ImageGenerateParamsImageLora struct {
	// The URL of the LoRA to apply (e.g.
	// https://huggingface.co/strangerzonehf/Flux-Midjourney-Mix2-LoRA).
	Path string `json:"path,required"`
	// The strength of the LoRA's influence. Most LoRA's recommend a value of 1.
	Scale float64 `json:"scale,required"`
	// contains filtered or unexported fields
}

The properties Path, Scale are required.

func (ImageGenerateParamsImageLora) MarshalJSON

func (r ImageGenerateParamsImageLora) MarshalJSON() (data []byte, err error)

func (*ImageGenerateParamsImageLora) UnmarshalJSON

func (r *ImageGenerateParamsImageLora) UnmarshalJSON(data []byte) error

type ImageGenerateParamsModel

type ImageGenerateParamsModel string

The model to use for image generation.

[See all of Together AI's image models](https://docs.together.ai/docs/serverless-models#image-models)

const (
	ImageGenerateParamsModelBlackForestLabsFlux1SchnellFree ImageGenerateParamsModel = "black-forest-labs/FLUX.1-schnell-Free"
	ImageGenerateParamsModelBlackForestLabsFlux1Schnell     ImageGenerateParamsModel = "black-forest-labs/FLUX.1-schnell"
	ImageGenerateParamsModelBlackForestLabsFlux1_1Pro       ImageGenerateParamsModel = "black-forest-labs/FLUX.1.1-pro"
)

type ImageGenerateParamsOutputFormat

type ImageGenerateParamsOutputFormat string

The format of the image response. Can be either be `jpeg` or `png`. Defaults to `jpeg`.

const (
	ImageGenerateParamsOutputFormatJpeg ImageGenerateParamsOutputFormat = "jpeg"
	ImageGenerateParamsOutputFormatPng  ImageGenerateParamsOutputFormat = "png"
)

type ImageGenerateParamsResponseFormat

type ImageGenerateParamsResponseFormat string

Format of the image response. Can be either a base64 string or a URL.

const (
	ImageGenerateParamsResponseFormatBase64 ImageGenerateParamsResponseFormat = "base64"
	ImageGenerateParamsResponseFormatURL    ImageGenerateParamsResponseFormat = "url"
)

type ImageService

type ImageService struct {
	Options []option.RequestOption
}

ImageService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewImageService method instead.

func NewImageService

func NewImageService(opts ...option.RequestOption) (r ImageService)

NewImageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ImageService) Generate

func (r *ImageService) Generate(ctx context.Context, body ImageGenerateParams, opts ...option.RequestOption) (res *ImageFile, err error)

Use an image model to generate an image for a given prompt.

type JobGetResponse

type JobGetResponse struct {
	Args      JobGetResponseArgs `json:"args,required"`
	CreatedAt time.Time          `json:"created_at,required" format:"date-time"`
	JobID     string             `json:"job_id,required"`
	// Any of "Queued", "Running", "Complete", "Failed".
	Status        JobGetResponseStatus         `json:"status,required"`
	StatusUpdates []JobGetResponseStatusUpdate `json:"status_updates,required"`
	Type          string                       `json:"type,required"`
	UpdatedAt     time.Time                    `json:"updated_at,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Args          respjson.Field
		CreatedAt     respjson.Field
		JobID         respjson.Field
		Status        respjson.Field
		StatusUpdates respjson.Field
		Type          respjson.Field
		UpdatedAt     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JobGetResponse) RawJSON

func (r JobGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*JobGetResponse) UnmarshalJSON

func (r *JobGetResponse) UnmarshalJSON(data []byte) error

type JobGetResponseArgs

type JobGetResponseArgs struct {
	Description string `json:"description"`
	ModelName   string `json:"modelName"`
	ModelSource string `json:"modelSource"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		ModelName   respjson.Field
		ModelSource respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JobGetResponseArgs) RawJSON

func (r JobGetResponseArgs) RawJSON() string

Returns the unmodified JSON received from the API

func (*JobGetResponseArgs) UnmarshalJSON

func (r *JobGetResponseArgs) UnmarshalJSON(data []byte) error

type JobGetResponseStatus

type JobGetResponseStatus string
const (
	JobGetResponseStatusQueued   JobGetResponseStatus = "Queued"
	JobGetResponseStatusRunning  JobGetResponseStatus = "Running"
	JobGetResponseStatusComplete JobGetResponseStatus = "Complete"
	JobGetResponseStatusFailed   JobGetResponseStatus = "Failed"
)

type JobGetResponseStatusUpdate

type JobGetResponseStatusUpdate struct {
	Message   string    `json:"message,required"`
	Status    string    `json:"status,required"`
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Status      respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JobGetResponseStatusUpdate) RawJSON

func (r JobGetResponseStatusUpdate) RawJSON() string

Returns the unmodified JSON received from the API

func (*JobGetResponseStatusUpdate) UnmarshalJSON

func (r *JobGetResponseStatusUpdate) UnmarshalJSON(data []byte) error

type JobListResponse

type JobListResponse struct {
	Data []JobListResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JobListResponse) RawJSON

func (r JobListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*JobListResponse) UnmarshalJSON

func (r *JobListResponse) UnmarshalJSON(data []byte) error

type JobListResponseData

type JobListResponseData struct {
	Args      JobListResponseDataArgs `json:"args,required"`
	CreatedAt time.Time               `json:"created_at,required" format:"date-time"`
	JobID     string                  `json:"job_id,required"`
	// Any of "Queued", "Running", "Complete", "Failed".
	Status        string                            `json:"status,required"`
	StatusUpdates []JobListResponseDataStatusUpdate `json:"status_updates,required"`
	Type          string                            `json:"type,required"`
	UpdatedAt     time.Time                         `json:"updated_at,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Args          respjson.Field
		CreatedAt     respjson.Field
		JobID         respjson.Field
		Status        respjson.Field
		StatusUpdates respjson.Field
		Type          respjson.Field
		UpdatedAt     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JobListResponseData) RawJSON

func (r JobListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*JobListResponseData) UnmarshalJSON

func (r *JobListResponseData) UnmarshalJSON(data []byte) error

type JobListResponseDataArgs

type JobListResponseDataArgs struct {
	Description string `json:"description"`
	ModelName   string `json:"modelName"`
	ModelSource string `json:"modelSource"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		ModelName   respjson.Field
		ModelSource respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JobListResponseDataArgs) RawJSON

func (r JobListResponseDataArgs) RawJSON() string

Returns the unmodified JSON received from the API

func (*JobListResponseDataArgs) UnmarshalJSON

func (r *JobListResponseDataArgs) UnmarshalJSON(data []byte) error

type JobListResponseDataStatusUpdate

type JobListResponseDataStatusUpdate struct {
	Message   string    `json:"message,required"`
	Status    string    `json:"status,required"`
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Status      respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JobListResponseDataStatusUpdate) RawJSON

Returns the unmodified JSON received from the API

func (*JobListResponseDataStatusUpdate) UnmarshalJSON

func (r *JobListResponseDataStatusUpdate) UnmarshalJSON(data []byte) error

type JobService

type JobService struct {
	Options []option.RequestOption
}

JobService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewJobService method instead.

func NewJobService

func NewJobService(opts ...option.RequestOption) (r JobService)

NewJobService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*JobService) Get

func (r *JobService) Get(ctx context.Context, jobID string, opts ...option.RequestOption) (res *JobGetResponse, err error)

Get the status of a specific job

func (*JobService) List

func (r *JobService) List(ctx context.Context, opts ...option.RequestOption) (res *JobListResponse, err error)

List all jobs and their statuses

type LogProbs

type LogProbs struct {
	// List of token IDs corresponding to the logprobs
	TokenIDs []float64 `json:"token_ids"`
	// List of token log probabilities
	TokenLogprobs []float64 `json:"token_logprobs"`
	// List of token strings
	Tokens []string `json:"tokens"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		TokenIDs      respjson.Field
		TokenLogprobs respjson.Field
		Tokens        respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (LogProbs) RawJSON

func (r LogProbs) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogProbs) UnmarshalJSON

func (r *LogProbs) UnmarshalJSON(data []byte) error

type ModelObject

type ModelObject struct {
	ID      string `json:"id,required"`
	Created int64  `json:"created,required"`
	Object  string `json:"object,required"`
	// Any of "chat", "language", "code", "image", "embedding", "moderation", "rerank".
	Type          ModelObjectType    `json:"type,required"`
	ContextLength int64              `json:"context_length"`
	DisplayName   string             `json:"display_name"`
	License       string             `json:"license"`
	Link          string             `json:"link"`
	Organization  string             `json:"organization"`
	Pricing       ModelObjectPricing `json:"pricing"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		Created       respjson.Field
		Object        respjson.Field
		Type          respjson.Field
		ContextLength respjson.Field
		DisplayName   respjson.Field
		License       respjson.Field
		Link          respjson.Field
		Organization  respjson.Field
		Pricing       respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ModelObject) RawJSON

func (r ModelObject) RawJSON() string

Returns the unmodified JSON received from the API

func (*ModelObject) UnmarshalJSON

func (r *ModelObject) UnmarshalJSON(data []byte) error

type ModelObjectPricing

type ModelObjectPricing struct {
	Base     float64 `json:"base,required"`
	Finetune float64 `json:"finetune,required"`
	Hourly   float64 `json:"hourly,required"`
	Input    float64 `json:"input,required"`
	Output   float64 `json:"output,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Base        respjson.Field
		Finetune    respjson.Field
		Hourly      respjson.Field
		Input       respjson.Field
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ModelObjectPricing) RawJSON

func (r ModelObjectPricing) RawJSON() string

Returns the unmodified JSON received from the API

func (*ModelObjectPricing) UnmarshalJSON

func (r *ModelObjectPricing) UnmarshalJSON(data []byte) error

type ModelObjectType

type ModelObjectType string
const (
	ModelObjectTypeChat       ModelObjectType = "chat"
	ModelObjectTypeLanguage   ModelObjectType = "language"
	ModelObjectTypeCode       ModelObjectType = "code"
	ModelObjectTypeImage      ModelObjectType = "image"
	ModelObjectTypeEmbedding  ModelObjectType = "embedding"
	ModelObjectTypeModeration ModelObjectType = "moderation"
	ModelObjectTypeRerank     ModelObjectType = "rerank"
)

type ModelService

type ModelService struct {
	Options []option.RequestOption
}

ModelService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewModelService method instead.

func NewModelService

func NewModelService(opts ...option.RequestOption) (r ModelService)

NewModelService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ModelService) List

func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ModelObject, err error)

Lists all of Together's open-source models

func (*ModelService) Upload

func (r *ModelService) Upload(ctx context.Context, body ModelUploadParams, opts ...option.RequestOption) (res *ModelUploadResponse, err error)

Upload a custom model or adapter from Hugging Face or S3

type ModelUploadParams

type ModelUploadParams struct {
	// The name to give to your uploaded model
	ModelName string `json:"model_name,required"`
	// The source location of the model (Hugging Face repo or S3 path)
	ModelSource string `json:"model_source,required"`
	// The base model to use for an adapter if setting it to run against a serverless
	// pool. Only used for model_type `adapter`.
	BaseModel param.Opt[string] `json:"base_model,omitzero"`
	// A description of your model
	Description param.Opt[string] `json:"description,omitzero"`
	// Hugging Face token (if uploading from Hugging Face)
	HfToken param.Opt[string] `json:"hf_token,omitzero"`
	// The lora pool to use for an adapter if setting it to run against, say, a
	// dedicated pool. Only used for model_type `adapter`.
	LoraModel param.Opt[string] `json:"lora_model,omitzero"`
	// Whether the model is a full model or an adapter
	//
	// Any of "model", "adapter".
	ModelType ModelUploadParamsModelType `json:"model_type,omitzero"`
	// contains filtered or unexported fields
}

func (ModelUploadParams) MarshalJSON

func (r ModelUploadParams) MarshalJSON() (data []byte, err error)

func (*ModelUploadParams) UnmarshalJSON

func (r *ModelUploadParams) UnmarshalJSON(data []byte) error

type ModelUploadParamsModelType

type ModelUploadParamsModelType string

Whether the model is a full model or an adapter

const (
	ModelUploadParamsModelTypeModel   ModelUploadParamsModelType = "model"
	ModelUploadParamsModelTypeAdapter ModelUploadParamsModelType = "adapter"
)

type ModelUploadResponse

type ModelUploadResponse struct {
	Data    ModelUploadResponseData `json:"data,required"`
	Message string                  `json:"message,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ModelUploadResponse) RawJSON

func (r ModelUploadResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ModelUploadResponse) UnmarshalJSON

func (r *ModelUploadResponse) UnmarshalJSON(data []byte) error

type ModelUploadResponseData

type ModelUploadResponseData struct {
	JobID       string `json:"job_id,required"`
	ModelID     string `json:"model_id,required"`
	ModelName   string `json:"model_name,required"`
	ModelSource string `json:"model_source,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		JobID       respjson.Field
		ModelID     respjson.Field
		ModelName   respjson.Field
		ModelSource respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ModelUploadResponseData) RawJSON

func (r ModelUploadResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*ModelUploadResponseData) UnmarshalJSON

func (r *ModelUploadResponseData) UnmarshalJSON(data []byte) error

type RerankNewParams

type RerankNewParams struct {
	// List of documents, which can be either strings or objects.
	Documents RerankNewParamsDocumentsUnion `json:"documents,omitzero,required"`
	// The model to be used for the rerank request.
	//
	// [See all of Together AI's rerank models](https://docs.together.ai/docs/serverless-models#rerank-models)
	Model RerankNewParamsModel `json:"model,omitzero,required"`
	// The search query to be used for ranking.
	Query string `json:"query,required"`
	// Whether to return supplied documents with the response.
	ReturnDocuments param.Opt[bool] `json:"return_documents,omitzero"`
	// The number of top results to return.
	TopN param.Opt[int64] `json:"top_n,omitzero"`
	// List of keys in the JSON Object document to rank by. Defaults to use all
	// supplied keys for ranking.
	RankFields []string `json:"rank_fields,omitzero"`
	// contains filtered or unexported fields
}

func (RerankNewParams) MarshalJSON

func (r RerankNewParams) MarshalJSON() (data []byte, err error)

func (*RerankNewParams) UnmarshalJSON

func (r *RerankNewParams) UnmarshalJSON(data []byte) error

type RerankNewParamsDocumentsUnion

type RerankNewParamsDocumentsUnion struct {
	OfMapOfAnyMap []map[string]any `json:",omitzero,inline"`
	OfStringArray []string         `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (RerankNewParamsDocumentsUnion) MarshalJSON

func (u RerankNewParamsDocumentsUnion) MarshalJSON() ([]byte, error)

func (*RerankNewParamsDocumentsUnion) UnmarshalJSON

func (u *RerankNewParamsDocumentsUnion) UnmarshalJSON(data []byte) error

type RerankNewParamsModel

type RerankNewParamsModel string

The model to be used for the rerank request.

[See all of Together AI's rerank models](https://docs.together.ai/docs/serverless-models#rerank-models)

const (
	RerankNewParamsModelSalesforceLlamaRankV1 RerankNewParamsModel = "Salesforce/Llama-Rank-v1"
)

type RerankNewResponse

type RerankNewResponse struct {
	// The model to be used for the rerank request.
	Model string `json:"model,required"`
	// Object type
	//
	// Any of "rerank".
	Object  RerankNewResponseObject   `json:"object,required"`
	Results []RerankNewResponseResult `json:"results,required"`
	// Request ID
	ID    string              `json:"id"`
	Usage ChatCompletionUsage `json:"usage,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Model       respjson.Field
		Object      respjson.Field
		Results     respjson.Field
		ID          respjson.Field
		Usage       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RerankNewResponse) RawJSON

func (r RerankNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*RerankNewResponse) UnmarshalJSON

func (r *RerankNewResponse) UnmarshalJSON(data []byte) error

type RerankNewResponseObject

type RerankNewResponseObject string

Object type

const (
	RerankNewResponseObjectRerank RerankNewResponseObject = "rerank"
)

type RerankNewResponseResult

type RerankNewResponseResult struct {
	Document       RerankNewResponseResultDocument `json:"document,required"`
	Index          int64                           `json:"index,required"`
	RelevanceScore float64                         `json:"relevance_score,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Document       respjson.Field
		Index          respjson.Field
		RelevanceScore respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RerankNewResponseResult) RawJSON

func (r RerankNewResponseResult) RawJSON() string

Returns the unmodified JSON received from the API

func (*RerankNewResponseResult) UnmarshalJSON

func (r *RerankNewResponseResult) UnmarshalJSON(data []byte) error

type RerankNewResponseResultDocument

type RerankNewResponseResultDocument struct {
	Text string `json:"text,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RerankNewResponseResultDocument) RawJSON

Returns the unmodified JSON received from the API

func (*RerankNewResponseResultDocument) UnmarshalJSON

func (r *RerankNewResponseResultDocument) UnmarshalJSON(data []byte) error

type RerankService

type RerankService struct {
	Options []option.RequestOption
}

RerankService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRerankService method instead.

func NewRerankService

func NewRerankService(opts ...option.RequestOption) (r RerankService)

NewRerankService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RerankService) New

Query a reranker model

type SessionListResponse

type SessionListResponse struct {
	Data   SessionListResponseData         `json:"data"`
	Errors []SessionListResponseErrorUnion `json:"errors"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Errors      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SessionListResponse) RawJSON

func (r SessionListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SessionListResponse) UnmarshalJSON

func (r *SessionListResponse) UnmarshalJSON(data []byte) error

type SessionListResponseData

type SessionListResponseData struct {
	Sessions []SessionListResponseDataSession `json:"sessions,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Sessions    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SessionListResponseData) RawJSON

func (r SessionListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*SessionListResponseData) UnmarshalJSON

func (r *SessionListResponseData) UnmarshalJSON(data []byte) error

type SessionListResponseDataSession

type SessionListResponseDataSession struct {
	// Session Identifier. Used to make follow-up calls.
	ID            string    `json:"id,required"`
	ExecuteCount  int64     `json:"execute_count,required"`
	ExpiresAt     time.Time `json:"expires_at,required" format:"date-time"`
	LastExecuteAt time.Time `json:"last_execute_at,required" format:"date-time"`
	StartedAt     time.Time `json:"started_at,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		ExecuteCount  respjson.Field
		ExpiresAt     respjson.Field
		LastExecuteAt respjson.Field
		StartedAt     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SessionListResponseDataSession) RawJSON

Returns the unmodified JSON received from the API

func (*SessionListResponseDataSession) UnmarshalJSON

func (r *SessionListResponseDataSession) UnmarshalJSON(data []byte) error

type SessionListResponseErrorUnion

type SessionListResponseErrorUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [any] instead of an object.
	OfSessionListResponseErrorMapItem any `json:",inline"`
	JSON                              struct {
		OfString                          respjson.Field
		OfSessionListResponseErrorMapItem respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

SessionListResponseErrorUnion contains all possible properties and values from [string], [map[string]any].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfSessionListResponseErrorMapItem]

func (SessionListResponseErrorUnion) AsAnyMap

func (u SessionListResponseErrorUnion) AsAnyMap() (v map[string]any)

func (SessionListResponseErrorUnion) AsString

func (u SessionListResponseErrorUnion) AsString() (v string)

func (SessionListResponseErrorUnion) RawJSON

Returns the unmodified JSON received from the API

func (*SessionListResponseErrorUnion) UnmarshalJSON

func (r *SessionListResponseErrorUnion) UnmarshalJSON(data []byte) error

type ToolChoice

type ToolChoice struct {
	ID       string             `json:"id,required"`
	Function ToolChoiceFunction `json:"function,required"`
	Index    float64            `json:"index,required"`
	// Any of "function".
	Type ToolChoiceType `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Function    respjson.Field
		Index       respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ToolChoice) RawJSON

func (r ToolChoice) RawJSON() string

Returns the unmodified JSON received from the API

func (ToolChoice) ToParam

func (r ToolChoice) ToParam() ToolChoiceParam

ToParam converts this ToolChoice to a ToolChoiceParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ToolChoiceParam.Overrides()

func (*ToolChoice) UnmarshalJSON

func (r *ToolChoice) UnmarshalJSON(data []byte) error

type ToolChoiceFunction

type ToolChoiceFunction struct {
	Arguments string `json:"arguments,required"`
	Name      string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arguments   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ToolChoiceFunction) RawJSON

func (r ToolChoiceFunction) RawJSON() string

Returns the unmodified JSON received from the API

func (*ToolChoiceFunction) UnmarshalJSON

func (r *ToolChoiceFunction) UnmarshalJSON(data []byte) error

type ToolChoiceFunctionParam

type ToolChoiceFunctionParam struct {
	Arguments string `json:"arguments,required"`
	Name      string `json:"name,required"`
	// contains filtered or unexported fields
}

The properties Arguments, Name are required.

func (ToolChoiceFunctionParam) MarshalJSON

func (r ToolChoiceFunctionParam) MarshalJSON() (data []byte, err error)

func (*ToolChoiceFunctionParam) UnmarshalJSON

func (r *ToolChoiceFunctionParam) UnmarshalJSON(data []byte) error

type ToolChoiceParam

type ToolChoiceParam struct {
	ID       string                  `json:"id,required"`
	Function ToolChoiceFunctionParam `json:"function,omitzero,required"`
	Index    float64                 `json:"index,required"`
	// Any of "function".
	Type ToolChoiceType `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

The properties ID, Function, Index, Type are required.

func (ToolChoiceParam) MarshalJSON

func (r ToolChoiceParam) MarshalJSON() (data []byte, err error)

func (*ToolChoiceParam) UnmarshalJSON

func (r *ToolChoiceParam) UnmarshalJSON(data []byte) error

type ToolChoiceType

type ToolChoiceType string
const (
	ToolChoiceTypeFunction ToolChoiceType = "function"
)

type ToolsFunctionParam

type ToolsFunctionParam struct {
	Description param.Opt[string] `json:"description,omitzero"`
	Name        param.Opt[string] `json:"name,omitzero"`
	// A map of parameter names to their values.
	Parameters map[string]any `json:"parameters,omitzero"`
	// contains filtered or unexported fields
}

func (ToolsFunctionParam) MarshalJSON

func (r ToolsFunctionParam) MarshalJSON() (data []byte, err error)

func (*ToolsFunctionParam) UnmarshalJSON

func (r *ToolsFunctionParam) UnmarshalJSON(data []byte) error

type ToolsParam

type ToolsParam struct {
	Type     param.Opt[string]  `json:"type,omitzero"`
	Function ToolsFunctionParam `json:"function,omitzero"`
	// contains filtered or unexported fields
}

func (ToolsParam) MarshalJSON

func (r ToolsParam) MarshalJSON() (data []byte, err error)

func (*ToolsParam) UnmarshalJSON

func (r *ToolsParam) UnmarshalJSON(data []byte) error

type VideoJob

type VideoJob struct {
	// Unique identifier for the video job.
	ID string `json:"id,required"`
	// Unix timestamp (seconds) for when the job was created.
	CreatedAt float64 `json:"created_at,required"`
	// The video generation model that produced the job.
	Model string `json:"model,required"`
	// Duration of the generated clip in seconds.
	Seconds string `json:"seconds,required"`
	// The resolution of the generated video.
	Size string `json:"size,required"`
	// Current lifecycle status of the video job.
	//
	// Any of "in_progress", "completed", "failed".
	Status VideoJobStatus `json:"status,required"`
	// Unix timestamp (seconds) for when the job completed, if finished.
	CompletedAt float64 `json:"completed_at"`
	// Error payload that explains why generation failed, if applicable.
	Error VideoJobError `json:"error"`
	// The object type, which is always video.
	//
	// Any of "video".
	Object VideoJobObject `json:"object"`
	// Available upon completion, the outputs provides the cost charged and the hosted
	// url to access the video
	Outputs VideoJobOutputs `json:"outputs"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Model       respjson.Field
		Seconds     respjson.Field
		Size        respjson.Field
		Status      respjson.Field
		CompletedAt respjson.Field
		Error       respjson.Field
		Object      respjson.Field
		Outputs     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Structured information describing a generated video job.

func (VideoJob) RawJSON

func (r VideoJob) RawJSON() string

Returns the unmodified JSON received from the API

func (*VideoJob) UnmarshalJSON

func (r *VideoJob) UnmarshalJSON(data []byte) error

type VideoJobError

type VideoJobError struct {
	Message string `json:"message,required"`
	Code    string `json:"code"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Code        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Error payload that explains why generation failed, if applicable.

func (VideoJobError) RawJSON

func (r VideoJobError) RawJSON() string

Returns the unmodified JSON received from the API

func (*VideoJobError) UnmarshalJSON

func (r *VideoJobError) UnmarshalJSON(data []byte) error

type VideoJobObject

type VideoJobObject string

The object type, which is always video.

const (
	VideoJobObjectVideo VideoJobObject = "video"
)

type VideoJobOutputs

type VideoJobOutputs struct {
	// The cost of generated video charged to the owners account.
	Cost int64 `json:"cost,required"`
	// URL hosting the generated video
	VideoURL string `json:"video_url,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Cost        respjson.Field
		VideoURL    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Available upon completion, the outputs provides the cost charged and the hosted url to access the video

func (VideoJobOutputs) RawJSON

func (r VideoJobOutputs) RawJSON() string

Returns the unmodified JSON received from the API

func (*VideoJobOutputs) UnmarshalJSON

func (r *VideoJobOutputs) UnmarshalJSON(data []byte) error

type VideoJobStatus

type VideoJobStatus string

Current lifecycle status of the video job.

const (
	VideoJobStatusInProgress VideoJobStatus = "in_progress"
	VideoJobStatusCompleted  VideoJobStatus = "completed"
	VideoJobStatusFailed     VideoJobStatus = "failed"
)

type VideoNewParams

type VideoNewParams struct {
	// The model to be used for the video creation request.
	Model string `json:"model,required"`
	// Frames per second. Defaults to 24.
	Fps param.Opt[int64] `json:"fps,omitzero"`
	// Controls how closely the video generation follows your prompt. Higher values
	// make the model adhere more strictly to your text description, while lower values
	// allow more creative freedom. guidence_scale affects both visual content and
	// temporal consistency.Recommended range is 6.0-10.0 for most video models. Values
	// above 12 may cause over-guidance artifacts or unnatural motion patterns.
	GuidanceScale param.Opt[int64] `json:"guidance_scale,omitzero"`
	Height        param.Opt[int64] `json:"height,omitzero"`
	// Similar to prompt, but specifies what to avoid instead of what to include
	NegativePrompt param.Opt[string] `json:"negative_prompt,omitzero"`
	// Compression quality. Defaults to 20.
	OutputQuality param.Opt[int64] `json:"output_quality,omitzero"`
	// Text prompt that describes the video to generate.
	Prompt param.Opt[string] `json:"prompt,omitzero"`
	// Clip duration in seconds.
	Seconds param.Opt[string] `json:"seconds,omitzero"`
	// Seed to use in initializing the video generation. Using the same seed allows
	// deterministic video generation. If not provided a random seed is generated for
	// each request.
	Seed param.Opt[int64] `json:"seed,omitzero"`
	// The number of denoising steps the model performs during video generation. More
	// steps typically result in higher quality output but require longer processing
	// time.
	Steps param.Opt[int64] `json:"steps,omitzero"`
	Width param.Opt[int64] `json:"width,omitzero"`
	// Array of images to guide video generation, similar to keyframes.
	FrameImages []VideoNewParamsFrameImage `json:"frame_images,omitzero"`
	// Specifies the format of the output video. Defaults to MP4.
	//
	// Any of "MP4", "WEBM".
	OutputFormat VideoNewParamsOutputFormat `json:"output_format,omitzero"`
	// Unlike frame_images which constrain specific timeline positions, reference
	// images guide the general appearance that should appear consistently across the
	// video.
	ReferenceImages []string `json:"reference_images,omitzero"`
	// contains filtered or unexported fields
}

func (VideoNewParams) MarshalJSON

func (r VideoNewParams) MarshalJSON() (data []byte, err error)

func (*VideoNewParams) UnmarshalJSON

func (r *VideoNewParams) UnmarshalJSON(data []byte) error

type VideoNewParamsFrameImage

type VideoNewParamsFrameImage struct {
	// URL path to hosted image that is used for a frame
	InputImage string `json:"input_image,required"`
	// Optional param to specify where to insert the frame. If this is omitted, the
	// following heuristics are applied:
	//
	// - frame_images size is one, frame is first.
	// - If size is two, frames are first and last.
	// - If size is larger, frames are first, last and evenly spaced between.
	Frame VideoNewParamsFrameImageFrameUnion `json:"frame,omitzero"`
	// contains filtered or unexported fields
}

The property InputImage is required.

func (VideoNewParamsFrameImage) MarshalJSON

func (r VideoNewParamsFrameImage) MarshalJSON() (data []byte, err error)

func (*VideoNewParamsFrameImage) UnmarshalJSON

func (r *VideoNewParamsFrameImage) UnmarshalJSON(data []byte) error

type VideoNewParamsFrameImageFrameString

type VideoNewParamsFrameImageFrameString string
const (
	VideoNewParamsFrameImageFrameStringFirst VideoNewParamsFrameImageFrameString = "first"
	VideoNewParamsFrameImageFrameStringLast  VideoNewParamsFrameImageFrameString = "last"
)

type VideoNewParamsFrameImageFrameUnion

type VideoNewParamsFrameImageFrameUnion struct {
	OfFloat param.Opt[float64] `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfVideoNewsFrameImageFrameString)
	OfVideoNewsFrameImageFrameString param.Opt[string] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (VideoNewParamsFrameImageFrameUnion) MarshalJSON

func (u VideoNewParamsFrameImageFrameUnion) MarshalJSON() ([]byte, error)

func (*VideoNewParamsFrameImageFrameUnion) UnmarshalJSON

func (u *VideoNewParamsFrameImageFrameUnion) UnmarshalJSON(data []byte) error

type VideoNewParamsOutputFormat

type VideoNewParamsOutputFormat string

Specifies the format of the output video. Defaults to MP4.

const (
	VideoNewParamsOutputFormatMP4  VideoNewParamsOutputFormat = "MP4"
	VideoNewParamsOutputFormatWebm VideoNewParamsOutputFormat = "WEBM"
)

type VideoService

type VideoService struct {
	Options []option.RequestOption
}

VideoService contains methods and other services that help with interacting with the together API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewVideoService method instead.

func NewVideoService

func NewVideoService(opts ...option.RequestOption) (r VideoService)

NewVideoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*VideoService) Get

func (r *VideoService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *VideoJob, err error)

Fetch video metadata

func (*VideoService) New

func (r *VideoService) New(ctx context.Context, body VideoNewParams, opts ...option.RequestOption) (res *VideoJob, err error)

Create a video

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

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