together

package module
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: Apache-2.0 Imports: 22 Imported by: 5 modules, 2 packages

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

README

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-alpha.1'

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 it's 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 5 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 AudioNewParams

type AudioNewParams 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)
	Model AudioNewParamsModel `json:"model,omitzero,required"`
	// The voice to use for generating the audio.
	// [View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
	Voice AudioNewParamsVoice `json:"voice,omitzero,required"`
	// Sampling rate to use for the output audio
	SampleRate param.Opt[float64] `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 AudioNewParamsLanguage `json:"language,omitzero"`
	// Audio encoding of response
	//
	// Any of "pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw".
	ResponseEncoding AudioNewParamsResponseEncoding `json:"response_encoding,omitzero"`
	// The format of audio output
	//
	// Any of "mp3", "wav", "raw".
	ResponseFormat AudioNewParamsResponseFormat `json:"response_format,omitzero"`
	// contains filtered or unexported fields
}

func (AudioNewParams) MarshalJSON

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

func (*AudioNewParams) UnmarshalJSON

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

type AudioNewParamsLanguage

type AudioNewParamsLanguage string

Language of input text

const (
	AudioNewParamsLanguageEn AudioNewParamsLanguage = "en"
	AudioNewParamsLanguageDe AudioNewParamsLanguage = "de"
	AudioNewParamsLanguageFr AudioNewParamsLanguage = "fr"
	AudioNewParamsLanguageEs AudioNewParamsLanguage = "es"
	AudioNewParamsLanguageHi AudioNewParamsLanguage = "hi"
	AudioNewParamsLanguageIt AudioNewParamsLanguage = "it"
	AudioNewParamsLanguageJa AudioNewParamsLanguage = "ja"
	AudioNewParamsLanguageKo AudioNewParamsLanguage = "ko"
	AudioNewParamsLanguageNl AudioNewParamsLanguage = "nl"
	AudioNewParamsLanguagePl AudioNewParamsLanguage = "pl"
	AudioNewParamsLanguagePt AudioNewParamsLanguage = "pt"
	AudioNewParamsLanguageRu AudioNewParamsLanguage = "ru"
	AudioNewParamsLanguageSv AudioNewParamsLanguage = "sv"
	AudioNewParamsLanguageTr AudioNewParamsLanguage = "tr"
	AudioNewParamsLanguageZh AudioNewParamsLanguage = "zh"
)

type AudioNewParamsModel

type AudioNewParamsModel 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)

const (
	AudioNewParamsModelCartesiaSonic AudioNewParamsModel = "cartesia/sonic"
)

type AudioNewParamsResponseEncoding

type AudioNewParamsResponseEncoding string

Audio encoding of response

const (
	AudioNewParamsResponseEncodingPcmF32le AudioNewParamsResponseEncoding = "pcm_f32le"
	AudioNewParamsResponseEncodingPcmS16le AudioNewParamsResponseEncoding = "pcm_s16le"
	AudioNewParamsResponseEncodingPcmMulaw AudioNewParamsResponseEncoding = "pcm_mulaw"
	AudioNewParamsResponseEncodingPcmAlaw  AudioNewParamsResponseEncoding = "pcm_alaw"
)

type AudioNewParamsResponseFormat

type AudioNewParamsResponseFormat string

The format of audio output

const (
	AudioNewParamsResponseFormatMP3 AudioNewParamsResponseFormat = "mp3"
	AudioNewParamsResponseFormatWav AudioNewParamsResponseFormat = "wav"
	AudioNewParamsResponseFormatRaw AudioNewParamsResponseFormat = "raw"
)

type AudioNewParamsVoice

type AudioNewParamsVoice string

The voice to use for generating the audio. [View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).

const (
	AudioNewParamsVoiceLaidbackWoman    AudioNewParamsVoice = "laidback woman"
	AudioNewParamsVoicePoliteMan        AudioNewParamsVoice = "polite man"
	AudioNewParamsVoiceStorytellerLady  AudioNewParamsVoice = "storyteller lady"
	AudioNewParamsVoiceFriendlySidekick AudioNewParamsVoice = "friendly sidekick"
)

type AudioService

type AudioService struct {
	Options        []option.RequestOption
	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.

func (*AudioService) New

func (r *AudioService) New(ctx context.Context, body AudioNewParams, opts ...option.RequestOption) (res *http.Response, err error)

Generate audio from input text

func (*AudioService) NewStreaming

func (r *AudioService) NewStreaming(ctx context.Context, body AudioNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[AudioSpeechStreamChunk])

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"`
	// Optional ISO 639-1 language code. If `auto` is provided, language is
	// auto-detected.
	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 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 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
		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 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"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		Word        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].
	Words []AudioTranscriptionNewResponseAudioTranscriptionVerboseJsonResponseWord `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:"-"`
}

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"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		Word        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 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 BatchGetResponse

type BatchGetResponse 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 BatchGetResponseStatus `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 (BatchGetResponse) RawJSON

func (r BatchGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BatchGetResponse) UnmarshalJSON

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

type BatchGetResponseStatus

type BatchGetResponseStatus string

Current status of the batch job

const (
	BatchGetResponseStatusValidating BatchGetResponseStatus = "VALIDATING"
	BatchGetResponseStatusInProgress BatchGetResponseStatus = "IN_PROGRESS"
	BatchGetResponseStatusCompleted  BatchGetResponseStatus = "COMPLETED"
	BatchGetResponseStatusFailed     BatchGetResponseStatus = "FAILED"
	BatchGetResponseStatusExpired    BatchGetResponseStatus = "EXPIRED"
	BatchGetResponseStatusCancelled  BatchGetResponseStatus = "CANCELLED"
)

type BatchListResponse

type BatchListResponse 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 BatchListResponseStatus `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 (BatchListResponse) RawJSON

func (r BatchListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BatchListResponse) UnmarshalJSON

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

type BatchListResponseStatus

type BatchListResponseStatus string

Current status of the batch job

const (
	BatchListResponseStatusValidating BatchListResponseStatus = "VALIDATING"
	BatchListResponseStatusInProgress BatchListResponseStatus = "IN_PROGRESS"
	BatchListResponseStatusCompleted  BatchListResponseStatus = "COMPLETED"
	BatchListResponseStatusFailed     BatchListResponseStatus = "FAILED"
	BatchListResponseStatusExpired    BatchListResponseStatus = "EXPIRED"
	BatchListResponseStatusCancelled  BatchListResponseStatus = "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     BatchNewResponseJob `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 BatchNewResponseJob

type BatchNewResponseJob 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 string `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 (BatchNewResponseJob) RawJSON

func (r BatchNewResponseJob) RawJSON() string

Returns the unmodified JSON received from the API

func (*BatchNewResponseJob) UnmarshalJSON

func (r *BatchNewResponseJob) 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) Get

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

Get details of a batch job by ID

func (*BatchService) List

func (r *BatchService) List(ctx context.Context, opts ...option.RequestOption) (res *[]BatchListResponse, 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"`
	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
		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.
	ResponseFormat ChatCompletionNewParamsResponseFormat `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"`
	// 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 ChatCompletionNewParamsResponseFormat

type ChatCompletionNewParamsResponseFormat struct {
	// The type of the response format.
	Type param.Opt[string] `json:"type,omitzero"`
	// The schema of the response format.
	Schema map[string]any `json:"schema,omitzero"`
	// contains filtered or unexported fields
}

An object specifying the format that the model must output.

func (ChatCompletionNewParamsResponseFormat) MarshalJSON

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

func (*ChatCompletionNewParamsResponseFormat) UnmarshalJSON

func (r *ChatCompletionNewParamsResponseFormat) 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
	FineTune        FineTuneService
	CodeInterpreter CodeInterpreterService
	Images          ImageService
	Videos          VideoService
	Audio           AudioService
	Models          ModelService
	Jobs            JobService
	Endpoints       EndpointService
	Hardware        HardwareService
	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.

func (*Client) Rerank

func (r *Client) Rerank(ctx context.Context, body RerankParams, opts ...option.RequestOption) (res *RerankResponse, err error)

Query a reranker model

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"`
	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
		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 CosineLrSchedulerArgs

type CosineLrSchedulerArgs 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 (CosineLrSchedulerArgs) RawJSON

func (r CosineLrSchedulerArgs) RawJSON() string

Returns the unmodified JSON received from the API

func (CosineLrSchedulerArgs) ToParam

ToParam converts this CosineLrSchedulerArgs to a CosineLrSchedulerArgsParam.

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 CosineLrSchedulerArgsParam.Overrides()

func (*CosineLrSchedulerArgs) UnmarshalJSON

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

type CosineLrSchedulerArgsParam

type CosineLrSchedulerArgsParam 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 (CosineLrSchedulerArgsParam) MarshalJSON

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

func (*CosineLrSchedulerArgsParam) UnmarshalJSON

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

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 EndpointGetResponse

type EndpointGetResponse 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 EndpointGetResponseObject `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 EndpointGetResponseState `json:"state,required"`
	// The type of endpoint
	//
	// Any of "dedicated".
	Type EndpointGetResponseType `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 (EndpointGetResponse) RawJSON

func (r EndpointGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EndpointGetResponse) UnmarshalJSON

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

type EndpointGetResponseObject

type EndpointGetResponseObject string

The type of object

const (
	EndpointGetResponseObjectEndpoint EndpointGetResponseObject = "endpoint"
)

type EndpointGetResponseState

type EndpointGetResponseState string

Current state of the endpoint

const (
	EndpointGetResponseStatePending  EndpointGetResponseState = "PENDING"
	EndpointGetResponseStateStarting EndpointGetResponseState = "STARTING"
	EndpointGetResponseStateStarted  EndpointGetResponseState = "STARTED"
	EndpointGetResponseStateStopping EndpointGetResponseState = "STOPPING"
	EndpointGetResponseStateStopped  EndpointGetResponseState = "STOPPED"
	EndpointGetResponseStateError    EndpointGetResponseState = "ERROR"
)

type EndpointGetResponseType

type EndpointGetResponseType string

The type of endpoint

const (
	EndpointGetResponseTypeDedicated EndpointGetResponseType = "dedicated"
)

type EndpointListParams

type EndpointListParams struct {
	// Filter endpoints by type
	//
	// Any of "dedicated", "serverless".
	Type EndpointListParamsType `query:"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 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"`
	// 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 EndpointNewResponse

type EndpointNewResponse 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 EndpointNewResponseObject `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 EndpointNewResponseState `json:"state,required"`
	// The type of endpoint
	//
	// Any of "dedicated".
	Type EndpointNewResponseType `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 (EndpointNewResponse) RawJSON

func (r EndpointNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EndpointNewResponse) UnmarshalJSON

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

type EndpointNewResponseObject

type EndpointNewResponseObject string

The type of object

const (
	EndpointNewResponseObjectEndpoint EndpointNewResponseObject = "endpoint"
)

type EndpointNewResponseState

type EndpointNewResponseState string

Current state of the endpoint

const (
	EndpointNewResponseStatePending  EndpointNewResponseState = "PENDING"
	EndpointNewResponseStateStarting EndpointNewResponseState = "STARTING"
	EndpointNewResponseStateStarted  EndpointNewResponseState = "STARTED"
	EndpointNewResponseStateStopping EndpointNewResponseState = "STOPPING"
	EndpointNewResponseStateStopped  EndpointNewResponseState = "STOPPED"
	EndpointNewResponseStateError    EndpointNewResponseState = "ERROR"
)

type EndpointNewResponseType

type EndpointNewResponseType string

The type of endpoint

const (
	EndpointNewResponseTypeDedicated EndpointNewResponseType = "dedicated"
)

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 *EndpointGetResponse, 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) 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 *EndpointUpdateResponse, 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 EndpointUpdateResponse

type EndpointUpdateResponse 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 EndpointUpdateResponseObject `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 EndpointUpdateResponseState `json:"state,required"`
	// The type of endpoint
	//
	// Any of "dedicated".
	Type EndpointUpdateResponseType `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 (EndpointUpdateResponse) RawJSON

func (r EndpointUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EndpointUpdateResponse) UnmarshalJSON

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

type EndpointUpdateResponseObject

type EndpointUpdateResponseObject string

The type of object

const (
	EndpointUpdateResponseObjectEndpoint EndpointUpdateResponseObject = "endpoint"
)

type EndpointUpdateResponseState

type EndpointUpdateResponseState string

Current state of the endpoint

const (
	EndpointUpdateResponseStatePending  EndpointUpdateResponseState = "PENDING"
	EndpointUpdateResponseStateStarting EndpointUpdateResponseState = "STARTING"
	EndpointUpdateResponseStateStarted  EndpointUpdateResponseState = "STARTED"
	EndpointUpdateResponseStateStopping EndpointUpdateResponseState = "STOPPING"
	EndpointUpdateResponseStateStopped  EndpointUpdateResponseState = "STOPPED"
	EndpointUpdateResponseStateError    EndpointUpdateResponseState = "ERROR"
)

type EndpointUpdateResponseType

type EndpointUpdateResponseType string

The type of endpoint

const (
	EndpointUpdateResponseTypeDedicated EndpointUpdateResponseType = "dedicated"
)

type Error

type Error = apierror.Error

type EvalGetAllowedModelsResponse

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

func (EvalGetAllowedModelsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetAllowedModelsResponse) UnmarshalJSON

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

type EvalGetResponse

type EvalGetResponse 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 EvalGetResponseResultsUnion `json:"results,nullable"`
	// Current status of the job
	//
	// Any of "pending", "queued", "running", "completed", "error", "user_error".
	Status EvalGetResponseStatus `json:"status"`
	// History of status updates (admin only)
	StatusUpdates []EvalGetResponseStatusUpdate `json:"status_updates"`
	// The type of evaluation
	//
	// Any of "classify", "score", "compare".
	Type EvalGetResponseType `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 (EvalGetResponse) RawJSON

func (r EvalGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalGetResponse) UnmarshalJSON

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

type EvalGetResponseResultsError

type EvalGetResponseResultsError 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 (EvalGetResponseResultsError) RawJSON

func (r EvalGetResponseResultsError) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalGetResponseResultsError) UnmarshalJSON

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

type EvalGetResponseResultsEvaluationClassifyResults

type EvalGetResponseResultsEvaluationClassifyResults 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 (EvalGetResponseResultsEvaluationClassifyResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetResponseResultsEvaluationClassifyResults) UnmarshalJSON

type EvalGetResponseResultsEvaluationCompareResults

type EvalGetResponseResultsEvaluationCompareResults 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 (EvalGetResponseResultsEvaluationCompareResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetResponseResultsEvaluationCompareResults) UnmarshalJSON

type EvalGetResponseResultsEvaluationScoreResults

type EvalGetResponseResultsEvaluationScoreResults struct {
	AggregatedScores EvalGetResponseResultsEvaluationScoreResultsAggregatedScores `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 (EvalGetResponseResultsEvaluationScoreResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetResponseResultsEvaluationScoreResults) UnmarshalJSON

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

type EvalGetResponseResultsEvaluationScoreResultsAggregatedScores

type EvalGetResponseResultsEvaluationScoreResultsAggregatedScores 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 (EvalGetResponseResultsEvaluationScoreResultsAggregatedScores) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetResponseResultsEvaluationScoreResultsAggregatedScores) UnmarshalJSON

type EvalGetResponseResultsUnion

type EvalGetResponseResultsUnion struct {
	GenerationFailCount float64 `json:"generation_fail_count"`
	// This field is from variant [EvalGetResponseResultsEvaluationClassifyResults].
	InvalidLabelCount float64 `json:"invalid_label_count"`
	JudgeFailCount    float64 `json:"judge_fail_count"`
	// This field is from variant [EvalGetResponseResultsEvaluationClassifyResults].
	LabelCounts string `json:"label_counts"`
	// This field is from variant [EvalGetResponseResultsEvaluationClassifyResults].
	PassPercentage float64 `json:"pass_percentage"`
	ResultFileID   string  `json:"result_file_id"`
	// This field is from variant [EvalGetResponseResultsEvaluationScoreResults].
	AggregatedScores EvalGetResponseResultsEvaluationScoreResultsAggregatedScores `json:"aggregated_scores"`
	// This field is from variant [EvalGetResponseResultsEvaluationScoreResults].
	FailedSamples float64 `json:"failed_samples"`
	// This field is from variant [EvalGetResponseResultsEvaluationScoreResults].
	InvalidScoreCount float64 `json:"invalid_score_count"`
	// This field is from variant [EvalGetResponseResultsEvaluationCompareResults].
	AWins int64 `json:"A_wins"`
	// This field is from variant [EvalGetResponseResultsEvaluationCompareResults].
	BWins int64 `json:"B_wins"`
	// This field is from variant [EvalGetResponseResultsEvaluationCompareResults].
	NumSamples int64 `json:"num_samples"`
	// This field is from variant [EvalGetResponseResultsEvaluationCompareResults].
	Ties int64 `json:"Ties"`
	// This field is from variant [EvalGetResponseResultsError].
	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:"-"`
}

EvalGetResponseResultsUnion contains all possible properties and values from EvalGetResponseResultsEvaluationClassifyResults, EvalGetResponseResultsEvaluationScoreResults, EvalGetResponseResultsEvaluationCompareResults, EvalGetResponseResultsError.

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

func (EvalGetResponseResultsUnion) AsEvalGetResponseResultsError

func (u EvalGetResponseResultsUnion) AsEvalGetResponseResultsError() (v EvalGetResponseResultsError)

func (EvalGetResponseResultsUnion) AsEvalGetResponseResultsEvaluationClassifyResults

func (u EvalGetResponseResultsUnion) AsEvalGetResponseResultsEvaluationClassifyResults() (v EvalGetResponseResultsEvaluationClassifyResults)

func (EvalGetResponseResultsUnion) AsEvalGetResponseResultsEvaluationCompareResults

func (u EvalGetResponseResultsUnion) AsEvalGetResponseResultsEvaluationCompareResults() (v EvalGetResponseResultsEvaluationCompareResults)

func (EvalGetResponseResultsUnion) AsEvalGetResponseResultsEvaluationScoreResults

func (u EvalGetResponseResultsUnion) AsEvalGetResponseResultsEvaluationScoreResults() (v EvalGetResponseResultsEvaluationScoreResults)

func (EvalGetResponseResultsUnion) RawJSON

func (u EvalGetResponseResultsUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalGetResponseResultsUnion) UnmarshalJSON

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

type EvalGetResponseStatus

type EvalGetResponseStatus string

Current status of the job

const (
	EvalGetResponseStatusPending   EvalGetResponseStatus = "pending"
	EvalGetResponseStatusQueued    EvalGetResponseStatus = "queued"
	EvalGetResponseStatusRunning   EvalGetResponseStatus = "running"
	EvalGetResponseStatusCompleted EvalGetResponseStatus = "completed"
	EvalGetResponseStatusError     EvalGetResponseStatus = "error"
	EvalGetResponseStatusUserError EvalGetResponseStatus = "user_error"
)

type EvalGetResponseStatusUpdate

type EvalGetResponseStatusUpdate 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 (EvalGetResponseStatusUpdate) RawJSON

func (r EvalGetResponseStatusUpdate) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalGetResponseStatusUpdate) UnmarshalJSON

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

type EvalGetResponseType

type EvalGetResponseType string

The type of evaluation

const (
	EvalGetResponseTypeClassify EvalGetResponseType = "classify"
	EvalGetResponseTypeScore    EvalGetResponseType = "score"
	EvalGetResponseTypeCompare  EvalGetResponseType = "compare"
)

type EvalGetStatusResponse

type EvalGetStatusResponse struct {
	Results EvalGetStatusResponseResultsUnion `json:"results,nullable"`
	// Any of "pending", "queued", "running", "completed", "error", "user_error".
	Status EvalGetStatusResponseStatus `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 (EvalGetStatusResponse) RawJSON

func (r EvalGetStatusResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalGetStatusResponse) UnmarshalJSON

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

type EvalGetStatusResponseResultsError

type EvalGetStatusResponseResultsError 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 (EvalGetStatusResponseResultsError) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetStatusResponseResultsError) UnmarshalJSON

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

type EvalGetStatusResponseResultsEvaluationClassifyResults

type EvalGetStatusResponseResultsEvaluationClassifyResults 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 (EvalGetStatusResponseResultsEvaluationClassifyResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetStatusResponseResultsEvaluationClassifyResults) UnmarshalJSON

type EvalGetStatusResponseResultsEvaluationCompareResults

type EvalGetStatusResponseResultsEvaluationCompareResults 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 (EvalGetStatusResponseResultsEvaluationCompareResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetStatusResponseResultsEvaluationCompareResults) UnmarshalJSON

type EvalGetStatusResponseResultsEvaluationScoreResults

type EvalGetStatusResponseResultsEvaluationScoreResults struct {
	AggregatedScores EvalGetStatusResponseResultsEvaluationScoreResultsAggregatedScores `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 (EvalGetStatusResponseResultsEvaluationScoreResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetStatusResponseResultsEvaluationScoreResults) UnmarshalJSON

type EvalGetStatusResponseResultsEvaluationScoreResultsAggregatedScores

type EvalGetStatusResponseResultsEvaluationScoreResultsAggregatedScores 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 (EvalGetStatusResponseResultsEvaluationScoreResultsAggregatedScores) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetStatusResponseResultsEvaluationScoreResultsAggregatedScores) UnmarshalJSON

type EvalGetStatusResponseResultsUnion

type EvalGetStatusResponseResultsUnion struct {
	GenerationFailCount float64 `json:"generation_fail_count"`
	// This field is from variant
	// [EvalGetStatusResponseResultsEvaluationClassifyResults].
	InvalidLabelCount float64 `json:"invalid_label_count"`
	JudgeFailCount    float64 `json:"judge_fail_count"`
	// This field is from variant
	// [EvalGetStatusResponseResultsEvaluationClassifyResults].
	LabelCounts string `json:"label_counts"`
	// This field is from variant
	// [EvalGetStatusResponseResultsEvaluationClassifyResults].
	PassPercentage float64 `json:"pass_percentage"`
	ResultFileID   string  `json:"result_file_id"`
	// This field is from variant [EvalGetStatusResponseResultsEvaluationScoreResults].
	AggregatedScores EvalGetStatusResponseResultsEvaluationScoreResultsAggregatedScores `json:"aggregated_scores"`
	// This field is from variant [EvalGetStatusResponseResultsEvaluationScoreResults].
	FailedSamples float64 `json:"failed_samples"`
	// This field is from variant [EvalGetStatusResponseResultsEvaluationScoreResults].
	InvalidScoreCount float64 `json:"invalid_score_count"`
	// This field is from variant
	// [EvalGetStatusResponseResultsEvaluationCompareResults].
	AWins int64 `json:"A_wins"`
	// This field is from variant
	// [EvalGetStatusResponseResultsEvaluationCompareResults].
	BWins int64 `json:"B_wins"`
	// This field is from variant
	// [EvalGetStatusResponseResultsEvaluationCompareResults].
	NumSamples int64 `json:"num_samples"`
	// This field is from variant
	// [EvalGetStatusResponseResultsEvaluationCompareResults].
	Ties int64 `json:"Ties"`
	// This field is from variant [EvalGetStatusResponseResultsError].
	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:"-"`
}

EvalGetStatusResponseResultsUnion contains all possible properties and values from EvalGetStatusResponseResultsEvaluationClassifyResults, EvalGetStatusResponseResultsEvaluationScoreResults, EvalGetStatusResponseResultsEvaluationCompareResults, EvalGetStatusResponseResultsError.

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

func (EvalGetStatusResponseResultsUnion) AsEvalGetStatusResponseResultsError

func (u EvalGetStatusResponseResultsUnion) AsEvalGetStatusResponseResultsError() (v EvalGetStatusResponseResultsError)

func (EvalGetStatusResponseResultsUnion) AsEvalGetStatusResponseResultsEvaluationClassifyResults

func (u EvalGetStatusResponseResultsUnion) AsEvalGetStatusResponseResultsEvaluationClassifyResults() (v EvalGetStatusResponseResultsEvaluationClassifyResults)

func (EvalGetStatusResponseResultsUnion) AsEvalGetStatusResponseResultsEvaluationCompareResults

func (u EvalGetStatusResponseResultsUnion) AsEvalGetStatusResponseResultsEvaluationCompareResults() (v EvalGetStatusResponseResultsEvaluationCompareResults)

func (EvalGetStatusResponseResultsUnion) AsEvalGetStatusResponseResultsEvaluationScoreResults

func (u EvalGetStatusResponseResultsUnion) AsEvalGetStatusResponseResultsEvaluationScoreResults() (v EvalGetStatusResponseResultsEvaluationScoreResults)

func (EvalGetStatusResponseResultsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*EvalGetStatusResponseResultsUnion) UnmarshalJSON

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

type EvalGetStatusResponseStatus

type EvalGetStatusResponseStatus string
const (
	EvalGetStatusResponseStatusPending   EvalGetStatusResponseStatus = "pending"
	EvalGetStatusResponseStatusQueued    EvalGetStatusResponseStatus = "queued"
	EvalGetStatusResponseStatusRunning   EvalGetStatusResponseStatus = "running"
	EvalGetStatusResponseStatusCompleted EvalGetStatusResponseStatus = "completed"
	EvalGetStatusResponseStatusError     EvalGetStatusResponseStatus = "error"
	EvalGetStatusResponseStatusUserError EvalGetStatusResponseStatus = "user_error"
)

type EvalListParams

type EvalListParams struct {
	// Maximum number of results to return (max 100)
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Filter by job status
	//
	// Any of "pending", "queued", "running", "completed", "error", "user_error".
	Status EvalListParamsStatus `query:"status,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 EvalListParamsStatus

type EvalListParamsStatus string

Filter by job status

const (
	EvalListParamsStatusPending   EvalListParamsStatus = "pending"
	EvalListParamsStatusQueued    EvalListParamsStatus = "queued"
	EvalListParamsStatusRunning   EvalListParamsStatus = "running"
	EvalListParamsStatusCompleted EvalListParamsStatus = "completed"
	EvalListParamsStatusError     EvalListParamsStatus = "error"
	EvalListParamsStatusUserError EvalListParamsStatus = "user_error"
)

type EvalListResponse

type EvalListResponse 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 EvalListResponseResultsUnion `json:"results,nullable"`
	// Current status of the job
	//
	// Any of "pending", "queued", "running", "completed", "error", "user_error".
	Status EvalListResponseStatus `json:"status"`
	// History of status updates (admin only)
	StatusUpdates []EvalListResponseStatusUpdate `json:"status_updates"`
	// The type of evaluation
	//
	// Any of "classify", "score", "compare".
	Type EvalListResponseType `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 (EvalListResponse) RawJSON

func (r EvalListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*EvalListResponse) UnmarshalJSON

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

type EvalListResponseResultsError

type EvalListResponseResultsError 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 (EvalListResponseResultsError) RawJSON

Returns the unmodified JSON received from the API

func (*EvalListResponseResultsError) UnmarshalJSON

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

type EvalListResponseResultsEvaluationClassifyResults

type EvalListResponseResultsEvaluationClassifyResults 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 (EvalListResponseResultsEvaluationClassifyResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalListResponseResultsEvaluationClassifyResults) UnmarshalJSON

type EvalListResponseResultsEvaluationCompareResults

type EvalListResponseResultsEvaluationCompareResults 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 (EvalListResponseResultsEvaluationCompareResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalListResponseResultsEvaluationCompareResults) UnmarshalJSON

type EvalListResponseResultsEvaluationScoreResults

type EvalListResponseResultsEvaluationScoreResults struct {
	AggregatedScores EvalListResponseResultsEvaluationScoreResultsAggregatedScores `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 (EvalListResponseResultsEvaluationScoreResults) RawJSON

Returns the unmodified JSON received from the API

func (*EvalListResponseResultsEvaluationScoreResults) UnmarshalJSON

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

type EvalListResponseResultsEvaluationScoreResultsAggregatedScores

type EvalListResponseResultsEvaluationScoreResultsAggregatedScores 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 (EvalListResponseResultsEvaluationScoreResultsAggregatedScores) RawJSON

Returns the unmodified JSON received from the API

func (*EvalListResponseResultsEvaluationScoreResultsAggregatedScores) UnmarshalJSON

type EvalListResponseResultsUnion

type EvalListResponseResultsUnion struct {
	GenerationFailCount float64 `json:"generation_fail_count"`
	// This field is from variant [EvalListResponseResultsEvaluationClassifyResults].
	InvalidLabelCount float64 `json:"invalid_label_count"`
	JudgeFailCount    float64 `json:"judge_fail_count"`
	// This field is from variant [EvalListResponseResultsEvaluationClassifyResults].
	LabelCounts string `json:"label_counts"`
	// This field is from variant [EvalListResponseResultsEvaluationClassifyResults].
	PassPercentage float64 `json:"pass_percentage"`
	ResultFileID   string  `json:"result_file_id"`
	// This field is from variant [EvalListResponseResultsEvaluationScoreResults].
	AggregatedScores EvalListResponseResultsEvaluationScoreResultsAggregatedScores `json:"aggregated_scores"`
	// This field is from variant [EvalListResponseResultsEvaluationScoreResults].
	FailedSamples float64 `json:"failed_samples"`
	// This field is from variant [EvalListResponseResultsEvaluationScoreResults].
	InvalidScoreCount float64 `json:"invalid_score_count"`
	// This field is from variant [EvalListResponseResultsEvaluationCompareResults].
	AWins int64 `json:"A_wins"`
	// This field is from variant [EvalListResponseResultsEvaluationCompareResults].
	BWins int64 `json:"B_wins"`
	// This field is from variant [EvalListResponseResultsEvaluationCompareResults].
	NumSamples int64 `json:"num_samples"`
	// This field is from variant [EvalListResponseResultsEvaluationCompareResults].
	Ties int64 `json:"Ties"`
	// This field is from variant [EvalListResponseResultsError].
	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:"-"`
}

EvalListResponseResultsUnion contains all possible properties and values from EvalListResponseResultsEvaluationClassifyResults, EvalListResponseResultsEvaluationScoreResults, EvalListResponseResultsEvaluationCompareResults, EvalListResponseResultsError.

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

func (EvalListResponseResultsUnion) AsEvalListResponseResultsError

func (u EvalListResponseResultsUnion) AsEvalListResponseResultsError() (v EvalListResponseResultsError)

func (EvalListResponseResultsUnion) AsEvalListResponseResultsEvaluationClassifyResults

func (u EvalListResponseResultsUnion) AsEvalListResponseResultsEvaluationClassifyResults() (v EvalListResponseResultsEvaluationClassifyResults)

func (EvalListResponseResultsUnion) AsEvalListResponseResultsEvaluationCompareResults

func (u EvalListResponseResultsUnion) AsEvalListResponseResultsEvaluationCompareResults() (v EvalListResponseResultsEvaluationCompareResults)

func (EvalListResponseResultsUnion) AsEvalListResponseResultsEvaluationScoreResults

func (u EvalListResponseResultsUnion) AsEvalListResponseResultsEvaluationScoreResults() (v EvalListResponseResultsEvaluationScoreResults)

func (EvalListResponseResultsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*EvalListResponseResultsUnion) UnmarshalJSON

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

type EvalListResponseStatus

type EvalListResponseStatus string

Current status of the job

const (
	EvalListResponseStatusPending   EvalListResponseStatus = "pending"
	EvalListResponseStatusQueued    EvalListResponseStatus = "queued"
	EvalListResponseStatusRunning   EvalListResponseStatus = "running"
	EvalListResponseStatusCompleted EvalListResponseStatus = "completed"
	EvalListResponseStatusError     EvalListResponseStatus = "error"
	EvalListResponseStatusUserError EvalListResponseStatus = "user_error"
)

type EvalListResponseStatusUpdate

type EvalListResponseStatusUpdate 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 (EvalListResponseStatusUpdate) RawJSON

Returns the unmodified JSON received from the API

func (*EvalListResponseStatusUpdate) UnmarshalJSON

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

type EvalListResponseType

type EvalListResponseType string

The type of evaluation

const (
	EvalListResponseTypeClassify EvalListResponseType = "classify"
	EvalListResponseTypeScore    EvalListResponseType = "score"
	EvalListResponseTypeCompare  EvalListResponseType = "compare"
)

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 *EvalGetResponse, err error)

Get details of a specific evaluation job

func (*EvalService) GetAllowedModels

func (r *EvalService) GetAllowedModels(ctx context.Context, opts ...option.RequestOption) (res *EvalGetAllowedModelsResponse, err error)

Get the list of models that are allowed for evaluation

func (*EvalService) GetStatus

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

Get the status and results of a specific evaluation job

func (*EvalService) List

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

Get a list of evaluation jobs with optional filtering

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 FileGetResponse

type FileGetResponse 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 (FileGetResponse) RawJSON

func (r FileGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileGetResponse) UnmarshalJSON

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

type FileListResponse

type FileListResponse struct {
	Data []FileListResponseData `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 (FileListResponse) RawJSON

func (r FileListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileListResponse) UnmarshalJSON

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

type FileListResponseData

type FileListResponseData 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 (FileListResponseData) RawJSON

func (r FileListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileListResponseData) UnmarshalJSON

func (r *FileListResponseData) 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 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 *FileGetResponse, 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 *FileListResponse, 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 *FileUploadResponse, 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 FileUploadResponse

type FileUploadResponse 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 (FileUploadResponse) RawJSON

func (r FileUploadResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileUploadResponse) UnmarshalJSON

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

type FineTune

type FineTune struct {
	ID string `json:"id,required" format:"uuid"`
	// Any of "pending", "queued", "running", "compressing", "uploading",
	// "cancel_requested", "cancelled", "error", "completed".
	Status               FineTuneStatus              `json:"status,required"`
	BatchSize            FineTuneBatchSizeUnion      `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          LrScheduler                 `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        FineTuneTrainOnInputsUnion  `json:"train_on_inputs"`
	TrainingFile         string                      `json:"training_file"`
	TrainingMethod       FineTuneTrainingMethodUnion `json:"training_method"`
	TrainingType         FineTuneTrainingTypeUnion   `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 (FineTune) RawJSON

func (r FineTune) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTune) UnmarshalJSON

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

type FineTuneBatchSizeString

type FineTuneBatchSizeString string
const (
	FineTuneBatchSizeStringMax FineTuneBatchSizeString = "max"
)

type FineTuneBatchSizeUnion

type FineTuneBatchSizeUnion 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.
	OfFineTuneBatchSizeString string `json:",inline"`
	JSON                      struct {
		OfInt                     respjson.Field
		OfFineTuneBatchSizeString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuneBatchSizeUnion 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 OfFineTuneBatchSizeString]

func (FineTuneBatchSizeUnion) AsFineTuneBatchSizeString

func (u FineTuneBatchSizeUnion) AsFineTuneBatchSizeString() (v string)

func (FineTuneBatchSizeUnion) AsInt

func (u FineTuneBatchSizeUnion) AsInt() (v int64)

func (FineTuneBatchSizeUnion) RawJSON

func (u FineTuneBatchSizeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneBatchSizeUnion) UnmarshalJSON

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

type FineTuneCancelResponse

type FineTuneCancelResponse 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 FineTuneCancelResponseStatus `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 LrScheduler `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 FineTuneCancelResponseTrainingMethodUnion `json:"training_method"`
	// Type of training used (full or LoRA)
	TrainingType FineTuneCancelResponseTrainingTypeUnion `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 (FineTuneCancelResponse) RawJSON

func (r FineTuneCancelResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneCancelResponse) UnmarshalJSON

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

type FineTuneCancelResponseStatus

type FineTuneCancelResponseStatus string
const (
	FineTuneCancelResponseStatusPending         FineTuneCancelResponseStatus = "pending"
	FineTuneCancelResponseStatusQueued          FineTuneCancelResponseStatus = "queued"
	FineTuneCancelResponseStatusRunning         FineTuneCancelResponseStatus = "running"
	FineTuneCancelResponseStatusCompressing     FineTuneCancelResponseStatus = "compressing"
	FineTuneCancelResponseStatusUploading       FineTuneCancelResponseStatus = "uploading"
	FineTuneCancelResponseStatusCancelRequested FineTuneCancelResponseStatus = "cancel_requested"
	FineTuneCancelResponseStatusCancelled       FineTuneCancelResponseStatus = "cancelled"
	FineTuneCancelResponseStatusError           FineTuneCancelResponseStatus = "error"
	FineTuneCancelResponseStatusCompleted       FineTuneCancelResponseStatus = "completed"
)

type FineTuneCancelResponseTrainingMethodUnion

type FineTuneCancelResponseTrainingMethodUnion struct {
	Method string `json:"method"`
	// This field is from variant [TrainingMethodSft].
	TrainOnInputs TrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs"`
	// This field is from variant [TrainingMethodDpo].
	DpoBeta float64 `json:"dpo_beta"`
	// This field is from variant [TrainingMethodDpo].
	DpoNormalizeLogratiosByLength bool `json:"dpo_normalize_logratios_by_length"`
	// This field is from variant [TrainingMethodDpo].
	DpoReferenceFree bool `json:"dpo_reference_free"`
	// This field is from variant [TrainingMethodDpo].
	RpoAlpha float64 `json:"rpo_alpha"`
	// This field is from variant [TrainingMethodDpo].
	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:"-"`
}

FineTuneCancelResponseTrainingMethodUnion contains all possible properties and values from TrainingMethodSft, TrainingMethodDpo.

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

func (FineTuneCancelResponseTrainingMethodUnion) AsTrainingMethodDpo

func (FineTuneCancelResponseTrainingMethodUnion) AsTrainingMethodSft

func (FineTuneCancelResponseTrainingMethodUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuneCancelResponseTrainingMethodUnion) UnmarshalJSON

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

type FineTuneCancelResponseTrainingTypeUnion

type FineTuneCancelResponseTrainingTypeUnion struct {
	Type string `json:"type"`
	// This field is from variant [LoRaTrainingType].
	LoraAlpha int64 `json:"lora_alpha"`
	// This field is from variant [LoRaTrainingType].
	LoraR int64 `json:"lora_r"`
	// This field is from variant [LoRaTrainingType].
	LoraDropout float64 `json:"lora_dropout"`
	// This field is from variant [LoRaTrainingType].
	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:"-"`
}

FineTuneCancelResponseTrainingTypeUnion contains all possible properties and values from FullTrainingType, LoRaTrainingType.

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

func (FineTuneCancelResponseTrainingTypeUnion) AsFullTrainingType

func (u FineTuneCancelResponseTrainingTypeUnion) AsFullTrainingType() (v FullTrainingType)

func (FineTuneCancelResponseTrainingTypeUnion) AsLoRaTrainingType

func (u FineTuneCancelResponseTrainingTypeUnion) AsLoRaTrainingType() (v LoRaTrainingType)

func (FineTuneCancelResponseTrainingTypeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuneCancelResponseTrainingTypeUnion) UnmarshalJSON

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

type FineTuneDownloadParams

type FineTuneDownloadParams 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 output file name for downloaded model. Defaults to
	// `$PWD/{model_name}.{extension}`.
	Output param.Opt[string] `query:"output,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".
	Checkpoint FineTuneDownloadParamsCheckpoint `query:"checkpoint,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (FineTuneDownloadParams) URLQuery

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

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

type FineTuneDownloadParamsCheckpoint

type FineTuneDownloadParamsCheckpoint string

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

const (
	FineTuneDownloadParamsCheckpointMerged  FineTuneDownloadParamsCheckpoint = "merged"
	FineTuneDownloadParamsCheckpointAdapter FineTuneDownloadParamsCheckpoint = "adapter"
)

type FineTuneDownloadResponse

type FineTuneDownloadResponse struct {
	ID             string `json:"id"`
	CheckpointStep int64  `json:"checkpoint_step"`
	Filename       string `json:"filename"`
	// Any of "local".
	Object FineTuneDownloadResponseObject `json:"object,nullable"`
	Size   int64                          `json:"size"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		CheckpointStep respjson.Field
		Filename       respjson.Field
		Object         respjson.Field
		Size           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FineTuneDownloadResponse) RawJSON

func (r FineTuneDownloadResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneDownloadResponse) UnmarshalJSON

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

type FineTuneDownloadResponseObject

type FineTuneDownloadResponseObject string
const (
	FineTuneDownloadResponseObjectLocal FineTuneDownloadResponseObject = "local"
)

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 FineTuneGetCheckpointsResponse

type FineTuneGetCheckpointsResponse struct {
	Data []FineTuneGetCheckpointsResponseData `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 (FineTuneGetCheckpointsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuneGetCheckpointsResponse) UnmarshalJSON

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

type FineTuneGetCheckpointsResponseData

type FineTuneGetCheckpointsResponseData 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 (FineTuneGetCheckpointsResponseData) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuneGetCheckpointsResponseData) UnmarshalJSON

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

type FineTuneListEventsResponse

type FineTuneListEventsResponse 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 (FineTuneListEventsResponse) RawJSON

func (r FineTuneListEventsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneListEventsResponse) UnmarshalJSON

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

type FineTuneListResponse

type FineTuneListResponse struct {
	Data []FineTuneListResponseData `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 (FineTuneListResponse) RawJSON

func (r FineTuneListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneListResponse) UnmarshalJSON

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

type FineTuneListResponseData

type FineTuneListResponseData 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 LrScheduler `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 FineTuneListResponseDataTrainingMethodUnion `json:"training_method"`
	// Type of training used (full or LoRA)
	TrainingType FineTuneListResponseDataTrainingTypeUnion `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 (FineTuneListResponseData) RawJSON

func (r FineTuneListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneListResponseData) UnmarshalJSON

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

type FineTuneListResponseDataTrainingMethodUnion

type FineTuneListResponseDataTrainingMethodUnion struct {
	Method string `json:"method"`
	// This field is from variant [TrainingMethodSft].
	TrainOnInputs TrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs"`
	// This field is from variant [TrainingMethodDpo].
	DpoBeta float64 `json:"dpo_beta"`
	// This field is from variant [TrainingMethodDpo].
	DpoNormalizeLogratiosByLength bool `json:"dpo_normalize_logratios_by_length"`
	// This field is from variant [TrainingMethodDpo].
	DpoReferenceFree bool `json:"dpo_reference_free"`
	// This field is from variant [TrainingMethodDpo].
	RpoAlpha float64 `json:"rpo_alpha"`
	// This field is from variant [TrainingMethodDpo].
	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:"-"`
}

FineTuneListResponseDataTrainingMethodUnion contains all possible properties and values from TrainingMethodSft, TrainingMethodDpo.

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

func (FineTuneListResponseDataTrainingMethodUnion) AsTrainingMethodDpo

func (FineTuneListResponseDataTrainingMethodUnion) AsTrainingMethodSft

func (FineTuneListResponseDataTrainingMethodUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuneListResponseDataTrainingMethodUnion) UnmarshalJSON

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

type FineTuneListResponseDataTrainingTypeUnion

type FineTuneListResponseDataTrainingTypeUnion struct {
	Type string `json:"type"`
	// This field is from variant [LoRaTrainingType].
	LoraAlpha int64 `json:"lora_alpha"`
	// This field is from variant [LoRaTrainingType].
	LoraR int64 `json:"lora_r"`
	// This field is from variant [LoRaTrainingType].
	LoraDropout float64 `json:"lora_dropout"`
	// This field is from variant [LoRaTrainingType].
	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:"-"`
}

FineTuneListResponseDataTrainingTypeUnion contains all possible properties and values from FullTrainingType, LoRaTrainingType.

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

func (FineTuneListResponseDataTrainingTypeUnion) AsFullTrainingType

func (FineTuneListResponseDataTrainingTypeUnion) AsLoRaTrainingType

func (FineTuneListResponseDataTrainingTypeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuneListResponseDataTrainingTypeUnion) UnmarshalJSON

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

type FineTuneNewParams

type FineTuneNewParams 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 FineTuneNewParamsBatchSizeUnion `json:"batch_size,omitzero"`
	// The learning rate scheduler to use. It specifies how the learning rate is
	// adjusted during training.
	LrScheduler LrSchedulerParam `json:"lr_scheduler,omitzero"`
	// Whether to mask the user messages in conversational data or prompts in
	// instruction data.
	TrainOnInputs FineTuneNewParamsTrainOnInputsUnion `json:"train_on_inputs,omitzero"`
	// The training method to use. 'sft' for Supervised Fine-Tuning or 'dpo' for Direct
	// Preference Optimization.
	TrainingMethod FineTuneNewParamsTrainingMethodUnion `json:"training_method,omitzero"`
	TrainingType   FineTuneNewParamsTrainingTypeUnion   `json:"training_type,omitzero"`
	// contains filtered or unexported fields
}

func (FineTuneNewParams) MarshalJSON

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

func (*FineTuneNewParams) UnmarshalJSON

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

type FineTuneNewParamsBatchSizeString

type FineTuneNewParamsBatchSizeString string
const (
	FineTuneNewParamsBatchSizeStringMax FineTuneNewParamsBatchSizeString = "max"
)

type FineTuneNewParamsBatchSizeUnion

type FineTuneNewParamsBatchSizeUnion struct {
	OfInt param.Opt[int64] `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfFineTuneNewsBatchSizeString)
	OfFineTuneNewsBatchSizeString 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 (FineTuneNewParamsBatchSizeUnion) MarshalJSON

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

func (*FineTuneNewParamsBatchSizeUnion) UnmarshalJSON

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

type FineTuneNewParamsTrainOnInputsString

type FineTuneNewParamsTrainOnInputsString string
const (
	FineTuneNewParamsTrainOnInputsStringAuto FineTuneNewParamsTrainOnInputsString = "auto"
)

type FineTuneNewParamsTrainOnInputsUnion

type FineTuneNewParamsTrainOnInputsUnion struct {
	OfBool param.Opt[bool] `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfFineTuneNewsTrainOnInputsString)
	OfFineTuneNewsTrainOnInputsString 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 (FineTuneNewParamsTrainOnInputsUnion) MarshalJSON

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

func (*FineTuneNewParamsTrainOnInputsUnion) UnmarshalJSON

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

type FineTuneNewParamsTrainingMethodUnion

type FineTuneNewParamsTrainingMethodUnion struct {
	OfTrainingMethodSft *TrainingMethodSftParam `json:",omitzero,inline"`
	OfTrainingMethodDpo *TrainingMethodDpoParam `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 (FineTuneNewParamsTrainingMethodUnion) GetDpoBeta

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

func (FineTuneNewParamsTrainingMethodUnion) GetDpoNormalizeLogratiosByLength

func (u FineTuneNewParamsTrainingMethodUnion) GetDpoNormalizeLogratiosByLength() *bool

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

func (FineTuneNewParamsTrainingMethodUnion) GetDpoReferenceFree

func (u FineTuneNewParamsTrainingMethodUnion) GetDpoReferenceFree() *bool

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

func (FineTuneNewParamsTrainingMethodUnion) GetMethod

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

func (FineTuneNewParamsTrainingMethodUnion) GetRpoAlpha

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

func (FineTuneNewParamsTrainingMethodUnion) GetSimpoGamma

func (u FineTuneNewParamsTrainingMethodUnion) GetSimpoGamma() *float64

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

func (FineTuneNewParamsTrainingMethodUnion) GetTrainOnInputs

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

func (FineTuneNewParamsTrainingMethodUnion) MarshalJSON

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

func (*FineTuneNewParamsTrainingMethodUnion) UnmarshalJSON

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

type FineTuneNewParamsTrainingTypeUnion

type FineTuneNewParamsTrainingTypeUnion struct {
	OfFullTrainingType *FullTrainingTypeParam `json:",omitzero,inline"`
	OfLoRaTrainingType *LoRaTrainingTypeParam `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 (FineTuneNewParamsTrainingTypeUnion) GetLoraAlpha

func (u FineTuneNewParamsTrainingTypeUnion) GetLoraAlpha() *int64

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

func (FineTuneNewParamsTrainingTypeUnion) GetLoraDropout

func (u FineTuneNewParamsTrainingTypeUnion) GetLoraDropout() *float64

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

func (FineTuneNewParamsTrainingTypeUnion) GetLoraR

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

func (FineTuneNewParamsTrainingTypeUnion) GetLoraTrainableModules

func (u FineTuneNewParamsTrainingTypeUnion) GetLoraTrainableModules() *string

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

func (FineTuneNewParamsTrainingTypeUnion) GetType

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

func (FineTuneNewParamsTrainingTypeUnion) MarshalJSON

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

func (*FineTuneNewParamsTrainingTypeUnion) UnmarshalJSON

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

type FineTuneNewResponse

type FineTuneNewResponse 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 FineTuneNewResponseStatus `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 LrScheduler `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 FineTuneNewResponseTrainingMethodUnion `json:"training_method"`
	// Type of training used (full or LoRA)
	TrainingType FineTuneNewResponseTrainingTypeUnion `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 (FineTuneNewResponse) RawJSON

func (r FineTuneNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneNewResponse) UnmarshalJSON

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

type FineTuneNewResponseStatus

type FineTuneNewResponseStatus string
const (
	FineTuneNewResponseStatusPending         FineTuneNewResponseStatus = "pending"
	FineTuneNewResponseStatusQueued          FineTuneNewResponseStatus = "queued"
	FineTuneNewResponseStatusRunning         FineTuneNewResponseStatus = "running"
	FineTuneNewResponseStatusCompressing     FineTuneNewResponseStatus = "compressing"
	FineTuneNewResponseStatusUploading       FineTuneNewResponseStatus = "uploading"
	FineTuneNewResponseStatusCancelRequested FineTuneNewResponseStatus = "cancel_requested"
	FineTuneNewResponseStatusCancelled       FineTuneNewResponseStatus = "cancelled"
	FineTuneNewResponseStatusError           FineTuneNewResponseStatus = "error"
	FineTuneNewResponseStatusCompleted       FineTuneNewResponseStatus = "completed"
)

type FineTuneNewResponseTrainingMethodUnion

type FineTuneNewResponseTrainingMethodUnion struct {
	Method string `json:"method"`
	// This field is from variant [TrainingMethodSft].
	TrainOnInputs TrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs"`
	// This field is from variant [TrainingMethodDpo].
	DpoBeta float64 `json:"dpo_beta"`
	// This field is from variant [TrainingMethodDpo].
	DpoNormalizeLogratiosByLength bool `json:"dpo_normalize_logratios_by_length"`
	// This field is from variant [TrainingMethodDpo].
	DpoReferenceFree bool `json:"dpo_reference_free"`
	// This field is from variant [TrainingMethodDpo].
	RpoAlpha float64 `json:"rpo_alpha"`
	// This field is from variant [TrainingMethodDpo].
	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:"-"`
}

FineTuneNewResponseTrainingMethodUnion contains all possible properties and values from TrainingMethodSft, TrainingMethodDpo.

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

func (FineTuneNewResponseTrainingMethodUnion) AsTrainingMethodDpo

func (u FineTuneNewResponseTrainingMethodUnion) AsTrainingMethodDpo() (v TrainingMethodDpo)

func (FineTuneNewResponseTrainingMethodUnion) AsTrainingMethodSft

func (u FineTuneNewResponseTrainingMethodUnion) AsTrainingMethodSft() (v TrainingMethodSft)

func (FineTuneNewResponseTrainingMethodUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuneNewResponseTrainingMethodUnion) UnmarshalJSON

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

type FineTuneNewResponseTrainingTypeUnion

type FineTuneNewResponseTrainingTypeUnion struct {
	Type string `json:"type"`
	// This field is from variant [LoRaTrainingType].
	LoraAlpha int64 `json:"lora_alpha"`
	// This field is from variant [LoRaTrainingType].
	LoraR int64 `json:"lora_r"`
	// This field is from variant [LoRaTrainingType].
	LoraDropout float64 `json:"lora_dropout"`
	// This field is from variant [LoRaTrainingType].
	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:"-"`
}

FineTuneNewResponseTrainingTypeUnion contains all possible properties and values from FullTrainingType, LoRaTrainingType.

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

func (FineTuneNewResponseTrainingTypeUnion) AsFullTrainingType

func (u FineTuneNewResponseTrainingTypeUnion) AsFullTrainingType() (v FullTrainingType)

func (FineTuneNewResponseTrainingTypeUnion) AsLoRaTrainingType

func (u FineTuneNewResponseTrainingTypeUnion) AsLoRaTrainingType() (v LoRaTrainingType)

func (FineTuneNewResponseTrainingTypeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*FineTuneNewResponseTrainingTypeUnion) UnmarshalJSON

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

type FineTuneService

type FineTuneService struct {
	Options []option.RequestOption
}

FineTuneService 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 NewFineTuneService method instead.

func NewFineTuneService

func NewFineTuneService(opts ...option.RequestOption) (r FineTuneService)

NewFineTuneService 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 (*FineTuneService) Cancel

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

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

func (*FineTuneService) Download

Download a compressed fine-tuned model or checkpoint to local disk.

func (*FineTuneService) Get

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

List the metadata for a single fine-tuning job.

func (*FineTuneService) GetCheckpoints

func (r *FineTuneService) GetCheckpoints(ctx context.Context, id string, opts ...option.RequestOption) (res *FineTuneGetCheckpointsResponse, err error)

List the checkpoints for a single fine-tuning job.

func (*FineTuneService) List

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

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

func (*FineTuneService) ListEvents

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

List the events for a single fine-tuning job.

func (*FineTuneService) New

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

type FineTuneStatus

type FineTuneStatus string
const (
	FineTuneStatusPending         FineTuneStatus = "pending"
	FineTuneStatusQueued          FineTuneStatus = "queued"
	FineTuneStatusRunning         FineTuneStatus = "running"
	FineTuneStatusCompressing     FineTuneStatus = "compressing"
	FineTuneStatusUploading       FineTuneStatus = "uploading"
	FineTuneStatusCancelRequested FineTuneStatus = "cancel_requested"
	FineTuneStatusCancelled       FineTuneStatus = "cancelled"
	FineTuneStatusError           FineTuneStatus = "error"
	FineTuneStatusCompleted       FineTuneStatus = "completed"
)

type FineTuneTrainOnInputsString

type FineTuneTrainOnInputsString string
const (
	FineTuneTrainOnInputsStringAuto FineTuneTrainOnInputsString = "auto"
)

type FineTuneTrainOnInputsUnion

type FineTuneTrainOnInputsUnion 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.
	OfFineTuneTrainOnInputsString string `json:",inline"`
	JSON                          struct {
		OfBool                        respjson.Field
		OfFineTuneTrainOnInputsString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FineTuneTrainOnInputsUnion 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 OfFineTuneTrainOnInputsString]

func (FineTuneTrainOnInputsUnion) AsBool

func (u FineTuneTrainOnInputsUnion) AsBool() (v bool)

func (FineTuneTrainOnInputsUnion) AsFineTuneTrainOnInputsString

func (u FineTuneTrainOnInputsUnion) AsFineTuneTrainOnInputsString() (v string)

func (FineTuneTrainOnInputsUnion) RawJSON

func (u FineTuneTrainOnInputsUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneTrainOnInputsUnion) UnmarshalJSON

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

type FineTuneTrainingMethodUnion

type FineTuneTrainingMethodUnion struct {
	Method string `json:"method"`
	// This field is from variant [TrainingMethodSft].
	TrainOnInputs TrainingMethodSftTrainOnInputsUnion `json:"train_on_inputs"`
	// This field is from variant [TrainingMethodDpo].
	DpoBeta float64 `json:"dpo_beta"`
	// This field is from variant [TrainingMethodDpo].
	DpoNormalizeLogratiosByLength bool `json:"dpo_normalize_logratios_by_length"`
	// This field is from variant [TrainingMethodDpo].
	DpoReferenceFree bool `json:"dpo_reference_free"`
	// This field is from variant [TrainingMethodDpo].
	RpoAlpha float64 `json:"rpo_alpha"`
	// This field is from variant [TrainingMethodDpo].
	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:"-"`
}

FineTuneTrainingMethodUnion contains all possible properties and values from TrainingMethodSft, TrainingMethodDpo.

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

func (FineTuneTrainingMethodUnion) AsTrainingMethodDpo

func (u FineTuneTrainingMethodUnion) AsTrainingMethodDpo() (v TrainingMethodDpo)

func (FineTuneTrainingMethodUnion) AsTrainingMethodSft

func (u FineTuneTrainingMethodUnion) AsTrainingMethodSft() (v TrainingMethodSft)

func (FineTuneTrainingMethodUnion) RawJSON

func (u FineTuneTrainingMethodUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneTrainingMethodUnion) UnmarshalJSON

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

type FineTuneTrainingTypeUnion

type FineTuneTrainingTypeUnion struct {
	Type string `json:"type"`
	// This field is from variant [LoRaTrainingType].
	LoraAlpha int64 `json:"lora_alpha"`
	// This field is from variant [LoRaTrainingType].
	LoraR int64 `json:"lora_r"`
	// This field is from variant [LoRaTrainingType].
	LoraDropout float64 `json:"lora_dropout"`
	// This field is from variant [LoRaTrainingType].
	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:"-"`
}

FineTuneTrainingTypeUnion contains all possible properties and values from FullTrainingType, LoRaTrainingType.

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

func (FineTuneTrainingTypeUnion) AsFullTrainingType

func (u FineTuneTrainingTypeUnion) AsFullTrainingType() (v FullTrainingType)

func (FineTuneTrainingTypeUnion) AsLoRaTrainingType

func (u FineTuneTrainingTypeUnion) AsLoRaTrainingType() (v LoRaTrainingType)

func (FineTuneTrainingTypeUnion) RawJSON

func (u FineTuneTrainingTypeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*FineTuneTrainingTypeUnion) UnmarshalJSON

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

type FullTrainingType

type FullTrainingType struct {
	// Any of "Full".
	Type FullTrainingTypeType `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 (FullTrainingType) RawJSON

func (r FullTrainingType) RawJSON() string

Returns the unmodified JSON received from the API

func (FullTrainingType) ToParam

ToParam converts this FullTrainingType to a FullTrainingTypeParam.

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 FullTrainingTypeParam.Overrides()

func (*FullTrainingType) UnmarshalJSON

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

type FullTrainingTypeParam

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

The property Type is required.

func (FullTrainingTypeParam) MarshalJSON

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

func (*FullTrainingTypeParam) UnmarshalJSON

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

type FullTrainingTypeType

type FullTrainingTypeType string
const (
	FullTrainingTypeTypeFull FullTrainingTypeType = "Full"
)

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 ImageNewParams

type ImageNewParams 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 ImageNewParamsModel `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 []ImageNewParamsImageLora `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 ImageNewParamsOutputFormat `json:"output_format,omitzero"`
	// Format of the image response. Can be either a base64 string or a URL.
	//
	// Any of "base64", "url".
	ResponseFormat ImageNewParamsResponseFormat `json:"response_format,omitzero"`
	// contains filtered or unexported fields
}

func (ImageNewParams) MarshalJSON

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

func (*ImageNewParams) UnmarshalJSON

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

type ImageNewParamsImageLora

type ImageNewParamsImageLora 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 (ImageNewParamsImageLora) MarshalJSON

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

func (*ImageNewParamsImageLora) UnmarshalJSON

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

type ImageNewParamsModel

type ImageNewParamsModel 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 (
	ImageNewParamsModelBlackForestLabsFlux1SchnellFree ImageNewParamsModel = "black-forest-labs/FLUX.1-schnell-Free"
	ImageNewParamsModelBlackForestLabsFlux1Schnell     ImageNewParamsModel = "black-forest-labs/FLUX.1-schnell"
	ImageNewParamsModelBlackForestLabsFlux1_1Pro       ImageNewParamsModel = "black-forest-labs/FLUX.1.1-pro"
)

type ImageNewParamsOutputFormat

type ImageNewParamsOutputFormat string

The format of the image response. Can be either be `jpeg` or `png`. Defaults to `jpeg`.

const (
	ImageNewParamsOutputFormatJpeg ImageNewParamsOutputFormat = "jpeg"
	ImageNewParamsOutputFormatPng  ImageNewParamsOutputFormat = "png"
)

type ImageNewParamsResponseFormat

type ImageNewParamsResponseFormat string

Format of the image response. Can be either a base64 string or a URL.

const (
	ImageNewParamsResponseFormatBase64 ImageNewParamsResponseFormat = "base64"
	ImageNewParamsResponseFormatURL    ImageNewParamsResponseFormat = "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) New

func (r *ImageService) New(ctx context.Context, body ImageNewParams, 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 LinearLrSchedulerArgs

type LinearLrSchedulerArgs 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 (LinearLrSchedulerArgs) RawJSON

func (r LinearLrSchedulerArgs) RawJSON() string

Returns the unmodified JSON received from the API

func (LinearLrSchedulerArgs) ToParam

ToParam converts this LinearLrSchedulerArgs to a LinearLrSchedulerArgsParam.

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 LinearLrSchedulerArgsParam.Overrides()

func (*LinearLrSchedulerArgs) UnmarshalJSON

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

type LinearLrSchedulerArgsParam

type LinearLrSchedulerArgsParam 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 (LinearLrSchedulerArgsParam) MarshalJSON

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

func (*LinearLrSchedulerArgsParam) UnmarshalJSON

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

type LoRaTrainingType

type LoRaTrainingType struct {
	LoraAlpha int64 `json:"lora_alpha,required"`
	LoraR     int64 `json:"lora_r,required"`
	// Any of "Lora".
	Type                 LoRaTrainingTypeType `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 (LoRaTrainingType) RawJSON

func (r LoRaTrainingType) RawJSON() string

Returns the unmodified JSON received from the API

func (LoRaTrainingType) ToParam

ToParam converts this LoRaTrainingType to a LoRaTrainingTypeParam.

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 LoRaTrainingTypeParam.Overrides()

func (*LoRaTrainingType) UnmarshalJSON

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

type LoRaTrainingTypeParam

type LoRaTrainingTypeParam struct {
	LoraAlpha int64 `json:"lora_alpha,required"`
	LoraR     int64 `json:"lora_r,required"`
	// Any of "Lora".
	Type                 LoRaTrainingTypeType `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 (LoRaTrainingTypeParam) MarshalJSON

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

func (*LoRaTrainingTypeParam) UnmarshalJSON

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

type LoRaTrainingTypeType

type LoRaTrainingTypeType string
const (
	LoRaTrainingTypeTypeLora LoRaTrainingTypeType = "Lora"
)

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 LrScheduler

type LrScheduler struct {
	// Any of "linear", "cosine".
	LrSchedulerType LrSchedulerLrSchedulerType      `json:"lr_scheduler_type,required"`
	LrSchedulerArgs LrSchedulerLrSchedulerArgsUnion `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 (LrScheduler) RawJSON

func (r LrScheduler) RawJSON() string

Returns the unmodified JSON received from the API

func (LrScheduler) ToParam

func (r LrScheduler) ToParam() LrSchedulerParam

ToParam converts this LrScheduler to a LrSchedulerParam.

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 LrSchedulerParam.Overrides()

func (*LrScheduler) UnmarshalJSON

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

type LrSchedulerLrSchedulerArgsUnion

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

LrSchedulerLrSchedulerArgsUnion contains all possible properties and values from LinearLrSchedulerArgs, CosineLrSchedulerArgs.

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

func (LrSchedulerLrSchedulerArgsUnion) AsCosineLrSchedulerArgs

func (u LrSchedulerLrSchedulerArgsUnion) AsCosineLrSchedulerArgs() (v CosineLrSchedulerArgs)

func (LrSchedulerLrSchedulerArgsUnion) AsLinearLrSchedulerArgs

func (u LrSchedulerLrSchedulerArgsUnion) AsLinearLrSchedulerArgs() (v LinearLrSchedulerArgs)

func (LrSchedulerLrSchedulerArgsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*LrSchedulerLrSchedulerArgsUnion) UnmarshalJSON

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

type LrSchedulerLrSchedulerArgsUnionParam

type LrSchedulerLrSchedulerArgsUnionParam struct {
	OfLinearLrSchedulerArgs *LinearLrSchedulerArgsParam `json:",omitzero,inline"`
	OfCosineLrSchedulerArgs *CosineLrSchedulerArgsParam `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 (LrSchedulerLrSchedulerArgsUnionParam) GetMinLrRatio

func (u LrSchedulerLrSchedulerArgsUnionParam) GetMinLrRatio() *float64

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

func (LrSchedulerLrSchedulerArgsUnionParam) GetNumCycles

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

func (LrSchedulerLrSchedulerArgsUnionParam) MarshalJSON

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

func (*LrSchedulerLrSchedulerArgsUnionParam) UnmarshalJSON

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

type LrSchedulerLrSchedulerType

type LrSchedulerLrSchedulerType string
const (
	LrSchedulerLrSchedulerTypeLinear LrSchedulerLrSchedulerType = "linear"
	LrSchedulerLrSchedulerTypeCosine LrSchedulerLrSchedulerType = "cosine"
)

type LrSchedulerParam

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

The property LrSchedulerType is required.

func (LrSchedulerParam) MarshalJSON

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

func (*LrSchedulerParam) UnmarshalJSON

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

type ModelListResponse

type ModelListResponse 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          ModelListResponseType    `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       ModelListResponsePricing `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 (ModelListResponse) RawJSON

func (r ModelListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ModelListResponse) UnmarshalJSON

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

type ModelListResponsePricing

type ModelListResponsePricing 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 (ModelListResponsePricing) RawJSON

func (r ModelListResponsePricing) RawJSON() string

Returns the unmodified JSON received from the API

func (*ModelListResponsePricing) UnmarshalJSON

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

type ModelListResponseType

type ModelListResponseType string
const (
	ModelListResponseTypeChat       ModelListResponseType = "chat"
	ModelListResponseTypeLanguage   ModelListResponseType = "language"
	ModelListResponseTypeCode       ModelListResponseType = "code"
	ModelListResponseTypeImage      ModelListResponseType = "image"
	ModelListResponseTypeEmbedding  ModelListResponseType = "embedding"
	ModelListResponseTypeModeration ModelListResponseType = "moderation"
	ModelListResponseTypeRerank     ModelListResponseType = "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 *[]ModelListResponse, 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 RerankParams

type RerankParams struct {
	// List of documents, which can be either strings or objects.
	Documents RerankParamsDocumentsUnion `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 RerankParamsModel `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 (RerankParams) MarshalJSON

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

func (*RerankParams) UnmarshalJSON

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

type RerankParamsDocumentsUnion

type RerankParamsDocumentsUnion 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 (RerankParamsDocumentsUnion) MarshalJSON

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

func (*RerankParamsDocumentsUnion) UnmarshalJSON

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

type RerankParamsModel

type RerankParamsModel 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 (
	RerankParamsModelSalesforceLlamaRankV1 RerankParamsModel = "Salesforce/Llama-Rank-v1"
)

type RerankResponse

type RerankResponse struct {
	// The model to be used for the rerank request.
	Model string `json:"model,required"`
	// Object type
	//
	// Any of "rerank".
	Object  RerankResponseObject   `json:"object,required"`
	Results []RerankResponseResult `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 (RerankResponse) RawJSON

func (r RerankResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*RerankResponse) UnmarshalJSON

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

type RerankResponseObject

type RerankResponseObject string

Object type

const (
	RerankResponseObjectRerank RerankResponseObject = "rerank"
)

type RerankResponseResult

type RerankResponseResult struct {
	Document       RerankResponseResultDocument `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 (RerankResponseResult) RawJSON

func (r RerankResponseResult) RawJSON() string

Returns the unmodified JSON received from the API

func (*RerankResponseResult) UnmarshalJSON

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

type RerankResponseResultDocument

type RerankResponseResultDocument 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 (RerankResponseResultDocument) RawJSON

Returns the unmodified JSON received from the API

func (*RerankResponseResultDocument) UnmarshalJSON

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

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 TrainingMethodDpo

type TrainingMethodDpo struct {
	// Any of "dpo".
	Method                        TrainingMethodDpoMethod `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 (TrainingMethodDpo) RawJSON

func (r TrainingMethodDpo) RawJSON() string

Returns the unmodified JSON received from the API

func (TrainingMethodDpo) ToParam

ToParam converts this TrainingMethodDpo to a TrainingMethodDpoParam.

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 TrainingMethodDpoParam.Overrides()

func (*TrainingMethodDpo) UnmarshalJSON

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

type TrainingMethodDpoMethod

type TrainingMethodDpoMethod string
const (
	TrainingMethodDpoMethodDpo TrainingMethodDpoMethod = "dpo"
)

type TrainingMethodDpoParam

type TrainingMethodDpoParam struct {
	// Any of "dpo".
	Method                        TrainingMethodDpoMethod `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 (TrainingMethodDpoParam) MarshalJSON

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

func (*TrainingMethodDpoParam) UnmarshalJSON

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

type TrainingMethodSft

type TrainingMethodSft struct {
	// Any of "sft".
	Method TrainingMethodSftMethod `json:"method,required"`
	// Whether to mask the user messages in conversational data or prompts in
	// instruction data.
	TrainOnInputs TrainingMethodSftTrainOnInputsUnion `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 (TrainingMethodSft) RawJSON

func (r TrainingMethodSft) RawJSON() string

Returns the unmodified JSON received from the API

func (TrainingMethodSft) ToParam

ToParam converts this TrainingMethodSft to a TrainingMethodSftParam.

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 TrainingMethodSftParam.Overrides()

func (*TrainingMethodSft) UnmarshalJSON

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

type TrainingMethodSftMethod

type TrainingMethodSftMethod string
const (
	TrainingMethodSftMethodSft TrainingMethodSftMethod = "sft"
)

type TrainingMethodSftParam

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

The properties Method, TrainOnInputs are required.

func (TrainingMethodSftParam) MarshalJSON

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

func (*TrainingMethodSftParam) UnmarshalJSON

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

type TrainingMethodSftTrainOnInputsString

type TrainingMethodSftTrainOnInputsString string
const (
	TrainingMethodSftTrainOnInputsStringAuto TrainingMethodSftTrainOnInputsString = "auto"
)

type TrainingMethodSftTrainOnInputsUnion

type TrainingMethodSftTrainOnInputsUnion 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.
	OfTrainingMethodSftTrainOnInputsString string `json:",inline"`
	JSON                                   struct {
		OfBool                                 respjson.Field
		OfTrainingMethodSftTrainOnInputsString respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

TrainingMethodSftTrainOnInputsUnion 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 OfTrainingMethodSftTrainOnInputsString]

func (TrainingMethodSftTrainOnInputsUnion) AsBool

func (TrainingMethodSftTrainOnInputsUnion) AsTrainingMethodSftTrainOnInputsString

func (u TrainingMethodSftTrainOnInputsUnion) AsTrainingMethodSftTrainOnInputsString() (v string)

func (TrainingMethodSftTrainOnInputsUnion) RawJSON

Returns the unmodified JSON received from the API

func (*TrainingMethodSftTrainOnInputsUnion) UnmarshalJSON

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

type TrainingMethodSftTrainOnInputsUnionParam

type TrainingMethodSftTrainOnInputsUnionParam struct {
	OfBool param.Opt[bool] `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfTrainingMethodSftTrainOnInputsString)
	OfTrainingMethodSftTrainOnInputsString 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 (TrainingMethodSftTrainOnInputsUnionParam) MarshalJSON

func (*TrainingMethodSftTrainOnInputsUnionParam) UnmarshalJSON

func (u *TrainingMethodSftTrainOnInputsUnionParam) 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 VideoNewResponse

type VideoNewResponse struct {
	// Unique identifier for the video job.
	ID string `json:"id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VideoNewResponse) RawJSON

func (r VideoNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VideoNewResponse) UnmarshalJSON

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

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 *VideoNewResponse, 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