azopenaiassistants

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 22 Imported by: 0

README

Azure OpenAI assistants client module for Go

NOTE: this client can be used with Azure OpenAI and OpenAI.

OpenAI assistants makes it simpler to have a create, manage and use Assistant, where conversation state is stored and managed by the service. These assistants are backed by the same powerful models you're used to with OpenAI, and also allows the use of the Code Interpreter, Retrieval and Function Calling tools.

Use this module to:

  • Create and manage assistants, threads, messages, and runs.
  • Configure and use tools with assistants.
  • Upload and manage files for use with assistants.

Source code | Package (pkg.go.dev) | REST API documentation | Product documentation

Getting started

Prerequisites
Install the packages

Install the azopenaiassistants and azidentity modules with go get:

go get github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants

# optional
go get github.com/Azure/azure-sdk-for-go/sdk/azidentity

The azidentity module is used for Azure Active Directory authentication with Azure OpenAI.

Authentication
Azure OpenAI

Azure OpenAI clients can authenticate using Azure Active Directory or with an API key:

  • Using Azure Active Directory, with a TokenCredential: example
  • Using an API key: example
OpenAI

OpenAI supports connecting using an API key: example.

Key concepts

See Key concepts in the product documentation for more details about general concepts.

Examples

Examples for various scenarios can be found on pkg.go.dev or in the example*_test.go files in our GitHub repo for azopenaiassistants.

Troubleshooting

Error Handling

All methods that send HTTP requests return *azcore.ResponseError when these requests fail. ResponseError has error details and the raw response from the service.

Logging

This module uses the logging implementation in azcore. To turn on logging for all Azure SDK modules, set AZURE_SDK_GO_LOGGING to all. By default, the logger writes to stderr. Use the azcore/log package to control log output. For example, logging only HTTP request and response events, and printing them to stdout:

import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"

// Print log events to stdout
azlog.SetListener(func(cls azlog.Event, msg string) {
	fmt.Println(msg)
})

// Includes only requests and responses in credential logs
azlog.SetEvents(azlog.EventRequest, azlog.EventResponse)

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Overview

Example (AssistantsStreaming)
azureOpenAIKey := os.Getenv("AOAI_ASSISTANTS_KEY")

// Ex: "https://<your-azure-openai-host>.openai.azure.com"
azureOpenAIEndpoint := os.Getenv("AOAI_ASSISTANTS_ENDPOINT")

if azureOpenAIKey == "" || azureOpenAIEndpoint == "" {
	fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n")
	return
}

keyCredential := azcore.NewKeyCredential(azureOpenAIKey)

client, err := azopenaiassistants.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil)

if err != nil {
	//  TODO: Update the following line with your application specific error handling logic
	log.Printf("ERROR: %s", err)
	return
}

assistantName := fmt.Sprintf("your-assistant-name-%d", time.Now().UnixNano())

// First, let's create an assistant.
createAssistantResp, err := client.CreateAssistant(context.TODO(), azopenaiassistants.CreateAssistantBody{
	Name:           &assistantName,
	DeploymentName: to.Ptr("gpt-4-1106-preview"),
	Instructions:   to.Ptr("You are an AI assistant that can write code to help answer math questions."),
	Tools: []azopenaiassistants.ToolDefinitionClassification{
		&azopenaiassistants.CodeInterpreterToolDefinition{},
		// others...
		// &azopenaiassistants.FunctionToolDefinition{}
		// &azopenaiassistants.RetrievalToolDefinition{}
	},
}, nil)

if err != nil {
	// TODO: Update the following line with your application specific error handling logic
	log.Fatalf("ERROR: %s", err)
}

assistantID := createAssistantResp.ID

// cleanup the assistant after this example. Remove this if you want to re-use the assistant.
defer func() {
	_, err := client.DeleteAssistant(context.TODO(), *assistantID, nil)

	if err != nil {
		// TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}
}()

resp, err := client.CreateThreadAndRunStream(context.TODO(), azopenaiassistants.CreateAndRunThreadBody{
	AssistantID:    assistantID,
	DeploymentName: &assistantsModel,
	Instructions:   to.Ptr("You're a helpful assistant that provides answers on questions about beetles."),
	Thread: &azopenaiassistants.CreateThreadBody{
		Messages: []azopenaiassistants.CreateMessageBody{
			{
				Content: to.Ptr("Tell me about the origins of the humble beetle in two sentences."),
				Role:    to.Ptr(azopenaiassistants.MessageRoleUser),
			},
		},
	},
}, nil)

if err != nil {
	// TODO: Update the following line with your application specific error handling logic
	log.Printf("ERROR: %s", err)
	return
}

// process the streaming responses
for {
	event, err := resp.Stream.Read()

	if err != nil {
		if errors.Is(err, io.EOF) {
			log.Printf("Stream has ended normally")
			break
		}

		// TODO: Update the following line with your application specific error handling logic
		log.Printf("ERROR: %s", err)
		return
	}

	// NOTE: for this example we're handling a small subset of the events that are
	// streaming in. See [azopenaiassistants.AssistantStreamEvent] for the full list of available events.
	switch event.Reason {
	// Assistant events
	case azopenaiassistants.AssistantStreamEventThreadCreated:
		log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.AssistantThread).ID)

	// Thread events
	case azopenaiassistants.AssistantStreamEventThreadRunCreated:
		log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadRun).ID)
	case azopenaiassistants.AssistantStreamEventThreadRunInProgress:
		log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadRun).ID)
	case azopenaiassistants.AssistantStreamEventThreadRunCompleted:
		log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadRun).ID)
	case azopenaiassistants.AssistantStreamEventThreadRunFailed: // failure
		threadRun := event.Event.(*azopenaiassistants.ThreadRun)
		log.Printf("(%s): %#v", event.Reason, *threadRun.LastError)

	// Message events
	case azopenaiassistants.AssistantStreamEventThreadMessageCreated:
		log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadMessage).ID)
	case azopenaiassistants.AssistantStreamEventThreadMessageDelta:
		messageChunk := event.Event.(*azopenaiassistants.MessageDeltaChunk)
		log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.MessageDeltaChunk).ID)

		for _, c := range messageChunk.Delta.Content {
			switch actualContent := c.(type) {
			case *azopenaiassistants.MessageDeltaImageFileContent:
				log.Printf("  Image: %#v", *actualContent.ImageFile)
			case *azopenaiassistants.MessageDeltaTextContentObject:
				log.Printf("  %q", *actualContent.Text.Value)
			}
		}
	case azopenaiassistants.AssistantStreamEventThreadMessageCompleted:
		log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadMessage).ID)
	}
}
Output:

Example (AssistantsUsingCodeInterpreter)
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
)

func main() {
	azureOpenAIKey := os.Getenv("AOAI_ASSISTANTS_KEY")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_ASSISTANTS_ENDPOINT")

	if azureOpenAIKey == "" || azureOpenAIEndpoint == "" {
		fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n")
		return
	}

	keyCredential := azcore.NewKeyCredential(azureOpenAIKey)

	client, err := azopenaiassistants.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Printf("ERROR: %s", err)
		return
	}

	assistantName := fmt.Sprintf("your-assistant-name-%d", time.Now().UnixNano())

	// First, let's create an assistant.
	createAssistantResp, err := client.CreateAssistant(context.TODO(), azopenaiassistants.CreateAssistantBody{
		Name:           &assistantName,
		DeploymentName: to.Ptr("gpt-4-1106-preview"),
		Instructions:   to.Ptr("You are an AI assistant that can write code to help answer math questions."),
		Tools: []azopenaiassistants.ToolDefinitionClassification{
			&azopenaiassistants.CodeInterpreterToolDefinition{},
			// others...
			// &azopenaiassistants.FunctionToolDefinition{}
			// &azopenaiassistants.RetrievalToolDefinition{}
		},
	}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	assistantID := createAssistantResp.ID

	// cleanup the assistant after this example. Remove this if you want to re-use the assistant.
	defer func() {
		_, err := client.DeleteAssistant(context.TODO(), *assistantID, nil)

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}
	}()

	// Now we'll create a thread. The thread is where you will add messages, which can later
	// be evaluated using a Run. A thread can be re-used by multiple Runs.
	createThreadResp, err := client.CreateThread(context.TODO(), azopenaiassistants.CreateThreadBody{}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Printf("ERROR: %s", err)
		return
	}

	threadID := *createThreadResp.ID

	// Add a user question to the thread
	ourQuestion, err := client.CreateMessage(context.TODO(), threadID, azopenaiassistants.CreateMessageBody{
		Content: to.Ptr("I need to solve the equation `3x + 11 = 14`. Can you help me?"),
		Role:    to.Ptr(azopenaiassistants.MessageRoleUser),
	}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Printf("ERROR: %s", err)
		return
	}

	fmt.Fprintf(os.Stderr, "[USER] I need to solve the equation `3x + 11 = 14`. Can you help me?\n")

	// Run the thread and wait (using pollRunEnd) until it completes.
	threadRun, err := client.CreateRun(context.TODO(), threadID, azopenaiassistants.CreateRunBody{
		AssistantID: assistantID,
	}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Printf("ERROR: %s", err)
		return
	}

	// Wait till the assistant has responded
	if _, err := pollCodeInterpreterEnd(context.TODO(), client, threadID, *threadRun.ID); err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Printf("ERROR: %s", err)
		return
	}

	// retrieve any messages added after we asked our question.
	listMessagesPager := client.NewListMessagesPager(threadID, &azopenaiassistants.ListMessagesOptions{
		After: ourQuestion.ID,
		Order: to.Ptr(azopenaiassistants.ListSortOrderAscending),
	})

	for listMessagesPager.More() {
		page, err := listMessagesPager.NextPage(context.TODO())

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Printf("ERROR: %s", err)
			return
		}
		for _, threadMessage := range page.Data {
			for _, content := range threadMessage.Content {
				if v, ok := content.(*azopenaiassistants.MessageTextContent); ok {
					fmt.Fprintf(os.Stderr, "[ASSISTANT] %s: Text response: %s\n", *threadMessage.ID, *v.Text.Value)
				}
			}
		}
	}

	// DisabledOutput:
}

func pollCodeInterpreterEnd(ctx context.Context, client *azopenaiassistants.Client, threadID string, runID string) (azopenaiassistants.GetRunResponse, error) {
	for {
		lastGetRunResp, err := client.GetRun(context.TODO(), threadID, runID, nil)

		if err != nil {
			return azopenaiassistants.GetRunResponse{}, err
		}

		switch *lastGetRunResp.Status {
		case azopenaiassistants.RunStatusInProgress, azopenaiassistants.RunStatusQueued:
			// we're either running or about to run so we'll just keep polling for the end.
			select {
			case <-time.After(500 * time.Millisecond):
			case <-ctx.Done():
				return azopenaiassistants.GetRunResponse{}, ctx.Err()
			}
		case azopenaiassistants.RunStatusRequiresAction:
			// The assistant run has stopped because a tool requires you to submit inputs.
			// You can see an example of this in Example_assistantsUsingFunctionTool.
			return lastGetRunResp, nil
		case azopenaiassistants.RunStatusCompleted:
			// The run has completed successfully
			return lastGetRunResp, nil
		case azopenaiassistants.RunStatusFailed:
			// The run has failed. We can use the code and message to give us an idea of why.
			var code, description string

			if lastGetRunResp.LastError != nil && lastGetRunResp.LastError.Code != nil {
				code = *lastGetRunResp.LastError.Code
			}

			if lastGetRunResp.LastError != nil && lastGetRunResp.LastError.Message != nil {
				description = *lastGetRunResp.LastError.Message
			}

			return lastGetRunResp, fmt.Errorf("run failed, code: %s, message: %s", code, description)

		default:
			return azopenaiassistants.GetRunResponse{}, fmt.Errorf("run ended but status was not complete: %s", *lastGetRunResp.Status)
		}
	}
}
Output:

Example (AssistantsUsingFunctionTool)
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"
	"os"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
)

func main() {
	azureOpenAIKey := os.Getenv("AOAI_ASSISTANTS_KEY")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_ASSISTANTS_ENDPOINT")

	if azureOpenAIKey == "" || azureOpenAIEndpoint == "" {
		fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n")
		return
	}

	keyCredential := azcore.NewKeyCredential(azureOpenAIKey)

	client, err := azopenaiassistants.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	assistantName := fmt.Sprintf("your-assistant-name-%d", time.Now().UnixNano())

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	getWeatherFunctionTool := &azopenaiassistants.FunctionToolDefinition{
		Function: &azopenaiassistants.FunctionDefinition{
			Name: to.Ptr("get_current_weather"),
			Parameters: map[string]any{
				"required": []string{"location"},
				"type":     "object",
				"properties": map[string]any{
					"location": map[string]any{
						"type":        "string",
						"description": "The city and state, e.g. San Francisco, CA",
					},
					"unit": map[string]any{
						"type": "string",
						"enum": []string{"celsius", "fahrenheit"},
					},
				},
			},
		},
	}

	// First, let's create an assistant.
	createAssistantResp, err := client.CreateAssistant(context.TODO(), azopenaiassistants.CreateAssistantBody{
		Name:           &assistantName,
		DeploymentName: to.Ptr("gpt-4-1106-preview"),
		Instructions:   to.Ptr("You are a personal math tutor. Write and run code to answer math questions."),
		Tools: []azopenaiassistants.ToolDefinitionClassification{
			// Defines a function with a signature like this:
			// get_current_weather(location string, unit string)
			getWeatherFunctionTool,
		},
	}, nil)

	if err != nil {
		// TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// create our thread and a run for our question "What's the weather like in Boston, MA, in celsius?"
	question := "What's the weather like in Boston, MA, in celsius?"
	fmt.Fprintf(os.Stderr, "Asking the question: '%s'\n", question)

	var lastMessageID, runID, threadID string
	{
		fmt.Fprintf(os.Stderr, "Creating our thread\n")
		createThreadResp, err := client.CreateThread(context.TODO(), azopenaiassistants.CreateThreadBody{}, nil)

		if err != nil {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}

		threadID = *createThreadResp.ID

		msgResponse, err := client.CreateMessage(context.TODO(), threadID, azopenaiassistants.CreateMessageBody{
			Content: &question,
			Role:    to.Ptr(azopenaiassistants.MessageRoleUser),
		}, nil)

		if err != nil {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}

		lastMessageID = *msgResponse.ID

		// run the thread
		fmt.Fprintf(os.Stderr, "Creating our run for thread %s\n", *createThreadResp.ID)

		createRunResp, err := client.CreateRun(context.TODO(), *createThreadResp.ID, azopenaiassistants.CreateRunBody{
			AssistantID:  createAssistantResp.ID,
			Instructions: to.Ptr("Use functions to answer questions, when possible."),
		}, nil)

		if err != nil {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}

		runID = *createRunResp.ID
	}

	fmt.Fprintf(os.Stderr, "Waiting for the Run status to indicate it needs tool outputs\n")
	// NOTE: see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants#example-package-AssistantsConversationLoop
	// for the pollUntilRunEnds function.
	lastResp, err := pollUntilRunEnds(context.TODO(), client, threadID, runID)
	if err != nil {
		// TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// Our question that we asked requires a tool to answer.
	// *lastResp.Status == azopenaiassistants.RunStatusRequiresAction
	fmt.Fprintf(os.Stderr, "Got run status %s\n", *lastResp.Status)
	fmt.Fprintf(os.Stderr, "Check the response for information we need to submit tool outputs\n")

	var weatherFuncArgs *WeatherFuncArgs
	var funcToolCall *azopenaiassistants.RequiredFunctionToolCall
	{
		// the arguments we need to run the next thing are inside of the run
		submitToolsAction, ok := lastResp.RequiredAction.(*azopenaiassistants.SubmitToolOutputsAction)

		if !ok {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: did not get an azopenaiassistants.SubmitToolOutputsAction as our required action")
		}

		tmpFuncToolCall, ok := submitToolsAction.SubmitToolOutputs.ToolCalls[0].(*azopenaiassistants.RequiredFunctionToolCall)

		if !ok || *tmpFuncToolCall.Function.Name != "get_current_weather" {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: did not get an azopenaiassistants.RequiredFunctionToolCall as our required action, or got an incorrect function name")
		}

		if err := json.Unmarshal([]byte(*tmpFuncToolCall.Function.Arguments), &weatherFuncArgs); err != nil {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}

		funcToolCall = tmpFuncToolCall
	}

	// now call the function (OpenAI is providing the arguments)
	fmt.Fprintf(os.Stderr, "Call our own function to get the weather for %s, in %s\n", weatherFuncArgs.Location, weatherFuncArgs.Unit)
	{
		// submit our outputs from evaluating the tool
		_, err := client.SubmitToolOutputsToRun(context.TODO(), threadID, runID, azopenaiassistants.SubmitToolOutputsToRunBody{
			ToolOutputs: []azopenaiassistants.ToolOutput{
				{
					Output:     to.Ptr("0C"),
					ToolCallID: funcToolCall.ID,
				},
			},
		}, nil)

		if err != nil {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}
	}

	// the run will restart now, we just need to wait until it finishes
	// NOTE: see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants#example-package-AssistantsConversationLoop
	// for the pollUntilRunEnds function.
	lastResp, err = pollUntilRunEnds(context.TODO(), client, threadID, runID)

	if err != nil || *lastResp.Status != azopenaiassistants.RunStatusCompleted {
		// TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	fmt.Fprintf(os.Stderr, "Get responses from the assistant, based on our tool outputs\n")

	// NOTE: see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants#example-package-AssistantsConversationLoop
	// for the getLatestMessages function.
	latestMessages, err := getLatestMessages(context.TODO(), client, threadID, &lastMessageID)
	if err != nil {
		// TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	if len(latestMessages) > 0 {
		// Prints something like:
		// [ASSISTANT] <id>: Text response: The current weather in Boston, MA, measured in Celsius, is 0°C.
		// NOTE: see https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants#example-package-AssistantsConversationLoop
		// for the printAssistantMessages function.
		err = printAssistantMessages(context.TODO(), client, latestMessages)

		if err != nil {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}
	}

	// DisabledOutput:
}

type WeatherFuncArgs struct {
	Location string
	Unit     string
}
Output:

Example (AssistantsUsingSubmitToolOutputsStreaming)
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

package main

import (
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"log"
	"os"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
)

func main() {
	azureOpenAIKey := os.Getenv("AOAI_ASSISTANTS_KEY")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_ASSISTANTS_ENDPOINT")

	if azureOpenAIKey == "" || azureOpenAIEndpoint == "" {
		fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n")
		return
	}

	keyCredential := azcore.NewKeyCredential(azureOpenAIKey)

	client, err := azopenaiassistants.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Printf("ERROR: %s", err)
		return
	}

	assistantName := fmt.Sprintf("your-assistant-name-%d", time.Now().UnixNano())

	// This describes a function that OpenAI will "call" when it wants to answer
	// questions about the current weather.

	// First, let's create an assistant.
	createAssistantResp, err := client.CreateAssistant(context.TODO(), azopenaiassistants.CreateAssistantBody{
		Name:           &assistantName,
		DeploymentName: to.Ptr("gpt-4-1106-preview"),
		Instructions:   to.Ptr("You are an AI assistant that answers questions about the weather using functions like get_current_weather."),
		Tools: []azopenaiassistants.ToolDefinitionClassification{
			&azopenaiassistants.FunctionToolDefinition{
				Function: &azopenaiassistants.FunctionDefinition{
					Name: to.Ptr("get_current_weather"),
					Parameters: map[string]any{
						"required": []string{"location"},
						"type":     "object",
						"properties": map[string]any{
							"location": map[string]any{
								"type":        "string",
								"description": "The city and state, e.g. San Francisco, CA",
							},
							"unit": map[string]any{
								"type": "string",
								"enum": []string{"celsius", "fahrenheit"},
							},
						},
					},
				},
			},
		},
	}, nil)

	if err != nil {
		// TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	assistantID := createAssistantResp.ID

	// cleanup the assistant after this example. Remove this if you want to re-use the assistant.
	defer func() {
		_, err := client.DeleteAssistant(context.TODO(), *assistantID, nil)

		if err != nil {
			// TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}
	}()

	// 1/3: First we'll run the thread - this run will stop when it needs us to evaluate a function and
	// submit tool outputs.
	var submitToolOutputsAction *azopenaiassistants.SubmitToolOutputsAction
	var threadID string
	var runID string

	{
		resp, err := client.CreateThreadAndRunStream(context.TODO(), azopenaiassistants.CreateAndRunThreadBody{
			AssistantID:    assistantID,
			DeploymentName: &assistantsModel,
			Thread: &azopenaiassistants.CreateThreadBody{
				Messages: []azopenaiassistants.CreateMessageBody{
					{
						Content: to.Ptr("What's the weather like in Boston, MA, in celsius?"),
						Role:    to.Ptr(azopenaiassistants.MessageRoleUser),
					},
				},
			},
		}, nil)

		if err != nil {
			// TODO: Update the following line with your application specific error handling logic
			log.Printf("ERROR: %s", err)
			return
		}

		lastThreadRun, err := processToolOutputsStream(resp.Stream)

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Printf("ERROR: %s", err)
			return
		}

		submitToolOutputsAction = lastThreadRun.RequiredAction.(*azopenaiassistants.SubmitToolOutputsAction)
		threadID = *lastThreadRun.ThreadID
		runID = *lastThreadRun.ID
	}

	type weatherFuncArgs struct {
		Location string
		Unit     string
	}

	var toolOutputToBeSubmitted []azopenaiassistants.ToolOutput

	// 2/3: now we unpack the function arguments and call our function, locally
	{
		funcToolCall := submitToolOutputsAction.SubmitToolOutputs.ToolCalls[0].(*azopenaiassistants.RequiredFunctionToolCall)

		var funcArgs *weatherFuncArgs

		err := json.Unmarshal([]byte(*funcToolCall.Function.Arguments), &funcArgs)

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Printf("ERROR: %s", err)
			return
		}

		err = json.Unmarshal([]byte(*funcToolCall.Function.Arguments), &funcArgs)

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Printf("ERROR: %s", err)
			return
		}

		log.Printf("Function we need to call, with args: %s(%q, %q)", *funcToolCall.Function.Name, funcArgs.Location, funcArgs.Unit)

		// TODO: take the parsed arguments and call into your own function implementation
		// For this example we'll just return a hardcoded answer.
		toolOutputToBeSubmitted = []azopenaiassistants.ToolOutput{
			{
				Output:     to.Ptr("26C"),
				ToolCallID: funcToolCall.ID,
			},
		}
	}

	// 3/3: now we'll submit the outputs and continue streaming results.
	{
		resp, err := client.SubmitToolOutputsToRunStream(context.TODO(), threadID, runID, azopenaiassistants.SubmitToolOutputsToRunBody{
			ToolOutputs: toolOutputToBeSubmitted,
		}, nil)

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Printf("ERROR: %s", err)
			return
		}

		if _, err = processToolOutputsStream(resp.Stream); err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Printf("ERROR: %s", err)
			return
		}
	}

	// DisabledOutput:
}

// processToolOutputsStream continually processes events from the stream.
// If action is required this function returns the relevant ThreadRun data.
func processToolOutputsStream(stream *azopenaiassistants.EventReader[azopenaiassistants.StreamEvent]) (*azopenaiassistants.ThreadRun, error) {
	defer stream.Close()

	var threadRunRequiresAction *azopenaiassistants.ThreadRun

	// process the streaming responses
	for {
		event, err := stream.Read()

		if err != nil {
			if errors.Is(err, io.EOF) {
				log.Printf("Stream has ended normally")
				return threadRunRequiresAction, nil
			}

			return threadRunRequiresAction, err
		}

		// NOTE: for this example we're handling a small subset of the events that are
		// streaming in. See [azopenaiassistants.AssistantStreamEvent] for the full list of available events.
		switch event.Reason {
		// Assistant events
		case azopenaiassistants.AssistantStreamEventThreadCreated:
			log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.AssistantThread).ID)

		// Thread events
		case azopenaiassistants.AssistantStreamEventThreadRunCreated:
			log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadRun).ID)
		case azopenaiassistants.AssistantStreamEventThreadRunInProgress:
			log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadRun).ID)
		case azopenaiassistants.AssistantStreamEventThreadRunCompleted:
			log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadRun).ID)
		case azopenaiassistants.AssistantStreamEventThreadRunFailed: // failure
			threadRun := event.Event.(*azopenaiassistants.ThreadRun)

			code := ""
			message := ""

			if threadRun.LastError != nil {
				if threadRun.LastError.Code != nil {
					code = *threadRun.LastError.Code
				}

				if threadRun.LastError.Message != nil {
					message = *threadRun.LastError.Message
				}
			}

			return nil, fmt.Errorf("(%s): code: %s, message: %s", event.Reason, code, message)

		//
		// The assistant needs you to call a function so it can continue processing.
		//
		// We need to preserve this so we can submit the tool outputs using either
		// SubmitToolOutputsToRunStream or SubmitToolOutputsToRun.
		///
		case azopenaiassistants.AssistantStreamEventThreadRunRequiresAction:
			log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadRun).ID)
			threadRunRequiresAction = event.Event.(*azopenaiassistants.ThreadRun)

		// Message events
		case azopenaiassistants.AssistantStreamEventThreadMessageCreated:
			log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadMessage).ID)
		case azopenaiassistants.AssistantStreamEventThreadMessageDelta:
			messageChunk := event.Event.(*azopenaiassistants.MessageDeltaChunk)
			log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.MessageDeltaChunk).ID)

			for _, c := range messageChunk.Delta.Content {
				switch actualContent := c.(type) {
				case *azopenaiassistants.MessageDeltaImageFileContent:
					log.Printf("  Image: %#v", *actualContent.ImageFile)
				case *azopenaiassistants.MessageDeltaTextContentObject:
					log.Printf("  %q", *actualContent.Text.Value)
				}
			}
		case azopenaiassistants.AssistantStreamEventThreadMessageCompleted:
			log.Printf("(%s): %s", event.Reason, *event.Event.(*azopenaiassistants.ThreadMessage).ID)
		}
	}
}
Output:

Example (AssistantsWithConversationLoop)
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

package main

import (
	"context"
	"errors"
	"fmt"
	"io"
	"log"
	"os"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
)

func main() {
	azureOpenAIKey := os.Getenv("AOAI_ASSISTANTS_KEY")

	// Ex: "https://<your-azure-openai-host>.openai.azure.com"
	azureOpenAIEndpoint := os.Getenv("AOAI_ASSISTANTS_ENDPOINT")

	if azureOpenAIKey == "" || azureOpenAIEndpoint == "" {
		fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n")
		return
	}

	keyCredential := azcore.NewKeyCredential(azureOpenAIKey)

	client, err := azopenaiassistants.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	assistantName := fmt.Sprintf("your-assistant-name-%d", time.Now().UnixNano())

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// First, let's create an assistant.
	createAssistantResp, err := client.CreateAssistant(context.TODO(), azopenaiassistants.CreateAssistantBody{
		Name:           &assistantName,
		DeploymentName: to.Ptr("gpt-4-1106-preview"),
		Instructions:   to.Ptr("You are a personal math tutor. Write and run code to answer math questions."),
		Tools: []azopenaiassistants.ToolDefinitionClassification{
			&azopenaiassistants.CodeInterpreterToolDefinition{},
			// others...
			// &azopenaiassistants.FunctionToolDefinition{}
			// &azopenaiassistants.RetrievalToolDefinition{}
		},
	}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	assistantID := createAssistantResp.ID

	// cleanup the assistant after this example. Remove this if you want to re-use the assistant.
	defer func() {
		_, err := client.DeleteAssistant(context.TODO(), *assistantID, nil)

		if err != nil {
			//  TODO: Update the following line with your application specific error handling logic
			log.Fatalf("ERROR: %s", err)
		}
	}()

	// Now we'll create a thread. The thread is where you will add messages, which can later
	// be evaluated using a Run. A thread can be re-used by multiple Runs.
	createThreadResp, err := client.CreateThread(context.TODO(), azopenaiassistants.CreateThreadBody{}, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Printf("ERROR: %s", err)
		return
	}

	threadID := createThreadResp.ID

	assistantCtx, stopAssistant := context.WithCancel(context.TODO())

	callIdx := -1

	// This is just a simplified example of how you could handle a conversation - `assistantMessages` are the messages that
	// are responses from the assistant, and you return messages from here that are then added to the conversation.
	handleConversation := func(ctx context.Context, assistantMessages []azopenaiassistants.ThreadMessage) ([]azopenaiassistants.CreateMessageBody, error) {
		callIdx++

		if err := printAssistantMessages(ctx, client, assistantMessages); err != nil {
			return nil, err
		}

		// For this example we'll just synthesize some responses, simulating a conversation.
		// In a real application these messages would come from the user, responding to replies
		// from the assistant.
		switch callIdx {
		case 0:
			text := "Can you help me find the y intercept for y = x + 4?"
			fmt.Fprintf(os.Stderr, "[ME] %s\n", text)

			return []azopenaiassistants.CreateMessageBody{
				{Role: to.Ptr(azopenaiassistants.MessageRoleUser), Content: &text},
			}, nil
		case 1:
			text := "Can you explain it with a Python program?"
			fmt.Fprintf(os.Stderr, "[ME] %s\n", text)

			return []azopenaiassistants.CreateMessageBody{
				{Role: to.Ptr(azopenaiassistants.MessageRoleUser), Content: &text},
			}, nil
		case 2:
			text := "Can you give me the result if that Python program had 'x' set to 10"
			fmt.Fprintf(os.Stderr, "[ME] %s\n", text)

			return []azopenaiassistants.CreateMessageBody{
				{Role: to.Ptr(azopenaiassistants.MessageRoleUser), Content: &text},
			}, nil
		default:
			stopAssistant()
		}
		return nil, nil
	}

	if err = assistantLoop(assistantCtx, client, *assistantID, *threadID, handleConversation); err != nil {
		// if this is a cancellation error it's just us trying to stop the assistant loop.
		if errors.Is(err, context.Canceled) {
			fmt.Fprintf(os.Stderr, "Assistant stopped cleanly\n")
		} else {
			//  TODO: Update the following line with your application specific error handling logic
			log.Printf("ERROR: %s", err)
			return
		}
	}

	// DisabledOutput:
}

// conversationHandler takes responses from an assistant and returns our reply messages. Returns the responses
// based on the contents of assistantMessages
// - assistantMessages - messages that have arrived since our last read of the thread.
type conversationHandler func(ctx context.Context, assistantMessages []azopenaiassistants.ThreadMessage) ([]azopenaiassistants.CreateMessageBody, error)

func assistantLoop(ctx context.Context, client *azopenaiassistants.Client,
	assistantID string, threadID string,
	handleConversation conversationHandler) error {
	// from here we'll run in a loop, adding new messages to the conversation and reading the assistants
	// responses.

	var lastAssistantResponses []azopenaiassistants.ThreadMessage

	for {
		yourResponses, err := handleConversation(ctx, lastAssistantResponses)

		if err != nil {
			return err
		}

		var lastMessageID *string

		for _, yourResponse := range yourResponses {
			// Add some messages to the thread. We will use Run the thread later to evaluate these and to get
			// responses from the assistant.
			createMessageResp, err := client.CreateMessage(context.TODO(), threadID, yourResponse, nil)

			if err != nil {
				return err
			}

			// we'll always track the final message ID in the thread - when we pull responses we can be more efficient
			// and only grab what's new.
			lastMessageID = createMessageResp.ID
		}

		createRunResp, err := client.CreateRun(context.TODO(), threadID, azopenaiassistants.CreateRunBody{
			AssistantID: &assistantID,
		}, nil)

		if err != nil {
			return err
		}

		runID := *createRunResp.ID

		if _, err := pollUntilRunEnds(ctx, client, threadID, runID); err != nil {
			return err
		}

		// get all the messages that were added after our most recently added message.
		lastAssistantResponses, err = getLatestMessages(ctx, client, threadID, lastMessageID)

		if err != nil {
			return err
		}
	}
}

func printAssistantMessages(ctx context.Context, client *azopenaiassistants.Client, threadMessages []azopenaiassistants.ThreadMessage) error {
	// print out the response contents for debugging.
	for _, response := range threadMessages {
		for _, content := range response.Content {
			switch v := content.(type) {
			case *azopenaiassistants.MessageImageFileContent:
				fmt.Fprintf(os.Stderr, "[ASSISTANT] Image response, file ID: %s\n", *v.ImageFile.FileID)

				// Download the contents of the file through the returned reader.
				fileContentResp, err := client.GetFileContent(ctx, *v.ImageFile.FileID, nil)

				if err != nil {
					return err
				}

				contents, err := io.ReadAll(fileContentResp.Content)

				if err != nil {
					return err
				}

				fmt.Fprintf(os.Stderr, "  File contents downloaded, length %d\n", len(contents))
			case *azopenaiassistants.MessageTextContent:
				fmt.Fprintf(os.Stderr, "[ASSISTANT] %s: Text response: %s\n", *response.ID, *v.Text.Value)
			}
		}
	}

	return nil
}

func pollUntilRunEnds(ctx context.Context, client *azopenaiassistants.Client, threadID string, runID string) (azopenaiassistants.GetRunResponse, error) {
	for {
		lastGetRunResp, err := client.GetRun(context.TODO(), threadID, runID, nil)

		if err != nil {
			return azopenaiassistants.GetRunResponse{}, err
		}

		switch *lastGetRunResp.Status {
		case azopenaiassistants.RunStatusInProgress, azopenaiassistants.RunStatusQueued:
			// we're either running or about to run so we'll just keep polling for the end.
			select {
			case <-time.After(500 * time.Millisecond):
			case <-ctx.Done():
				return azopenaiassistants.GetRunResponse{}, ctx.Err()
			}
		case azopenaiassistants.RunStatusRequiresAction:
			// The assistant run has stopped because a tool requires you to submit inputs.
			// You can see an example of this in Example_assistantsUsingFunctionTool.
			return lastGetRunResp, nil
		case azopenaiassistants.RunStatusCompleted:
			// The run has completed successfully
			return lastGetRunResp, nil
		case azopenaiassistants.RunStatusFailed:
			// The run has failed. We can use the code and message to give us an idea of why.
			var code, description string

			if lastGetRunResp.LastError != nil && lastGetRunResp.LastError.Code != nil {
				code = *lastGetRunResp.LastError.Code
			}

			if lastGetRunResp.LastError != nil && lastGetRunResp.LastError.Message != nil {
				description = *lastGetRunResp.LastError.Message
			}

			return lastGetRunResp, fmt.Errorf("run failed, code: %s, message: %s", code, description)

		default:
			return azopenaiassistants.GetRunResponse{}, fmt.Errorf("run ended but status was not complete: %s", *lastGetRunResp.Status)
		}
	}
}

// getLatestMessages gets any messages that have occurred since lastMessageID.
// If an error occurs, returns any messages received so far, as well as the error.
func getLatestMessages(ctx context.Context, client *azopenaiassistants.Client, threadID string, lastMessageID *string) ([]azopenaiassistants.ThreadMessage, error) {
	// grab any messages that occurred after our last known message
	listMessagesPager := client.NewListMessagesPager(threadID, &azopenaiassistants.ListMessagesOptions{
		After: lastMessageID,
		Order: to.Ptr(azopenaiassistants.ListSortOrderAscending),
	})

	var all []azopenaiassistants.ThreadMessage

	for listMessagesPager.More() {
		page, err := listMessagesPager.NextPage(ctx)

		if err != nil {
			return all, err
		}

		all = append(all, page.Data...)
	}

	return all, nil
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponseFormat added in v0.2.0

type APIResponseFormat string

APIResponseFormat - Must be one of text or json_object.

const (
	// APIResponseFormatJSONObject - Using `json_object` format will limit the usage of ToolCall to only functions.
	APIResponseFormatJSONObject APIResponseFormat = "json_object"
	// APIResponseFormatText - `text` format should be used for requests involving any sort of ToolCall.
	APIResponseFormatText APIResponseFormat = "text"
)

func PossibleAPIResponseFormatValues added in v0.2.0

func PossibleAPIResponseFormatValues() []APIResponseFormat

PossibleAPIResponseFormatValues returns the possible values for the APIResponseFormat const type.

type Assistant

type Assistant struct {
	// REQUIRED; The Unix timestamp, in seconds, representing when this object was created.
	CreatedAt *time.Time

	// REQUIRED; The description of the assistant.
	Description *string

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; The system instructions for the assistant to use.
	Instructions *string

	// REQUIRED; A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information
	// about that object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// REQUIRED; The ID of the model to use.
	Model *string

	// REQUIRED; The name of the assistant.
	Name *string

	// REQUIRED; The object type, which is always assistant.
	Object *string

	// REQUIRED; What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while
	// lower values like 0.2 will make it more focused and deterministic.
	Temperature *float32

	// REQUIRED; A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For
	// example, the code_interpretertool requires a list of file IDs, while the file_search tool
	// requires a list of vector store IDs.
	ToolResources *AssistantToolResources

	// REQUIRED; The collection of tools enabled for the assistant.
	Tools []ToolDefinitionClassification

	// REQUIRED; An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of
	// the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top
	// 10% probability mass are considered.
	// We generally recommend altering this or temperature but not both.
	TopP *float32

	// The response format of the tool calls used by this assistant.
	ResponseFormat *AssistantResponseFormat
}

Assistant - Represents an assistant that can call the model and use tools.

func (Assistant) MarshalJSON

func (a Assistant) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Assistant.

func (*Assistant) UnmarshalJSON

func (a *Assistant) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Assistant.

type AssistantCreationOptionsToolResources added in v0.2.0

type AssistantCreationOptionsToolResources struct {
	// A list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated with the
	// tool.
	CodeInterpreter *CreateCodeInterpreterToolResourceOptions

	// A list of vector stores or their IDs made available to the file_search tool.
	FileSearch *CreateFileSearchToolResourceOptions
}

AssistantCreationOptionsToolResources - A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the code_interpretertool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

func (AssistantCreationOptionsToolResources) MarshalJSON added in v0.2.0

func (a AssistantCreationOptionsToolResources) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantCreationOptionsToolResources.

func (*AssistantCreationOptionsToolResources) UnmarshalJSON added in v0.2.0

func (a *AssistantCreationOptionsToolResources) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantCreationOptionsToolResources.

type AssistantDeletionStatus

type AssistantDeletionStatus struct {
	// REQUIRED; A value indicating whether deletion was successful.
	Deleted *bool

	// REQUIRED; The ID of the resource specified for deletion.
	ID *string

	// REQUIRED; The object type, which is always 'assistant.deleted'.
	Object *string
}

AssistantDeletionStatus - The status of an assistant deletion operation.

func (AssistantDeletionStatus) MarshalJSON

func (a AssistantDeletionStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantDeletionStatus.

func (*AssistantDeletionStatus) UnmarshalJSON

func (a *AssistantDeletionStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantDeletionStatus.

type AssistantResponseFormat added in v0.2.0

type AssistantResponseFormat struct {
	// Type indicates which format type should be used for tool calls.
	// The default is [AssistantResponseFormatTypeAuto].
	Type AssistantResponseFormatType
}

AssistantResponseFormat controls the response format of tool calls made by an assistant.

func (AssistantResponseFormat) MarshalJSON added in v0.2.0

func (a AssistantResponseFormat) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantResponseFormat.

func (*AssistantResponseFormat) UnmarshalJSON added in v0.2.0

func (a *AssistantResponseFormat) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantResponseFormat.

type AssistantResponseFormatType added in v0.2.0

type AssistantResponseFormatType string

AssistantResponseFormatType - Represents the mode in which the model will handle the return format of a tool call.

const (
	// AssistantResponseFormatTypeAuto - Default value. Let the model handle the return format.
	AssistantResponseFormatTypeAuto AssistantResponseFormatType = "auto"
	// AssistantResponseFormatTypeJSONObject - Using `json_object` format will limit the usage of ToolCall to only functions.
	AssistantResponseFormatTypeJSONObject AssistantResponseFormatType = "json_object"
	// AssistantResponseFormatTypeText - `text` format should be used for requests involving any sort of ToolCall.
	AssistantResponseFormatTypeText AssistantResponseFormatType = "text"
)

func PossibleAssistantResponseFormatTypeValues added in v0.2.0

func PossibleAssistantResponseFormatTypeValues() []AssistantResponseFormatType

PossibleAssistantResponseFormatTypeValues returns the possible values for the AssistantResponseFormatType const type.

type AssistantStreamEvent added in v0.2.0

type AssistantStreamEvent string

AssistantStreamEvent - Each event in a server-sent events stream has an event and data property: event: thread.created data: {"id": "thread_123", "object": "thread", ...} We emit events whenever a new object is created, transitions to a new state, or is being streamed in parts (deltas). For example, we emit thread.run.created when a new run is created, thread.run.completed when a run completes, and so on. When an Assistant chooses to create a message during a run, we emit a thread.message.created event, athread.message.in_progress event, many thread.message.delta events, and finally athread.message.completed event. We may add additional events over time, so we recommend handling unknown events gracefully in your code.

const (
	// AssistantStreamEventDone - Event sent when the stream is done.
	AssistantStreamEventDone AssistantStreamEvent = "done"
	// AssistantStreamEventError - Event sent when an error occurs, such as an internal server error or a timeout.
	AssistantStreamEventError AssistantStreamEvent = "error"
	// AssistantStreamEventThreadCreated - Event sent when a new thread is created. The data of this event is of type AssistantThread
	AssistantStreamEventThreadCreated AssistantStreamEvent = "thread.created"
	// AssistantStreamEventThreadMessageCompleted - Event sent when a message is completed. The data of this event is of type
	// ThreadMessage
	AssistantStreamEventThreadMessageCompleted AssistantStreamEvent = "thread.message.completed"
	// AssistantStreamEventThreadMessageCreated - Event sent when a new message is created. The data of this event is of type
	// ThreadMessage
	AssistantStreamEventThreadMessageCreated AssistantStreamEvent = "thread.message.created"
	// AssistantStreamEventThreadMessageDelta - Event sent when a message is being streamed. The data of this event is of type
	// MessageDeltaChunk
	AssistantStreamEventThreadMessageDelta AssistantStreamEvent = "thread.message.delta"
	// AssistantStreamEventThreadMessageInProgress - Event sent when a message moves to `in_progress` status. The data of this
	// event is of type ThreadMessage
	AssistantStreamEventThreadMessageInProgress AssistantStreamEvent = "thread.message.in_progress"
	// AssistantStreamEventThreadMessageIncomplete - Event sent before a message is completed. The data of this event is of type
	// ThreadMessage
	AssistantStreamEventThreadMessageIncomplete AssistantStreamEvent = "thread.message.incomplete"
	// AssistantStreamEventThreadRunCancelled - Event sent when a run is cancelled. The data of this event is of type ThreadRun
	AssistantStreamEventThreadRunCancelled AssistantStreamEvent = "thread.run.cancelled"
	// AssistantStreamEventThreadRunCancelling - Event sent when a run moves to `cancelling` status. The data of this event is
	// of type ThreadRun
	AssistantStreamEventThreadRunCancelling AssistantStreamEvent = "thread.run.cancelling"
	// AssistantStreamEventThreadRunCompleted - Event sent when a run is completed. The data of this event is of type ThreadRun
	AssistantStreamEventThreadRunCompleted AssistantStreamEvent = "thread.run.completed"
	// AssistantStreamEventThreadRunCreated - Event sent when a new run is created. The data of this event is of type ThreadRun
	AssistantStreamEventThreadRunCreated AssistantStreamEvent = "thread.run.created"
	// AssistantStreamEventThreadRunExpired - Event sent when a run is expired. The data of this event is of type ThreadRun
	AssistantStreamEventThreadRunExpired AssistantStreamEvent = "thread.run.expired"
	// AssistantStreamEventThreadRunFailed - Event sent when a run fails. The data of this event is of type ThreadRun
	AssistantStreamEventThreadRunFailed AssistantStreamEvent = "thread.run.failed"
	// AssistantStreamEventThreadRunInProgress - Event sent when a run moves to `in_progress` status. The data of this event is
	// of type ThreadRun
	AssistantStreamEventThreadRunInProgress AssistantStreamEvent = "thread.run.in_progress"
	// AssistantStreamEventThreadRunQueued - Event sent when a run moves to `queued` status. The data of this event is of type
	// ThreadRun
	AssistantStreamEventThreadRunQueued AssistantStreamEvent = "thread.run.queued"
	// AssistantStreamEventThreadRunRequiresAction - Event sent when a run moves to `requires_action` status. The data of this
	// event is of type ThreadRun
	AssistantStreamEventThreadRunRequiresAction AssistantStreamEvent = "thread.run.requires_action"
	// AssistantStreamEventThreadRunStepCancelled - Event sent when a run step is cancelled. The data of this event is of type
	// RunStep
	AssistantStreamEventThreadRunStepCancelled AssistantStreamEvent = "thread.run.step.cancelled"
	// AssistantStreamEventThreadRunStepCompleted - Event sent when a run step is completed. The data of this event is of type
	// RunStep
	AssistantStreamEventThreadRunStepCompleted AssistantStreamEvent = "thread.run.step.completed"
	// AssistantStreamEventThreadRunStepCreated - Event sent when a new thread run step is created. The data of this event is
	// of type RunStep
	AssistantStreamEventThreadRunStepCreated AssistantStreamEvent = "thread.run.step.created"
	// AssistantStreamEventThreadRunStepDelta - Event sent when a run stepis being streamed. The data of this event is of type
	// RunStepDeltaChunk
	AssistantStreamEventThreadRunStepDelta AssistantStreamEvent = "thread.run.step.delta"
	// AssistantStreamEventThreadRunStepExpired - Event sent when a run step is expired. The data of this event is of type RunStep
	AssistantStreamEventThreadRunStepExpired AssistantStreamEvent = "thread.run.step.expired"
	// AssistantStreamEventThreadRunStepFailed - Event sent when a run step fails. The data of this event is of type RunStep
	AssistantStreamEventThreadRunStepFailed AssistantStreamEvent = "thread.run.step.failed"
	// AssistantStreamEventThreadRunStepInProgress - Event sent when a run step moves to `in_progress` status. The data of this
	// event is of type RunStep
	AssistantStreamEventThreadRunStepInProgress AssistantStreamEvent = "thread.run.step.in_progress"
)

func PossibleAssistantStreamEventValues added in v0.2.0

func PossibleAssistantStreamEventValues() []AssistantStreamEvent

PossibleAssistantStreamEventValues returns the possible values for the AssistantStreamEvent const type.

type AssistantThread

type AssistantThread struct {
	// REQUIRED; The Unix timestamp, in seconds, representing when this object was created.
	CreatedAt *time.Time

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information
	// about that object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// REQUIRED; The object type, which is always 'thread'.
	Object *string

	// REQUIRED; A set of resources that are made available to the assistant's tools in this thread. The resources are specific
	// to the type of tool. For example, the code_interpreter tool requires a list of file IDs,
	// while the file_search tool requires a list of vector store IDs.
	ToolResources *AssistantThreadToolResources
}

AssistantThread - Information about a single thread associated with an assistant.

func (*AssistantThread) GetStreamEventDataContent added in v0.2.0

func (v *AssistantThread) GetStreamEventDataContent() *StreamEventData

GetStreamEventDataContent returns the common data of the underlying type.

func (AssistantThread) MarshalJSON

func (a AssistantThread) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantThread.

func (*AssistantThread) UnmarshalJSON

func (a *AssistantThread) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantThread.

type AssistantThreadCreationOptionsToolResources added in v0.2.0

type AssistantThreadCreationOptionsToolResources struct {
	// A list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated with the
	// tool.
	CodeInterpreter *CreateCodeInterpreterToolResourceOptions

	// A list of vector stores or their IDs made available to the file_search tool.
	FileSearch *CreateFileSearchToolResourceOptions
}

AssistantThreadCreationOptionsToolResources - A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

func (AssistantThreadCreationOptionsToolResources) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type AssistantThreadCreationOptionsToolResources.

func (*AssistantThreadCreationOptionsToolResources) UnmarshalJSON added in v0.2.0

func (a *AssistantThreadCreationOptionsToolResources) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantThreadCreationOptionsToolResources.

type AssistantThreadToolResources added in v0.2.0

type AssistantThreadToolResources struct {
	// Resources to be used by the code_interpreter tool consisting of file IDs.
	CodeInterpreter *CodeInterpreterToolResource

	// Resources to be used by the file_search tool consisting of vector store IDs.
	FileSearch *FileSearchToolResource
}

AssistantThreadToolResources - A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

func (AssistantThreadToolResources) MarshalJSON added in v0.2.0

func (a AssistantThreadToolResources) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantThreadToolResources.

func (*AssistantThreadToolResources) UnmarshalJSON added in v0.2.0

func (a *AssistantThreadToolResources) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantThreadToolResources.

type AssistantToolResources added in v0.2.0

type AssistantToolResources struct {
	// Resources to be used by the code_interpreter tool consisting of file IDs.
	CodeInterpreter *CodeInterpreterToolResource

	// Resources to be used by the file_search tool consisting of vector store IDs.
	FileSearch *FileSearchToolResource
}

AssistantToolResources - A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the code_interpretertool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

func (AssistantToolResources) MarshalJSON added in v0.2.0

func (a AssistantToolResources) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantToolResources.

func (*AssistantToolResources) UnmarshalJSON added in v0.2.0

func (a *AssistantToolResources) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantToolResources.

type AssistantsAPIResponseFormat added in v0.2.0

type AssistantsAPIResponseFormat struct {
	// Must be one of text or json_object.
	Type *APIResponseFormat
}

AssistantsAPIResponseFormat - An object describing the expected output of the model. If json_object only function type tools are allowed to be passed to the Run. If text the model can return text or any value needed.

func (AssistantsAPIResponseFormat) MarshalJSON added in v0.2.0

func (a AssistantsAPIResponseFormat) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantsAPIResponseFormat.

func (*AssistantsAPIResponseFormat) UnmarshalJSON added in v0.2.0

func (a *AssistantsAPIResponseFormat) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantsAPIResponseFormat.

type AssistantsAPIToolChoiceOption added in v0.2.0

type AssistantsAPIToolChoiceOption struct {
	// Mode controls the behavior for this particular tool.
	//   - [AssistantsAPIToolChoiceOptionModeAuto] (default) means the model can pick between
	//     generating a message or calling a tool.
	//   - [AssistantsAPIToolChoiceOptionModeNone] means the model will not call any tools
	//     and instead generates a message.
	//
	// Alternately, this value can also be set to:
	//   - [AssistantsAPIToolChoiceOptionModeCodeInterpreter] - use the code interpreter tool.
	//   - [AssistantsAPIToolChoiceOptionModeFileSearch] - use the file search tool.
	//   - [AssistantsAPIToolChoiceOptionModeFunction] - use a function. The function name
	//     is set in the [AssistantsAPIToolChoiceOption.Function] field.
	Mode AssistantsAPIToolChoiceOptionMode

	// Function sets the name of the function to call.
	Function *FunctionName
}

AssistantsAPIToolChoiceOption controls which tools are called by the model.

func (AssistantsAPIToolChoiceOption) MarshalJSON added in v0.2.0

func (a AssistantsAPIToolChoiceOption) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantsAPIToolChoiceOption.

func (*AssistantsAPIToolChoiceOption) UnmarshalJSON added in v0.2.0

func (a *AssistantsAPIToolChoiceOption) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantsAPIToolChoiceOption.

type AssistantsAPIToolChoiceOptionMode added in v0.2.0

type AssistantsAPIToolChoiceOptionMode string

AssistantsAPIToolChoiceOptionMode - Specifies how the tool choice will be used

const (
	// AssistantsAPIToolChoiceOptionModeAuto - The model can pick between generating a message or calling a function.
	AssistantsAPIToolChoiceOptionModeAuto AssistantsAPIToolChoiceOptionMode = "auto"
	// AssistantsAPIToolChoiceOptionModeCodeInterpreter - Tool type `code_interpreter`
	AssistantsAPIToolChoiceOptionModeCodeInterpreter AssistantsAPIToolChoiceOptionMode = "code_interpreter"
	// AssistantsAPIToolChoiceOptionModeFileSearch - Tool type `file_search`
	AssistantsAPIToolChoiceOptionModeFileSearch AssistantsAPIToolChoiceOptionMode = "file_search"
	// AssistantsAPIToolChoiceOptionModeFunction - Tool type `function`
	AssistantsAPIToolChoiceOptionModeFunction AssistantsAPIToolChoiceOptionMode = "function"
	// AssistantsAPIToolChoiceOptionModeNone - The model will not call a function and instead generates a message.
	AssistantsAPIToolChoiceOptionModeNone AssistantsAPIToolChoiceOptionMode = "none"
)

func PossibleAssistantsAPIToolChoiceOptionModeValues added in v0.2.0

func PossibleAssistantsAPIToolChoiceOptionModeValues() []AssistantsAPIToolChoiceOptionMode

PossibleAssistantsAPIToolChoiceOptionModeValues returns the possible values for the AssistantsAPIToolChoiceOptionMode const type.

type AssistantsPage

type AssistantsPage struct {
	// REQUIRED; The requested list of items.
	Data []Assistant

	// REQUIRED; The first ID represented in this list.
	FirstID *string

	// REQUIRED; A value indicating whether there are additional values available not captured in this list.
	HasMore *bool

	// REQUIRED; The last ID represented in this list.
	LastID *string

	// REQUIRED; The object type, which is always list.
	Object *string
}

AssistantsPage - The response data for a requested list of items.

func (AssistantsPage) MarshalJSON

func (a AssistantsPage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AssistantsPage.

func (*AssistantsPage) UnmarshalJSON

func (a *AssistantsPage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AssistantsPage.

type CancelRunOptions

type CancelRunOptions struct {
}

CancelRunOptions contains the optional parameters for the Client.CancelRun method.

type CancelRunResponse

type CancelRunResponse struct {
	// Data representing a single evaluation run of an assistant thread.
	ThreadRun
}

CancelRunResponse contains the response from method Client.CancelRun.

type CancelVectorStoreFileBatchOptions added in v0.2.0

type CancelVectorStoreFileBatchOptions struct {
}

CancelVectorStoreFileBatchOptions contains the optional parameters for the Client.CancelVectorStoreFileBatch method.

type CancelVectorStoreFileBatchResponse added in v0.2.0

type CancelVectorStoreFileBatchResponse struct {
	// A batch of files attached to a vector store.
	VectorStoreFileBatch
}

CancelVectorStoreFileBatchResponse contains the response from method Client.CancelVectorStoreFileBatch.

type Client

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

Client contains the methods for the OpenAIAssistants group. Don't use this type directly, use a constructor function instead.

func NewClient

func NewClient(endpoint string, credential azcore.TokenCredential, options *ClientOptions) (*Client, error)

NewClient creates a new instance of Client that connects to an Azure OpenAI endpoint.

  • endpoint - Azure OpenAI service endpoint, for example: https://{your-resource-name}.openai.azure.com
  • credential - used to authorize requests. Usually a credential from github.com/Azure/azure-sdk-for-go/sdk/azidentity.
  • options - client options, pass nil to accept the default values.
Example
package main

import (
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
)

func main() {
	dac, err := azidentity.NewDefaultAzureCredential(nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	// NOTE: this constructor creates a client that connects to an Azure OpenAI endpoint.
	// To connect to the public OpenAI endpoint, use azopenaiassistants.NewClientForOpenAI
	client, err := azopenaiassistants.NewClient("https://<your-azure-openai-host>.openai.azure.com", dac, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = client
}
Output:

func NewClientForOpenAI

func NewClientForOpenAI(endpoint string, credential *azcore.KeyCredential, options *ClientOptions) (*Client, error)

NewClientForOpenAI creates a new instance of Client which connects to the public OpenAI endpoint.

  • endpoint - OpenAI service endpoint, for example: https://api.openai.com/v1
  • credential - used to authorize requests with an API Key credential
  • options - client options, pass nil to accept the default values.
Example
package main

import (
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
)

func main() {
	keyCredential := azcore.NewKeyCredential("<OpenAI-APIKey>")

	// NOTE: this constructor creates a client that connects to the public OpenAI endpoint.
	// To connect to an Azure OpenAI endpoint, use azopenaiassistants.NewClient() or azopenaiassistants.NewClientWithyKeyCredential.
	client, err := azopenaiassistants.NewClientForOpenAI("https://api.openai.com/v1", keyCredential, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = client
}
Output:

func NewClientWithKeyCredential

func NewClientWithKeyCredential(endpoint string, credential *azcore.KeyCredential, options *ClientOptions) (*Client, error)

NewClientWithKeyCredential creates a new instance of Client that connects to an Azure OpenAI endpoint.

  • endpoint - Azure OpenAI service endpoint, for example: https://{your-resource-name}.openai.azure.com
  • credential - used to authorize requests with an API Key credential
  • options - client options, pass nil to accept the default values.
Example
package main

import (
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenaiassistants"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
)

func main() {
	keyCredential := azcore.NewKeyCredential("<Azure-OpenAI-APIKey>")

	// NOTE: this constructor creates a client that connects to an Azure OpenAI endpoint.
	// To connect to the public OpenAI endpoint, use azopenaiassistants.NewClientForOpenAI
	client, err := azopenaiassistants.NewClientWithKeyCredential("https://<your-azure-openai-host>.openai.azure.com", keyCredential, nil)

	if err != nil {
		//  TODO: Update the following line with your application specific error handling logic
		log.Fatalf("ERROR: %s", err)
	}

	_ = client
}
Output:

func (*Client) CancelRun

func (client *Client) CancelRun(ctx context.Context, threadID string, runID string, options *CancelRunOptions) (CancelRunResponse, error)

CancelRun - Cancels a run of an in progress thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread being run.
  • runID - The ID of the run to cancel.
  • options - CancelRunOptions contains the optional parameters for the Client.CancelRun method.

func (*Client) CancelVectorStoreFileBatch added in v0.2.0

func (client *Client) CancelVectorStoreFileBatch(ctx context.Context, vectorStoreID string, batchID string, options *CancelVectorStoreFileBatchOptions) (CancelVectorStoreFileBatchResponse, error)

CancelVectorStoreFileBatch - Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store that the file batch belongs to.
  • batchID - The ID of the file batch to cancel.
  • options - CancelVectorStoreFileBatchOptions contains the optional parameters for the Client.CancelVectorStoreFileBatch method.

func (*Client) CreateAssistant

func (client *Client) CreateAssistant(ctx context.Context, body CreateAssistantBody, options *CreateAssistantOptions) (CreateAssistantResponse, error)

CreateAssistant - Creates a new assistant. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • body - The request details to use when creating a new assistant.
  • options - CreateAssistantOptions contains the optional parameters for the Client.CreateAssistant method.

func (*Client) CreateMessage

func (client *Client) CreateMessage(ctx context.Context, threadID string, body CreateMessageBody, options *CreateMessageOptions) (CreateMessageResponse, error)

CreateMessage - Creates a new message on a specified thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread to create the new message on.
  • body - A single message within an assistant thread, as provided during that thread's creation for its initial state.
  • options - CreateMessageOptions contains the optional parameters for the Client.CreateMessage method.

func (*Client) CreateRun

func (client *Client) CreateRun(ctx context.Context, threadID string, createRunBody CreateRunBody, options *CreateRunOptions) (CreateRunResponse, error)

CreateRun - Creates a new run for an assistant thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread to run.
  • createRunBody - The details used when creating a new run of an assistant thread.
  • options - CreateRunOptions contains the optional parameters for the Client.CreateRun method.

func (*Client) CreateRunStream added in v0.2.0

func (client *Client) CreateRunStream(ctx context.Context, threadID string, body CreateRunBody, _ *CreateRunStreamOptions) (CreateRunStreamResponse, error)

CreateRunStream is the equivalent of [CreateRun], but it returns a stream of responses instead of a single response.

func (*Client) CreateThread

func (client *Client) CreateThread(ctx context.Context, body CreateThreadBody, options *CreateThreadOptions) (CreateThreadResponse, error)

CreateThread - Creates a new thread. Threads contain messages and can be run by assistants. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • body - The details used to create a new assistant thread.
  • options - CreateThreadOptions contains the optional parameters for the Client.CreateThread method.

func (*Client) CreateThreadAndRun

func (client *Client) CreateThreadAndRun(ctx context.Context, body CreateAndRunThreadBody, options *CreateThreadAndRunOptions) (CreateThreadAndRunResponse, error)

CreateThreadAndRun - Creates a new assistant thread and immediately starts a run using that new thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • body - The details used when creating and immediately running a new assistant thread.
  • options - CreateThreadAndRunOptions contains the optional parameters for the Client.CreateThreadAndRun method.

func (*Client) CreateThreadAndRunStream added in v0.2.0

CreateThreadAndRunStream is the equivalent of [CreateThreadAndRun], but it returns a stream of responses instead of a single response.

func (*Client) CreateVectorStore added in v0.2.0

func (client *Client) CreateVectorStore(ctx context.Context, body VectorStoreBody, options *CreateVectorStoreOptions) (CreateVectorStoreResponse, error)

CreateVectorStore - Creates a vector store. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • body - Request object for creating a vector store.
  • options - CreateVectorStoreOptions contains the optional parameters for the Client.CreateVectorStore method.

func (*Client) CreateVectorStoreFile added in v0.2.0

func (client *Client) CreateVectorStoreFile(ctx context.Context, vectorStoreID string, body CreateVectorStoreFileBody, options *CreateVectorStoreFileOptions) (CreateVectorStoreFileResponse, error)

CreateVectorStoreFile - Create a vector store file by attaching a file to a vector store. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store for which to create a File.
  • body - Request object for creating a vector store file.
  • options - CreateVectorStoreFileOptions contains the optional parameters for the Client.CreateVectorStoreFile method.

func (*Client) CreateVectorStoreFileBatch added in v0.2.0

func (client *Client) CreateVectorStoreFileBatch(ctx context.Context, vectorStoreID string, body CreateVectorStoreFileBatchBody, options *CreateVectorStoreFileBatchOptions) (CreateVectorStoreFileBatchResponse, error)

CreateVectorStoreFileBatch - Create a vector store file batch. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store for which to create a File Batch.
  • options - CreateVectorStoreFileBatchOptions contains the optional parameters for the Client.CreateVectorStoreFileBatch method.

func (*Client) DeleteAssistant

func (client *Client) DeleteAssistant(ctx context.Context, assistantID string, options *DeleteAssistantOptions) (DeleteAssistantResponse, error)

DeleteAssistant - Deletes an assistant. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • assistantID - The ID of the assistant to delete.
  • options - DeleteAssistantOptions contains the optional parameters for the Client.DeleteAssistant method.

func (*Client) DeleteFile

func (client *Client) DeleteFile(ctx context.Context, fileID string, options *DeleteFileOptions) (DeleteFileResponse, error)

DeleteFile - Delete a previously uploaded file. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • fileID - The ID of the file to delete.
  • options - DeleteFileOptions contains the optional parameters for the Client.DeleteFile method.

func (*Client) DeleteThread

func (client *Client) DeleteThread(ctx context.Context, threadID string, options *DeleteThreadOptions) (DeleteThreadResponse, error)

DeleteThread - Deletes an existing thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread to delete.
  • options - DeleteThreadOptions contains the optional parameters for the Client.DeleteThread method.

func (*Client) DeleteVectorStore added in v0.2.0

func (client *Client) DeleteVectorStore(ctx context.Context, vectorStoreID string, options *DeleteVectorStoreOptions) (DeleteVectorStoreResponse, error)

DeleteVectorStore - Deletes the vector store object matching the specified ID. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store to delete.
  • options - DeleteVectorStoreOptions contains the optional parameters for the Client.DeleteVectorStore method.

func (*Client) DeleteVectorStoreFile added in v0.2.0

func (client *Client) DeleteVectorStoreFile(ctx context.Context, vectorStoreID string, fileID string, options *DeleteVectorStoreFileOptions) (DeleteVectorStoreFileResponse, error)

DeleteVectorStoreFile - Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store that the file belongs to.
  • fileID - The ID of the file to delete its relationship to the vector store.
  • options - DeleteVectorStoreFileOptions contains the optional parameters for the Client.DeleteVectorStoreFile method.

func (*Client) GetAssistant

func (client *Client) GetAssistant(ctx context.Context, assistantID string, options *GetAssistantOptions) (GetAssistantResponse, error)

GetAssistant - Retrieves an existing assistant. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • assistantID - The ID of the assistant to retrieve.
  • options - GetAssistantOptions contains the optional parameters for the Client.GetAssistant method.

func (*Client) GetFile

func (client *Client) GetFile(ctx context.Context, fileID string, options *GetFileOptions) (GetFileResponse, error)

GetFile - Returns information about a specific file. Does not retrieve file content. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • fileID - The ID of the file to retrieve.
  • options - GetFileOptions contains the optional parameters for the Client.GetFile method.

func (*Client) GetFileContent

func (client *Client) GetFileContent(ctx context.Context, fileID string, _ *GetFileContentOptions) (GetFileContentResponse, error)

GetFileContent - Returns content for a specific file. If the operation fails it returns an *azcore.ResponseError type.

  • fileID - The ID of the file to retrieve.
  • options - GetFileContentOptions contains the optional parameters for the Client.GetFileContent method.

func (*Client) GetMessage

func (client *Client) GetMessage(ctx context.Context, threadID string, messageID string, options *GetMessageOptions) (GetMessageResponse, error)

GetMessage - Gets an existing message from an existing thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread to retrieve the specified message from.
  • messageID - The ID of the message to retrieve from the specified thread.
  • options - GetMessageOptions contains the optional parameters for the Client.GetMessage method.

func (*Client) GetRun

func (client *Client) GetRun(ctx context.Context, threadID string, runID string, options *GetRunOptions) (GetRunResponse, error)

GetRun - Gets an existing run from an existing thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread to retrieve run information from.
  • runID - The ID of the thread to retrieve information about.
  • options - GetRunOptions contains the optional parameters for the Client.GetRun method.

func (*Client) GetRunStep

func (client *Client) GetRunStep(ctx context.Context, threadID string, runID string, stepID string, options *GetRunStepOptions) (GetRunStepResponse, error)

GetRunStep - Gets a single run step from a thread run. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread that was run.
  • runID - The ID of the specific run to retrieve the step from.
  • stepID - The ID of the step to retrieve information about.
  • options - GetRunStepOptions contains the optional parameters for the Client.GetRunStep method.

func (*Client) GetThread

func (client *Client) GetThread(ctx context.Context, threadID string, options *GetThreadOptions) (GetThreadResponse, error)

GetThread - Gets information about an existing thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread to retrieve information about.
  • options - GetThreadOptions contains the optional parameters for the Client.GetThread method.

func (*Client) GetVectorStore added in v0.2.0

func (client *Client) GetVectorStore(ctx context.Context, vectorStoreID string, options *GetVectorStoreOptions) (GetVectorStoreResponse, error)

GetVectorStore - Returns the vector store object matching the specified ID. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store to retrieve.
  • options - GetVectorStoreOptions contains the optional parameters for the Client.GetVectorStore method.

func (*Client) GetVectorStoreFile added in v0.2.0

func (client *Client) GetVectorStoreFile(ctx context.Context, vectorStoreID string, fileID string, options *GetVectorStoreFileOptions) (GetVectorStoreFileResponse, error)

GetVectorStoreFile - Retrieves a vector store file. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store that the file belongs to.
  • fileID - The ID of the file being retrieved.
  • options - GetVectorStoreFileOptions contains the optional parameters for the Client.GetVectorStoreFile method.

func (*Client) GetVectorStoreFileBatch added in v0.2.0

func (client *Client) GetVectorStoreFileBatch(ctx context.Context, vectorStoreID string, batchID string, options *GetVectorStoreFileBatchOptions) (GetVectorStoreFileBatchResponse, error)

GetVectorStoreFileBatch - Retrieve a vector store file batch. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store that the file batch belongs to.
  • batchID - The ID of the file batch being retrieved.
  • options - GetVectorStoreFileBatchOptions contains the optional parameters for the Client.GetVectorStoreFileBatch method.

func (*Client) ListFiles

func (client *Client) ListFiles(ctx context.Context, options *ListFilesOptions) (ListFilesResponse, error)

ListFiles - Gets a list of previously uploaded files. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • options - ListFilesOptions contains the optional parameters for the Client.ListFiles method.

func (*Client) ModifyVectorStore added in v0.2.0

func (client *Client) ModifyVectorStore(ctx context.Context, vectorStoreID string, body VectorStoreUpdateBody, options *ModifyVectorStoreOptions) (ModifyVectorStoreResponse, error)

ModifyVectorStore - The ID of the vector store to modify. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • vectorStoreID - The ID of the vector store to modify.
  • body - Request object for updating a vector store.
  • options - ModifyVectorStoreOptions contains the optional parameters for the Client.ModifyVectorStore method.

func (*Client) NewListAssistantsPager

func (c *Client) NewListAssistantsPager(options *ListAssistantsOptions) *runtime.Pager[ListAssistantsResponse]

NewListAssistantsPager returns a pager for assistants.

func (*Client) NewListMessagesPager

func (c *Client) NewListMessagesPager(threadID string, options *ListMessagesOptions) *runtime.Pager[ListMessagesResponse]

NewListMessagesPager returns a pager for messages associated with a thread.

func (*Client) NewListRunStepsPager

func (c *Client) NewListRunStepsPager(threadID string, runID string, options *ListRunStepsOptions) *runtime.Pager[ListRunStepsResponse]

NewListRunStepsPager returns a pager for a Run's steps.

func (*Client) NewListRunsPager

func (c *Client) NewListRunsPager(threadID string, options *ListRunsOptions) *runtime.Pager[ListRunsResponse]

NewListRunsPager returns a pager for a Thread's runs.

func (*Client) NewListVectorStoreFileBatchFilesPager added in v0.2.0

func (c *Client) NewListVectorStoreFileBatchFilesPager(vectorStoreID string, batchID string, options *ListVectorStoreFileBatchFilesOptions) *runtime.Pager[ListVectorStoreFileBatchFilesResponse]

NewListVectorStoreFileBatchFilesPager returns a pager for vector store files in a batch.

func (*Client) NewListVectorStoreFilesPager added in v0.2.0

func (c *Client) NewListVectorStoreFilesPager(vectorStoreID string, options *ListVectorStoreFilesOptions) *runtime.Pager[ListVectorStoreFilesResponse]

NewListVectorStoreFilesPager returns a pager for a vector store files.

func (*Client) NewListVectorStoresPager added in v0.2.0

func (c *Client) NewListVectorStoresPager(options *ListVectorStoresOptions) *runtime.Pager[ListVectorStoresResponse]

NewListVectorStoresPager returns a pager for a VectorStores.

func (*Client) SubmitToolOutputsToRun

func (client *Client) SubmitToolOutputsToRun(ctx context.Context, threadID string, runID string, body SubmitToolOutputsToRunBody, options *SubmitToolOutputsToRunOptions) (SubmitToolOutputsToRunResponse, error)

SubmitToolOutputsToRun - Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requiresaction' with a requiredaction.type of 'submittooloutputs'. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread that was run.
  • runID - The ID of the run that requires tool outputs.
  • options - SubmitToolOutputsToRunOptions contains the optional parameters for the Client.SubmitToolOutputsToRun method.

func (*Client) SubmitToolOutputsToRunStream added in v0.2.0

func (client *Client) SubmitToolOutputsToRunStream(ctx context.Context, threadID string, runID string, body SubmitToolOutputsToRunBody, options *SubmitToolOutputsToRunOptions) (SubmitToolOutputsToRunStreamResponse, error)

SubmitToolOutputsToRunStream is the equivalent of [SubmitToolOutputsToRun], but it returns a stream of responses instead of a single response.

func (*Client) UpdateAssistant

func (client *Client) UpdateAssistant(ctx context.Context, assistantID string, body UpdateAssistantBody, options *UpdateAssistantOptions) (UpdateAssistantResponse, error)

UpdateAssistant - Modifies an existing assistant. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • assistantID - The ID of the assistant to modify.
  • body - The request details to use when modifying an existing assistant.
  • options - UpdateAssistantOptions contains the optional parameters for the Client.UpdateAssistant method.

func (*Client) UpdateMessage

func (client *Client) UpdateMessage(ctx context.Context, threadID string, messageID string, body UpdateMessageBody, options *UpdateMessageOptions) (UpdateMessageResponse, error)

UpdateMessage - Modifies an existing message on an existing thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread containing the specified message to modify.
  • messageID - The ID of the message to modify on the specified thread.
  • options - UpdateMessageOptions contains the optional parameters for the Client.UpdateMessage method.

func (*Client) UpdateRun

func (client *Client) UpdateRun(ctx context.Context, threadID string, runID string, body UpdateRunBody, options *UpdateRunOptions) (UpdateRunResponse, error)

UpdateRun - Modifies an existing thread run. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread associated with the specified run.
  • runID - The ID of the run to modify.
  • options - UpdateRunOptions contains the optional parameters for the Client.UpdateRun method.

func (*Client) UpdateThread

func (client *Client) UpdateThread(ctx context.Context, threadID string, body UpdateThreadBody, options *UpdateThreadOptions) (UpdateThreadResponse, error)

UpdateThread - Modifies an existing thread. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • threadID - The ID of the thread to modify.
  • body - The details used to update an existing assistant thread.
  • options - UpdateThreadOptions contains the optional parameters for the Client.UpdateThread method.

func (*Client) UploadFile

func (client *Client) UploadFile(ctx context.Context, file io.ReadSeeker, purpose FilePurpose, options *UploadFileOptions) (UploadFileResponse, error)

UploadFile - Uploads a file for use by other operations. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-07-01-preview

  • file - The file data (not filename) to upload.
  • purpose - The intended purpose of the file.
  • options - UploadFileOptions contains the optional parameters for the Client.UploadFile method.

type ClientOptions

type ClientOptions struct {
	azcore.ClientOptions
}

ClientOptions contains optional settings for Client.

type CodeInterpreterToolDefinition

type CodeInterpreterToolDefinition struct {
	// REQUIRED; The object type.
	Type *string
}

CodeInterpreterToolDefinition - The input definition information for a code interpreter tool as used to configure an assistant.

func (*CodeInterpreterToolDefinition) GetToolDefinition

func (c *CodeInterpreterToolDefinition) GetToolDefinition() *ToolDefinition

GetToolDefinition implements the ToolDefinitionClassification interface for type CodeInterpreterToolDefinition.

func (CodeInterpreterToolDefinition) MarshalJSON

func (c CodeInterpreterToolDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CodeInterpreterToolDefinition.

func (*CodeInterpreterToolDefinition) UnmarshalJSON

func (c *CodeInterpreterToolDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CodeInterpreterToolDefinition.

type CodeInterpreterToolResource added in v0.2.0

type CodeInterpreterToolResource struct {
	// REQUIRED; A list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated
	// with the tool.
	FileIDs []string
}

CodeInterpreterToolResource - A set of resources that are used by the code_interpreter tool.

func (CodeInterpreterToolResource) MarshalJSON added in v0.2.0

func (c CodeInterpreterToolResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CodeInterpreterToolResource.

func (*CodeInterpreterToolResource) UnmarshalJSON added in v0.2.0

func (c *CodeInterpreterToolResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CodeInterpreterToolResource.

type CreateAndRunThreadBody added in v0.2.0

type CreateAndRunThreadBody struct {
	// REQUIRED; The ID of the assistant for which the thread should be created.
	AssistantID *string

	// The overridden model that the assistant should use to run the thread.
	DeploymentName *string

	// The overridden system instructions the assistant should use to run the thread.
	Instructions *string

	// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to
	// use only the number of completion tokens specified, across multiple turns of the
	// run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details
	// for more info.
	MaxCompletionTokens *int32

	// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use
	// only the number of prompt tokens specified, across multiple turns of the run. If
	// the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details
	// for more info.
	MaxPromptTokens *int32

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// Specifies the format that the model must output.
	ResponseFormat *AssistantResponseFormat

	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower
	// values like 0.2 will make it more focused and deterministic.
	Temperature *float32

	// The details used to create the new thread. If no thread is provided, an empty one will be created.
	Thread *CreateThreadBody

	// Controls whether or not and which tool is called by the model.
	ToolChoice *AssistantsAPIToolChoiceOption

	// Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
	ToolResources *CreateAndRunThreadOptionsToolResources

	// The overridden list of enabled tools the assistant should use to run the thread.
	Tools []ToolDefinitionClassification

	// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens
	// with top_p probability mass. So 0.1 means only the tokens comprising the top
	// 10% probability mass are considered.
	// We generally recommend altering this or temperature but not both.
	TopP *float32

	// The strategy to use for dropping messages as the context windows moves forward.
	TruncationStrategy *CreateAndRunThreadOptionsTruncationStrategy
	// contains filtered or unexported fields
}

CreateAndRunThreadBody - The details used when creating and immediately running a new assistant thread.

func (CreateAndRunThreadBody) MarshalJSON added in v0.2.0

func (c CreateAndRunThreadBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateAndRunThreadBody.

func (*CreateAndRunThreadBody) UnmarshalJSON added in v0.2.0

func (c *CreateAndRunThreadBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateAndRunThreadBody.

type CreateAndRunThreadOptionsToolResources added in v0.2.0

type CreateAndRunThreadOptionsToolResources struct {
	// Overrides the list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated
	// with the tool.
	CodeInterpreter *UpdateCodeInterpreterToolResourceOptions

	// Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
	FileSearch *UpdateFileSearchToolResourceOptions
}

CreateAndRunThreadOptionsToolResources - Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.

func (CreateAndRunThreadOptionsToolResources) MarshalJSON added in v0.2.0

func (c CreateAndRunThreadOptionsToolResources) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateAndRunThreadOptionsToolResources.

func (*CreateAndRunThreadOptionsToolResources) UnmarshalJSON added in v0.2.0

func (c *CreateAndRunThreadOptionsToolResources) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateAndRunThreadOptionsToolResources.

type CreateAndRunThreadOptionsTruncationStrategy added in v0.2.0

type CreateAndRunThreadOptionsTruncationStrategy struct {
	// REQUIRED; The truncation strategy to use for the thread. The default is auto. If set to last_messages, the thread will
	// be truncated to the lastMessages count most recent messages in the thread. When set to auto
	// , messages in the middle of the thread will be dropped to fit the context length of the model, max_prompt_tokens.
	Type *TruncationStrategy

	// The number of most recent messages from the thread when constructing the context for the run.
	LastMessages *int32
}

CreateAndRunThreadOptionsTruncationStrategy - The strategy to use for dropping messages as the context windows moves forward.

func (CreateAndRunThreadOptionsTruncationStrategy) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type CreateAndRunThreadOptionsTruncationStrategy.

func (*CreateAndRunThreadOptionsTruncationStrategy) UnmarshalJSON added in v0.2.0

func (c *CreateAndRunThreadOptionsTruncationStrategy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateAndRunThreadOptionsTruncationStrategy.

type CreateAssistantBody added in v0.2.0

type CreateAssistantBody struct {
	// REQUIRED; The ID of the model to use.
	DeploymentName *string

	// The description of the new assistant.
	Description *string

	// The system instructions for the new assistant to use.
	Instructions *string

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// The name of the new assistant.
	Name *string

	// The response format of the tool calls used by this assistant.
	ResponseFormat *AssistantResponseFormat

	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower
	// values like 0.2 will make it more focused and deterministic.
	Temperature *float32

	// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example,
	// the code_interpretertool requires a list of file IDs, while the file_search tool
	// requires a list of vector store IDs.
	ToolResources *AssistantCreationOptionsToolResources

	// The collection of tools to enable for the new assistant.
	Tools []ToolDefinitionClassification

	// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens
	// with top_p probability mass. So 0.1 means only the tokens comprising the top
	// 10% probability mass are considered.
	// We generally recommend altering this or temperature but not both.
	TopP *float32
}

CreateAssistantBody - The request details to use when creating a new assistant.

func (CreateAssistantBody) MarshalJSON added in v0.2.0

func (c CreateAssistantBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateAssistantBody.

func (*CreateAssistantBody) UnmarshalJSON added in v0.2.0

func (c *CreateAssistantBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateAssistantBody.

type CreateAssistantOptions

type CreateAssistantOptions struct {
}

CreateAssistantOptions contains the optional parameters for the Client.CreateAssistant method.

type CreateAssistantResponse

type CreateAssistantResponse struct {
	// Represents an assistant that can call the model and use tools.
	Assistant
}

CreateAssistantResponse contains the response from method Client.CreateAssistant.

type CreateCodeInterpreterToolResourceOptions added in v0.2.0

type CreateCodeInterpreterToolResourceOptions struct {
	// A list of file IDs made available to the code_interpreter tool.
	FileIDs []string
}

CreateCodeInterpreterToolResourceOptions - A set of resources that will be used by the code_interpreter tool. Request object.

func (CreateCodeInterpreterToolResourceOptions) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type CreateCodeInterpreterToolResourceOptions.

func (*CreateCodeInterpreterToolResourceOptions) UnmarshalJSON added in v0.2.0

func (c *CreateCodeInterpreterToolResourceOptions) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateCodeInterpreterToolResourceOptions.

type CreateFileSearchToolResourceOptions added in v0.2.0

type CreateFileSearchToolResourceOptions struct {
	// VectorStoreIDs are the vector stores that will be attached to this assistant.
	// NOTE: There can be a maximum of 1 vector store attached to the assistant.
	VectorStoreIDs []string `json:"vector_store_ids"`

	// VectorStores can be set to create a vector store with file_ids and attach it to
	// this assistant.
	// NOTE: There can be a maximum of 1 vector store attached to the assistant.
	VectorStores []CreateFileSearchToolResourceVectorStoreOptions `json:"vector_stores"`
}

CreateFileSearchToolResourceOptions is set of resources that are used by the file search tool.

type CreateFileSearchToolResourceVectorStoreOptions added in v0.2.0

type CreateFileSearchToolResourceVectorStoreOptions struct {
	// REQUIRED; The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.
	ChunkingStrategy VectorStoreChunkingStrategyRequestClassification

	// REQUIRED; A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
	FileIDs []string

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string
}

CreateFileSearchToolResourceVectorStoreOptions - File IDs associated to the vector store to be passed to the helper.

func (CreateFileSearchToolResourceVectorStoreOptions) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type CreateFileSearchToolResourceVectorStoreOptions.

func (*CreateFileSearchToolResourceVectorStoreOptions) UnmarshalJSON added in v0.2.0

UnmarshalJSON implements the json.Unmarshaller interface for type CreateFileSearchToolResourceVectorStoreOptions.

type CreateMessageBody

type CreateMessageBody struct {
	// REQUIRED; The textual content of the initial message. Currently, robust input including images and annotated text may only
	// be provided via a separate call to the create message API.
	Content *string

	// REQUIRED; The role of the entity that is creating the message. Allowed values include:
	// * user: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
	// * assistant: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant
	// into the conversation.
	Role *MessageRole

	// A list of files attached to the message, and the tools they should be added to.
	Attachments []MessageAttachment

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string
}

CreateMessageBody - A single message within an assistant thread, as provided during that thread's creation for its initial state.

func (CreateMessageBody) MarshalJSON

func (c CreateMessageBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateMessageBody.

func (*CreateMessageBody) UnmarshalJSON

func (c *CreateMessageBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateMessageBody.

type CreateMessageOptions

type CreateMessageOptions struct {
}

CreateMessageOptions contains the optional parameters for the Client.CreateMessage method.

type CreateMessageResponse

type CreateMessageResponse struct {
	// A single, existing message within an assistant thread.
	ThreadMessage
}

CreateMessageResponse contains the response from method Client.CreateMessage.

type CreateRunBody

type CreateRunBody struct {
	// REQUIRED; The ID of the assistant that should run the thread.
	AssistantID *string

	// Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior
	// on a per-run basis without overriding other instructions.
	AdditionalInstructions *string

	// Adds additional messages to the thread before creating the run.
	AdditionalMessages []ThreadMessage

	// The overridden system instructions that the assistant should use to run the thread.
	Instructions *string

	// The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to
	// use only the number of completion tokens specified, across multiple turns of the
	// run. If the run exceeds the number of completion tokens specified, the run will end with status incomplete. See incomplete_details
	// for more info.
	MaxCompletionTokens *int32

	// The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use
	// only the number of prompt tokens specified, across multiple turns of the run. If
	// the run exceeds the number of prompt tokens specified, the run will end with status incomplete. See incomplete_details
	// for more info.
	MaxPromptTokens *int32

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// The overridden model name that the assistant should use to run the thread.
	Model *string

	// Specifies the format that the model must output.
	ResponseFormat *AssistantResponseFormat

	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower
	// values like 0.2 will make it more focused and deterministic.
	Temperature *float32

	// Controls whether or not and which tool is called by the model.
	ToolChoice *AssistantsAPIToolChoiceOption

	// The overridden list of enabled tools that the assistant should use to run the thread.
	Tools []ToolDefinitionClassification

	// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens
	// with top_p probability mass. So 0.1 means only the tokens comprising the top
	// 10% probability mass are considered.
	// We generally recommend altering this or temperature but not both.
	TopP *float32

	// The strategy to use for dropping messages as the context windows moves forward.
	TruncationStrategy *CreateRunOptionsTruncationStrategy
	// contains filtered or unexported fields
}

CreateRunBody - The details used when creating a new run of an assistant thread.

func (CreateRunBody) MarshalJSON

func (c CreateRunBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateRunBody.

func (*CreateRunBody) UnmarshalJSON

func (c *CreateRunBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateRunBody.

type CreateRunOptions

type CreateRunOptions struct {
}

CreateRunOptions contains the optional parameters for the Client.CreateRun method.

type CreateRunOptionsTruncationStrategy added in v0.2.0

type CreateRunOptionsTruncationStrategy struct {
	// REQUIRED; The truncation strategy to use for the thread. The default is auto. If set to last_messages, the thread will
	// be truncated to the lastMessages count most recent messages in the thread. When set to auto
	// , messages in the middle of the thread will be dropped to fit the context length of the model, max_prompt_tokens.
	Type *TruncationStrategy

	// The number of most recent messages from the thread when constructing the context for the run.
	LastMessages *int32
}

CreateRunOptionsTruncationStrategy - The strategy to use for dropping messages as the context windows moves forward.

func (CreateRunOptionsTruncationStrategy) MarshalJSON added in v0.2.0

func (c CreateRunOptionsTruncationStrategy) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateRunOptionsTruncationStrategy.

func (*CreateRunOptionsTruncationStrategy) UnmarshalJSON added in v0.2.0

func (c *CreateRunOptionsTruncationStrategy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateRunOptionsTruncationStrategy.

type CreateRunResponse

type CreateRunResponse struct {
	// Data representing a single evaluation run of an assistant thread.
	ThreadRun
}

CreateRunResponse contains the response from method Client.CreateRun.

type CreateRunStreamOptions added in v0.2.0

type CreateRunStreamOptions struct {
}

CreateRunStreamOptions contains the optional parameters for [CreateRunStream].

type CreateRunStreamResponse added in v0.2.0

type CreateRunStreamResponse struct {
	// Stream can be used to stream response events.
	Stream *EventReader[StreamEvent]
}

CreateRunStreamResponse contains the response from [CreateRunStream].

type CreateThreadAndRunOptions

type CreateThreadAndRunOptions struct {
}

CreateThreadAndRunOptions contains the optional parameters for the Client.CreateThreadAndRun method.

type CreateThreadAndRunResponse

type CreateThreadAndRunResponse struct {
	// Data representing a single evaluation run of an assistant thread.
	ThreadRun
}

CreateThreadAndRunResponse contains the response from method Client.CreateThreadAndRun.

type CreateThreadAndRunStreamOptions added in v0.2.0

type CreateThreadAndRunStreamOptions struct {
}

CreateThreadAndRunStreamOptions contains the optional parameters for [CreateThreadAndRunStream].

type CreateThreadAndRunStreamResponse added in v0.2.0

type CreateThreadAndRunStreamResponse struct {
	// Stream can be used to stream response events.
	Stream *EventReader[StreamEvent]
}

CreateThreadAndRunStreamResponse contains the response from [CreateThreadAndRunStream].

type CreateThreadBody added in v0.2.0

type CreateThreadBody struct {
	// The initial messages to associate with the new thread.
	Messages []CreateMessageBody

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type
	// of tool. For example, the code_interpreter tool requires a list of file IDs,
	// while the file_search tool requires a list of vector store IDs.
	ToolResources *AssistantThreadCreationOptionsToolResources
}

CreateThreadBody - The details used to create a new assistant thread.

func (CreateThreadBody) MarshalJSON added in v0.2.0

func (c CreateThreadBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateThreadBody.

func (*CreateThreadBody) UnmarshalJSON added in v0.2.0

func (c *CreateThreadBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateThreadBody.

type CreateThreadOptions

type CreateThreadOptions struct {
}

CreateThreadOptions contains the optional parameters for the Client.CreateThread method.

type CreateThreadResponse

type CreateThreadResponse struct {
	// Information about a single thread associated with an assistant.
	AssistantThread
}

CreateThreadResponse contains the response from method Client.CreateThread.

type CreateToolResourcesOptions added in v0.2.0

type CreateToolResourcesOptions struct {
	// A list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated with the
	// tool.
	CodeInterpreter *CreateCodeInterpreterToolResourceOptions

	// A list of vector stores or their IDs made available to the file_search tool.
	FileSearch *CreateFileSearchToolResourceOptions
}

CreateToolResourcesOptions - Request object. A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_searchtool requires a list of vector store IDs.

func (CreateToolResourcesOptions) MarshalJSON added in v0.2.0

func (c CreateToolResourcesOptions) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateToolResourcesOptions.

func (*CreateToolResourcesOptions) UnmarshalJSON added in v0.2.0

func (c *CreateToolResourcesOptions) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateToolResourcesOptions.

type CreateVectorStoreFileBatchBody added in v0.2.0

type CreateVectorStoreFileBatchBody struct {
	// REQUIRED; A list of File IDs that the vector store should use. Useful for tools like file_search that can access files.
	FileIDs []string

	// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.
	ChunkingStrategy VectorStoreChunkingStrategyRequestClassification
}

CreateVectorStoreFileBatchBody contains arguments for the [CreateVectorStoreFileBatch] method.

func (CreateVectorStoreFileBatchBody) MarshalJSON added in v0.2.0

func (c CreateVectorStoreFileBatchBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateVectorStoreFileBatchBody.

func (*CreateVectorStoreFileBatchBody) UnmarshalJSON added in v0.2.0

func (c *CreateVectorStoreFileBatchBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateVectorStoreFileBatchBody.

type CreateVectorStoreFileBatchOptions added in v0.2.0

type CreateVectorStoreFileBatchOptions struct {
}

CreateVectorStoreFileBatchOptions contains the optional parameters for the Client.CreateVectorStoreFileBatch method.

type CreateVectorStoreFileBatchResponse added in v0.2.0

type CreateVectorStoreFileBatchResponse struct {
	// A batch of files attached to a vector store.
	VectorStoreFileBatch
}

CreateVectorStoreFileBatchResponse contains the response from method Client.CreateVectorStoreFileBatch.

type CreateVectorStoreFileBody added in v0.2.1

type CreateVectorStoreFileBody struct {
	// REQUIRED; A File ID that the vector store should use. Useful for tools like file_search that can access files.
	FileID *string

	// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.
	ChunkingStrategy VectorStoreChunkingStrategyRequestClassification
}

CreateVectorStoreFileBody contains arguments for the [CreateVectorStoreFile] method.

func (CreateVectorStoreFileBody) MarshalJSON added in v0.2.1

func (p CreateVectorStoreFileBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CreateVectorStoreFileBody.

func (*CreateVectorStoreFileBody) UnmarshalJSON added in v0.2.1

func (p *CreateVectorStoreFileBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CreateVectorStoreFileBody.

type CreateVectorStoreFileOptions added in v0.2.0

type CreateVectorStoreFileOptions struct {
}

CreateVectorStoreFileOptions contains the optional parameters for the Client.CreateVectorStoreFile method.

type CreateVectorStoreFileResponse added in v0.2.0

type CreateVectorStoreFileResponse struct {
	// Description of a file attached to a vector store.
	VectorStoreFile
}

CreateVectorStoreFileResponse contains the response from method Client.CreateVectorStoreFile.

type CreateVectorStoreOptions added in v0.2.0

type CreateVectorStoreOptions struct {
}

CreateVectorStoreOptions contains the optional parameters for the Client.CreateVectorStore method.

type CreateVectorStoreResponse added in v0.2.0

type CreateVectorStoreResponse struct {
	// A vector store is a collection of processed files can be used by the `file_search` tool.
	VectorStore
}

CreateVectorStoreResponse contains the response from method Client.CreateVectorStore.

type DeleteAssistantOptions

type DeleteAssistantOptions struct {
}

DeleteAssistantOptions contains the optional parameters for the Client.DeleteAssistant method.

type DeleteAssistantResponse

type DeleteAssistantResponse struct {
	// The status of an assistant deletion operation.
	AssistantDeletionStatus
}

DeleteAssistantResponse contains the response from method Client.DeleteAssistant.

type DeleteFileOptions

type DeleteFileOptions struct {
}

DeleteFileOptions contains the optional parameters for the Client.DeleteFile method.

type DeleteFileResponse

type DeleteFileResponse struct {
	// A status response from a file deletion operation.
	FileDeletionStatus
}

DeleteFileResponse contains the response from method Client.DeleteFile.

type DeleteThreadOptions

type DeleteThreadOptions struct {
}

DeleteThreadOptions contains the optional parameters for the Client.DeleteThread method.

type DeleteThreadResponse

type DeleteThreadResponse struct {
	// The status of a thread deletion operation.
	ThreadDeletionStatus
}

DeleteThreadResponse contains the response from method Client.DeleteThread.

type DeleteVectorStoreFileOptions added in v0.2.0

type DeleteVectorStoreFileOptions struct {
}

DeleteVectorStoreFileOptions contains the optional parameters for the Client.DeleteVectorStoreFile method.

type DeleteVectorStoreFileResponse added in v0.2.0

type DeleteVectorStoreFileResponse struct {
	// Response object for deleting a vector store file relationship.
	VectorStoreFileDeletionStatus
}

DeleteVectorStoreFileResponse contains the response from method Client.DeleteVectorStoreFile.

type DeleteVectorStoreOptions added in v0.2.0

type DeleteVectorStoreOptions struct {
}

DeleteVectorStoreOptions contains the optional parameters for the Client.DeleteVectorStore method.

type DeleteVectorStoreResponse added in v0.2.0

type DeleteVectorStoreResponse struct {
	// Response object for deleting a vector store.
	VectorStoreDeletionStatus
}

DeleteVectorStoreResponse contains the response from method Client.DeleteVectorStore.

type DoneEvent added in v0.2.0

type DoneEvent string

DoneEvent - Terminal event indicating the successful end of a stream.

const (
	// DoneEventDone - Event sent when the stream is done.
	DoneEventDone DoneEvent = "done"
)

func PossibleDoneEventValues added in v0.2.0

func PossibleDoneEventValues() []DoneEvent

PossibleDoneEventValues returns the possible values for the DoneEvent const type.

type ErrorEvent added in v0.2.0

type ErrorEvent string

ErrorEvent - Terminal event indicating a server side error while streaming.

const (
	// ErrorEventError - Event sent when an error occurs, such as an internal server error or a timeout.
	ErrorEventError ErrorEvent = "error"
)

func PossibleErrorEventValues added in v0.2.0

func PossibleErrorEventValues() []ErrorEvent

PossibleErrorEventValues returns the possible values for the ErrorEvent const type.

type EventReader added in v0.2.0

type EventReader[T any] struct {
	// contains filtered or unexported fields
}

EventReader streams events dynamically from an OpenAI endpoint.

func (*EventReader[T]) Close added in v0.2.0

func (er *EventReader[T]) Close() error

Close closes the EventReader and any applicable inner stream state.

func (*EventReader[T]) Read added in v0.2.0

func (er *EventReader[T]) Read() (T, error)

Read reads the next event from the stream. Returns io.EOF when there are no further events.

type FileDeletionStatus

type FileDeletionStatus struct {
	// REQUIRED; A value indicating whether deletion was successful.
	Deleted *bool

	// REQUIRED; The ID of the resource specified for deletion.
	ID *string

	// REQUIRED; The object type, which is always 'file'.
	Object *string
}

FileDeletionStatus - A status response from a file deletion operation.

func (FileDeletionStatus) MarshalJSON

func (f FileDeletionStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FileDeletionStatus.

func (*FileDeletionStatus) UnmarshalJSON

func (f *FileDeletionStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FileDeletionStatus.

type FileListResponse

type FileListResponse struct {
	// REQUIRED; The files returned for the request.
	Data []OpenAIFile

	// REQUIRED; The object type, which is always 'list'.
	Object *string
}

FileListResponse - The response data from a file list operation.

func (FileListResponse) MarshalJSON

func (f FileListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FileListResponse.

func (*FileListResponse) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type FileListResponse.

type FilePurpose

type FilePurpose string

FilePurpose - The possible values denoting the intended usage of a file.

const (
	// FilePurposeAssistants - Indicates a file is used as input to assistants.
	FilePurposeAssistants FilePurpose = "assistants"
	// FilePurposeAssistantsOutput - Indicates a file is used as output by assistants.
	FilePurposeAssistantsOutput FilePurpose = "assistants_output"
	// FilePurposeBatch - Indicates a file is used as input to .
	FilePurposeBatch FilePurpose = "batch"
	// FilePurposeBatchOutput - Indicates a file is used as output by a vector store batch operation.
	FilePurposeBatchOutput FilePurpose = "batch_output"
	// FilePurposeFineTune - Indicates a file is used for fine tuning input.
	FilePurposeFineTune FilePurpose = "fine-tune"
	// FilePurposeFineTuneResults - Indicates a file is used for fine tuning results.
	FilePurposeFineTuneResults FilePurpose = "fine-tune-results"
	// FilePurposeVision - Indicates a file is used as input to a vision operation.
	FilePurposeVision FilePurpose = "vision"
)

func PossibleFilePurposeValues

func PossibleFilePurposeValues() []FilePurpose

PossibleFilePurposeValues returns the possible values for the FilePurpose const type.

type FileSearchToolDefinition added in v0.2.0

type FileSearchToolDefinition struct {
	// REQUIRED; The object type.
	Type *string

	// Options overrides for the file search tool.
	FileSearch *FileSearchToolDefinitionDetails
}

FileSearchToolDefinition - The input definition information for a file search tool as used to configure an assistant.

func (*FileSearchToolDefinition) GetToolDefinition added in v0.2.0

func (f *FileSearchToolDefinition) GetToolDefinition() *ToolDefinition

GetToolDefinition implements the ToolDefinitionClassification interface for type FileSearchToolDefinition.

func (FileSearchToolDefinition) MarshalJSON added in v0.2.0

func (f FileSearchToolDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FileSearchToolDefinition.

func (*FileSearchToolDefinition) UnmarshalJSON added in v0.2.0

func (f *FileSearchToolDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FileSearchToolDefinition.

type FileSearchToolDefinitionDetails added in v0.2.1

type FileSearchToolDefinitionDetails struct {
	// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo.
	// This number should be between 1 and 50 inclusive.
	// Note that the file search tool may output fewer than max_num_results results. See the file search tool documentation for
	// more information.
	MaxNumResults *int32
}

FileSearchToolDefinitionDetails - Options overrides for the file search tool.

func (FileSearchToolDefinitionDetails) MarshalJSON added in v0.2.1

func (f FileSearchToolDefinitionDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FileSearchToolDefinitionDetails.

func (*FileSearchToolDefinitionDetails) UnmarshalJSON added in v0.2.1

func (f *FileSearchToolDefinitionDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FileSearchToolDefinitionDetails.

type FileSearchToolResource added in v0.2.0

type FileSearchToolResource struct {
	// The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
	VectorStoreIDs []string
}

FileSearchToolResource - A set of resources that are used by the file_search tool.

func (FileSearchToolResource) MarshalJSON added in v0.2.0

func (f FileSearchToolResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FileSearchToolResource.

func (*FileSearchToolResource) UnmarshalJSON added in v0.2.0

func (f *FileSearchToolResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FileSearchToolResource.

type FileState added in v0.2.0

type FileState string

FileState - The state of the file.

const (
	// FileStateDeleted - The entity has been deleted but may still be referenced by other entities predating the deletion. It
	// can be categorized as a
	// terminal state.
	FileStateDeleted FileState = "deleted"
	// FileStateDeleting - The entity is in the process to be deleted. This state is not returned by Azure OpenAI and exposed
	// only for compatibility.
	// It can be categorized as an active state.
	FileStateDeleting FileState = "deleting"
	// FileStateError - The operation has completed processing with a failure and cannot be further consumed. It can be categorized
	// as a terminal state.
	FileStateError FileState = "error"
	// FileStatePending - The operation was created and is not queued to be processed in the future. It can be categorized as
	// an inactive state.
	FileStatePending FileState = "pending"
	// FileStateProcessed - The operation has successfully processed and is ready for consumption. It can be categorized as a
	// terminal state.
	FileStateProcessed FileState = "processed"
	// FileStateRunning - The operation has started to be processed. It can be categorized as an active state.
	FileStateRunning FileState = "running"
	// FileStateUploaded - The file has been uploaded but it's not yet processed. This state is not returned by Azure OpenAI and
	// exposed only for
	// compatibility. It can be categorized as an inactive state.
	FileStateUploaded FileState = "uploaded"
)

func PossibleFileStateValues added in v0.2.0

func PossibleFileStateValues() []FileState

PossibleFileStateValues returns the possible values for the FileState const type.

type FunctionDefinition

type FunctionDefinition struct {
	// REQUIRED; The name of the function to be called.
	Name *string

	// REQUIRED; The parameters the functions accepts, described as a JSON Schema object.
	Parameters any

	// A description of what the function does, used by the model to choose when and how to call the function.
	Description *string
}

FunctionDefinition - The input definition information for a function.

func (FunctionDefinition) MarshalJSON

func (f FunctionDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FunctionDefinition.

func (*FunctionDefinition) UnmarshalJSON

func (f *FunctionDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FunctionDefinition.

type FunctionName added in v0.2.0

type FunctionName struct {
	// REQUIRED; The name of the function to call
	Name *string
}

FunctionName - The function name that will be used, if using the function tool

func (FunctionName) MarshalJSON added in v0.2.0

func (f FunctionName) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FunctionName.

func (*FunctionName) UnmarshalJSON added in v0.2.0

func (f *FunctionName) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FunctionName.

type FunctionToolDefinition

type FunctionToolDefinition struct {
	// REQUIRED; The definition of the concrete function that the function tool should call.
	Function *FunctionDefinition

	// REQUIRED; The object type.
	Type *string
}

FunctionToolDefinition - The input definition information for a function tool as used to configure an assistant.

func (*FunctionToolDefinition) GetToolDefinition

func (f *FunctionToolDefinition) GetToolDefinition() *ToolDefinition

GetToolDefinition implements the ToolDefinitionClassification interface for type FunctionToolDefinition.

func (FunctionToolDefinition) MarshalJSON

func (f FunctionToolDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FunctionToolDefinition.

func (*FunctionToolDefinition) UnmarshalJSON

func (f *FunctionToolDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FunctionToolDefinition.

type GetAssistantOptions

type GetAssistantOptions struct {
}

GetAssistantOptions contains the optional parameters for the Client.GetAssistant method.

type GetAssistantResponse

type GetAssistantResponse struct {
	// Represents an assistant that can call the model and use tools.
	Assistant
}

GetAssistantResponse contains the response from method Client.GetAssistant.

type GetFileContentOptions

type GetFileContentOptions struct {
}

GetFileContentOptions contains the options for the Client.GetFileContent function.

type GetFileContentResponse

type GetFileContentResponse struct {
	// Content is the content of the file that's been downloaded.
	// NOTE: this must be Close()'d to avoid leaking resources.
	Content io.ReadCloser
}

GetFileContentResponse contains the response from the Client.GetFileContent function.

type GetFileOptions

type GetFileOptions struct {
}

GetFileOptions contains the optional parameters for the Client.GetFile method.

type GetFileResponse

type GetFileResponse struct {
	// Represents an assistant that can call the model and use tools.
	OpenAIFile
}

GetFileResponse contains the response from method Client.GetFile.

type GetMessageOptions

type GetMessageOptions struct {
}

GetMessageOptions contains the optional parameters for the Client.GetMessage method.

type GetMessageResponse

type GetMessageResponse struct {
	// A single, existing message within an assistant thread.
	ThreadMessage
}

GetMessageResponse contains the response from method Client.GetMessage.

type GetRunOptions

type GetRunOptions struct {
}

GetRunOptions contains the optional parameters for the Client.GetRun method.

type GetRunResponse

type GetRunResponse struct {
	// Data representing a single evaluation run of an assistant thread.
	ThreadRun
}

GetRunResponse contains the response from method Client.GetRun.

type GetRunStepOptions

type GetRunStepOptions struct {
}

GetRunStepOptions contains the optional parameters for the Client.GetRunStep method.

type GetRunStepResponse

type GetRunStepResponse struct {
	// Detailed information about a single step of an assistant thread run.
	RunStep
}

GetRunStepResponse contains the response from method Client.GetRunStep.

type GetThreadOptions

type GetThreadOptions struct {
}

GetThreadOptions contains the optional parameters for the Client.GetThread method.

type GetThreadResponse

type GetThreadResponse struct {
	// Information about a single thread associated with an assistant.
	AssistantThread
}

GetThreadResponse contains the response from method Client.GetThread.

type GetVectorStoreFileBatchOptions added in v0.2.0

type GetVectorStoreFileBatchOptions struct {
}

GetVectorStoreFileBatchOptions contains the optional parameters for the Client.GetVectorStoreFileBatch method.

type GetVectorStoreFileBatchResponse added in v0.2.0

type GetVectorStoreFileBatchResponse struct {
	// A batch of files attached to a vector store.
	VectorStoreFileBatch
}

GetVectorStoreFileBatchResponse contains the response from method Client.GetVectorStoreFileBatch.

type GetVectorStoreFileOptions added in v0.2.0

type GetVectorStoreFileOptions struct {
}

GetVectorStoreFileOptions contains the optional parameters for the Client.GetVectorStoreFile method.

type GetVectorStoreFileResponse added in v0.2.0

type GetVectorStoreFileResponse struct {
	// Description of a file attached to a vector store.
	VectorStoreFile
}

GetVectorStoreFileResponse contains the response from method Client.GetVectorStoreFile.

type GetVectorStoreOptions added in v0.2.0

type GetVectorStoreOptions struct {
}

GetVectorStoreOptions contains the optional parameters for the Client.GetVectorStore method.

type GetVectorStoreResponse added in v0.2.0

type GetVectorStoreResponse struct {
	// A vector store is a collection of processed files can be used by the `file_search` tool.
	VectorStore
}

GetVectorStoreResponse contains the response from method Client.GetVectorStore.

type IncompleteRunDetails added in v0.2.0

type IncompleteRunDetails string

IncompleteRunDetails - The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run.

const (
	// IncompleteRunDetailsMaxCompletionTokens - Maximum completion tokens exceeded
	IncompleteRunDetailsMaxCompletionTokens IncompleteRunDetails = "max_completion_tokens"
	// IncompleteRunDetailsMaxPromptTokens - Maximum prompt tokens exceeded
	IncompleteRunDetailsMaxPromptTokens IncompleteRunDetails = "max_prompt_tokens"
)

func PossibleIncompleteRunDetailsValues added in v0.2.0

func PossibleIncompleteRunDetailsValues() []IncompleteRunDetails

PossibleIncompleteRunDetailsValues returns the possible values for the IncompleteRunDetails const type.

type ListAssistantsOptions

type ListAssistantsOptions struct {
	// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include after=objfoo in order to fetch the next page of the list.
	After *string

	// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include before=objfoo in order to fetch the previous page of the list.
	Before *string

	// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
	Limit *int32

	// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
	Order *ListSortOrder
}

ListAssistantsOptions contains the optional parameters for the Client.ListAssistants method.

type ListAssistantsResponse

type ListAssistantsResponse struct {
	// The response data for a requested list of items.
	AssistantsPage
}

ListAssistantsResponse contains the response from method Client.ListAssistants.

type ListFilesOptions

type ListFilesOptions struct {
	// A value that, when provided, limits list results to files matching the corresponding purpose.
	Purpose *FilePurpose
}

ListFilesOptions contains the optional parameters for the Client.ListFiles method.

type ListFilesResponse

type ListFilesResponse struct {
	// The response data from a file list operation.
	FileListResponse
}

ListFilesResponse contains the response from method Client.ListFiles.

type ListMessagesOptions

type ListMessagesOptions struct {
	// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include after=objfoo in order to fetch the next page of the list.
	After *string

	// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include before=objfoo in order to fetch the previous page of the list.
	Before *string

	// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
	Limit *int32

	// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
	Order *ListSortOrder

	// Filter messages by the run ID that generated them.
	RunID *string
}

ListMessagesOptions contains the optional parameters for the Client.ListMessages method.

type ListMessagesResponse

type ListMessagesResponse struct {
	// The response data for a requested list of items.
	ThreadMessagesPage
}

ListMessagesResponse contains the response from method Client.ListMessages.

type ListRunStepsOptions

type ListRunStepsOptions struct {
	// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include after=objfoo in order to fetch the next page of the list.
	After *string

	// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include before=objfoo in order to fetch the previous page of the list.
	Before *string

	// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
	Limit *int32

	// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
	Order *ListSortOrder
}

ListRunStepsOptions contains the optional parameters for the Client.ListRunSteps method.

type ListRunStepsResponse

type ListRunStepsResponse struct {
	// The response data for a requested list of items.
	ThreadRunStepsPage
}

ListRunStepsResponse contains the response from method Client.ListRunSteps.

type ListRunsOptions

type ListRunsOptions struct {
	// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include after=objfoo in order to fetch the next page of the list.
	After *string

	// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include before=objfoo in order to fetch the previous page of the list.
	Before *string

	// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
	Limit *int32

	// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
	Order *ListSortOrder
}

ListRunsOptions contains the optional parameters for the Client.ListRuns method.

type ListRunsResponse

type ListRunsResponse struct {
	// The response data for a requested list of items.
	ThreadRunsPage
}

ListRunsResponse contains the response from method Client.ListRuns.

type ListSortOrder

type ListSortOrder string

ListSortOrder - The available sorting options when requesting a list of response objects.

const (
	// ListSortOrderAscending - Specifies an ascending sort order.
	ListSortOrderAscending ListSortOrder = "asc"
	// ListSortOrderDescending - Specifies a descending sort order.
	ListSortOrderDescending ListSortOrder = "desc"
)

func PossibleListSortOrderValues

func PossibleListSortOrderValues() []ListSortOrder

PossibleListSortOrderValues returns the possible values for the ListSortOrder const type.

type ListVectorStoreFileBatchFilesOptions added in v0.2.0

type ListVectorStoreFileBatchFilesOptions struct {
	// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include after=objfoo in order to fetch the next page of the list.
	After *string

	// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include before=objfoo in order to fetch the previous page of the list.
	Before *string

	// Filter by file status.
	Filter *VectorStoreFileStatusFilter

	// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
	Limit *int32

	// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
	Order *ListSortOrder
}

ListVectorStoreFileBatchFilesOptions contains the optional parameters for the Client.ListVectorStoreFileBatchFiles method.

type ListVectorStoreFileBatchFilesResponse added in v0.2.0

type ListVectorStoreFileBatchFilesResponse struct {
	// The response data for a requested list of items.
	VectorStoreFileBatchesPage
}

ListVectorStoreFileBatchFilesResponse contains the response from method Client.ListVectorStoreFileBatchFiles.

type ListVectorStoreFilesOptions added in v0.2.0

type ListVectorStoreFilesOptions struct {
	// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include after=objfoo in order to fetch the next page of the list.
	After *string

	// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include before=objfoo in order to fetch the previous page of the list.
	Before *string

	// Filter by file status.
	Filter *VectorStoreFileStatusFilter

	// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
	Limit *int32

	// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
	Order *ListSortOrder
}

ListVectorStoreFilesOptions contains the optional parameters for the Client.ListVectorStoreFiles method.

type ListVectorStoreFilesResponse added in v0.2.0

type ListVectorStoreFilesResponse struct {
	// The response data for a requested list of items.
	VectorStoreFilesPage
}

ListVectorStoreFilesResponse contains the response from method Client.ListVectorStoreFiles.

type ListVectorStoresOptions added in v0.2.0

type ListVectorStoresOptions struct {
	// A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include after=objfoo in order to fetch the next page of the list.
	After *string

	// A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a
	// list request and receive 100 objects, ending with objfoo, your subsequent call
	// can include before=objfoo in order to fetch the previous page of the list.
	Before *string

	// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
	Limit *int32

	// Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
	Order *ListSortOrder
}

ListVectorStoresOptions contains the optional parameters for the Client.ListVectorStores method.

type ListVectorStoresResponse added in v0.2.0

type ListVectorStoresResponse struct {
	// The response data for a requested list of items.
	VectorStoresPage
}

ListVectorStoresResponse contains the response from method Client.ListVectorStores.

type MessageAttachment added in v0.2.0

type MessageAttachment struct {
	// REQUIRED; The ID of the file to attach to the message.
	FileID *string

	// REQUIRED; The tools to add to this file.
	Tools []MessageAttachmentToolAssignment
}

MessageAttachment - This describes to which tools a file has been attached.

func (MessageAttachment) MarshalJSON added in v0.2.0

func (m MessageAttachment) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageAttachment.

func (*MessageAttachment) UnmarshalJSON added in v0.2.0

func (m *MessageAttachment) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageAttachment.

type MessageAttachmentToolAssignment added in v0.2.1

type MessageAttachmentToolAssignment struct {
	// REQUIRED; The type of the tool being selected.
	Type *MessageAttachmentToolAssignmentType
}

MessageAttachmentToolAssignment - The possible tools to which files will be added by this message

func (MessageAttachmentToolAssignment) MarshalJSON added in v0.2.1

func (m MessageAttachmentToolAssignment) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageAttachmentToolAssignment.

func (*MessageAttachmentToolAssignment) UnmarshalJSON added in v0.2.1

func (m *MessageAttachmentToolAssignment) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageAttachmentToolAssignment.

type MessageAttachmentToolAssignmentType added in v0.2.1

type MessageAttachmentToolAssignmentType string

MessageAttachmentToolAssignmentType - The type of the tool being selected.

const (
	MessageAttachmentToolAssignmentTypeCodeInterpreter MessageAttachmentToolAssignmentType = "code_interpreter"
	MessageAttachmentToolAssignmentTypeFileSearch      MessageAttachmentToolAssignmentType = "file_search"
)

func PossibleMessageAttachmentToolAssignmentTypeValues added in v0.2.1

func PossibleMessageAttachmentToolAssignmentTypeValues() []MessageAttachmentToolAssignmentType

PossibleMessageAttachmentToolAssignmentTypeValues returns the possible values for the MessageAttachmentToolAssignmentType const type.

type MessageContent

type MessageContent struct {
	// REQUIRED; The object type.
	Type *string
}

MessageContent - An abstract representation of a single item of thread message content.

func (*MessageContent) GetMessageContent

func (m *MessageContent) GetMessageContent() *MessageContent

GetMessageContent implements the MessageContentClassification interface for type MessageContent.

func (MessageContent) MarshalJSON

func (m MessageContent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageContent.

func (*MessageContent) UnmarshalJSON

func (m *MessageContent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageContent.

type MessageContentClassification

type MessageContentClassification interface {
	// GetMessageContent returns the MessageContent content of the underlying type.
	GetMessageContent() *MessageContent
}

MessageContentClassification provides polymorphic access to related types. Call the interface's GetMessageContent() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *MessageContent, *MessageImageFileContent, *MessageTextContent

type MessageDelta added in v0.2.0

type MessageDelta struct {
	// REQUIRED; The content of the message as an array of text and/or images.
	Content []MessageDeltaContentClassification

	// REQUIRED; The entity that produced the message.
	Role *MessageRole
}

MessageDelta - Represents the typed 'delta' payload within a streaming message delta chunk.

func (MessageDelta) MarshalJSON added in v0.2.0

func (m MessageDelta) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDelta.

func (*MessageDelta) UnmarshalJSON added in v0.2.0

func (m *MessageDelta) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDelta.

type MessageDeltaChunk added in v0.2.0

type MessageDeltaChunk struct {
	// REQUIRED; The delta containing the fields that have changed on the Message.
	Delta *MessageDelta

	// REQUIRED; The identifier of the message, which can be referenced in API endpoints.
	ID *string

	// CONSTANT; The object type, which is always thread.message.delta.
	// Field has constant value "thread.message.delta", any specified value is ignored.
	Object *string
}

MessageDeltaChunk - Represents a message delta i.e. any changed fields on a message during streaming.

func (*MessageDeltaChunk) GetStreamEventDataContent added in v0.2.0

func (v *MessageDeltaChunk) GetStreamEventDataContent() *StreamEventData

GetStreamEventDataContent returns the common data of the underlying type.

func (MessageDeltaChunk) MarshalJSON added in v0.2.0

func (m MessageDeltaChunk) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaChunk.

func (*MessageDeltaChunk) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaChunk) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaChunk.

type MessageDeltaContent added in v0.2.0

type MessageDeltaContent struct {
	// REQUIRED; The index of the content part of the message.
	Index *int32

	// REQUIRED; The type of content for this content part.
	Type *string
}

MessageDeltaContent - The abstract base representation of a partial streamed message content payload.

func (*MessageDeltaContent) GetMessageDeltaContent added in v0.2.0

func (m *MessageDeltaContent) GetMessageDeltaContent() *MessageDeltaContent

GetMessageDeltaContent implements the MessageDeltaContentClassification interface for type MessageDeltaContent.

func (MessageDeltaContent) MarshalJSON added in v0.2.0

func (m MessageDeltaContent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaContent.

func (*MessageDeltaContent) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaContent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaContent.

type MessageDeltaContentClassification added in v0.2.0

type MessageDeltaContentClassification interface {
	// GetMessageDeltaContent returns the MessageDeltaContent content of the underlying type.
	GetMessageDeltaContent() *MessageDeltaContent
}

MessageDeltaContentClassification provides polymorphic access to related types. Call the interface's GetMessageDeltaContent() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *MessageDeltaContent, *MessageDeltaImageFileContent, *MessageDeltaTextContentObject

type MessageDeltaImageFileContent added in v0.2.0

type MessageDeltaImageFileContent struct {
	// REQUIRED; The index of the content part of the message.
	Index *int32

	// REQUIRED; The type of content for this content part.
	Type *string

	// The image_file data.
	ImageFile *MessageDeltaImageFileContentObject
}

MessageDeltaImageFileContent - Represents a streamed image file content part within a streaming message delta chunk.

func (*MessageDeltaImageFileContent) GetMessageDeltaContent added in v0.2.0

func (m *MessageDeltaImageFileContent) GetMessageDeltaContent() *MessageDeltaContent

GetMessageDeltaContent implements the MessageDeltaContentClassification interface for type MessageDeltaImageFileContent.

func (MessageDeltaImageFileContent) MarshalJSON added in v0.2.0

func (m MessageDeltaImageFileContent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaImageFileContent.

func (*MessageDeltaImageFileContent) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaImageFileContent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaImageFileContent.

type MessageDeltaImageFileContentObject added in v0.2.0

type MessageDeltaImageFileContentObject struct {
	// The file ID of the image in the message content.
	FileID *string
}

MessageDeltaImageFileContentObject - Represents the 'image_file' payload within streaming image file content.

func (MessageDeltaImageFileContentObject) MarshalJSON added in v0.2.0

func (m MessageDeltaImageFileContentObject) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaImageFileContentObject.

func (*MessageDeltaImageFileContentObject) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaImageFileContentObject) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaImageFileContentObject.

type MessageDeltaTextAnnotation added in v0.2.0

type MessageDeltaTextAnnotation struct {
	// REQUIRED; The index of the annotation within a text content part.
	Index *int32

	// REQUIRED; The type of the text content annotation.
	Type *string
}

MessageDeltaTextAnnotation - The abstract base representation of a streamed text content part's text annotation.

func (*MessageDeltaTextAnnotation) GetMessageDeltaTextAnnotation added in v0.2.0

func (m *MessageDeltaTextAnnotation) GetMessageDeltaTextAnnotation() *MessageDeltaTextAnnotation

GetMessageDeltaTextAnnotation implements the MessageDeltaTextAnnotationClassification interface for type MessageDeltaTextAnnotation.

func (MessageDeltaTextAnnotation) MarshalJSON added in v0.2.0

func (m MessageDeltaTextAnnotation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaTextAnnotation.

func (*MessageDeltaTextAnnotation) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaTextAnnotation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaTextAnnotation.

type MessageDeltaTextAnnotationClassification added in v0.2.0

type MessageDeltaTextAnnotationClassification interface {
	// GetMessageDeltaTextAnnotation returns the MessageDeltaTextAnnotation content of the underlying type.
	GetMessageDeltaTextAnnotation() *MessageDeltaTextAnnotation
}

MessageDeltaTextAnnotationClassification provides polymorphic access to related types. Call the interface's GetMessageDeltaTextAnnotation() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *MessageDeltaTextAnnotation, *MessageDeltaTextFileCitationAnnotationObject, *MessageDeltaTextFilePathAnnotationObject

type MessageDeltaTextContent added in v0.2.0

type MessageDeltaTextContent struct {
	// Annotations for the text.
	Annotations []MessageDeltaTextAnnotationClassification

	// The data that makes up the text.
	Value *string
}

MessageDeltaTextContent - Represents the data of a streamed text content part within a streaming message delta chunk.

func (MessageDeltaTextContent) MarshalJSON added in v0.2.0

func (m MessageDeltaTextContent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaTextContent.

func (*MessageDeltaTextContent) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaTextContent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaTextContent.

type MessageDeltaTextContentObject added in v0.2.0

type MessageDeltaTextContentObject struct {
	// REQUIRED; The index of the content part of the message.
	Index *int32

	// REQUIRED; The type of content for this content part.
	Type *string

	// The text content details.
	Text *MessageDeltaTextContent
}

MessageDeltaTextContentObject - Represents a streamed text content part within a streaming message delta chunk.

func (*MessageDeltaTextContentObject) GetMessageDeltaContent added in v0.2.0

func (m *MessageDeltaTextContentObject) GetMessageDeltaContent() *MessageDeltaContent

GetMessageDeltaContent implements the MessageDeltaContentClassification interface for type MessageDeltaTextContentObject.

func (MessageDeltaTextContentObject) MarshalJSON added in v0.2.0

func (m MessageDeltaTextContentObject) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaTextContentObject.

func (*MessageDeltaTextContentObject) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaTextContentObject) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaTextContentObject.

type MessageDeltaTextFileCitationAnnotation added in v0.2.0

type MessageDeltaTextFileCitationAnnotation struct {
	// The ID of the specific file the citation is from.
	FileID *string

	// The specific quote in the cited file.
	Quote *string
}

MessageDeltaTextFileCitationAnnotation - Represents the data of a streamed file citation as applied to a streaming text content part.

func (MessageDeltaTextFileCitationAnnotation) MarshalJSON added in v0.2.0

func (m MessageDeltaTextFileCitationAnnotation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaTextFileCitationAnnotation.

func (*MessageDeltaTextFileCitationAnnotation) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaTextFileCitationAnnotation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaTextFileCitationAnnotation.

type MessageDeltaTextFileCitationAnnotationObject added in v0.2.0

type MessageDeltaTextFileCitationAnnotationObject struct {
	// REQUIRED; The index of the annotation within a text content part.
	Index *int32

	// REQUIRED; The type of the text content annotation.
	Type *string

	// The end index of this annotation in the content text.
	EndIndex *int32

	// The file citation information.
	FileCitation *MessageDeltaTextFileCitationAnnotation

	// The start index of this annotation in the content text.
	StartIndex *int32

	// The text in the message content that needs to be replaced
	Text *string
}

MessageDeltaTextFileCitationAnnotationObject - Represents a streamed file citation applied to a streaming text content part.

func (*MessageDeltaTextFileCitationAnnotationObject) GetMessageDeltaTextAnnotation added in v0.2.0

GetMessageDeltaTextAnnotation implements the MessageDeltaTextAnnotationClassification interface for type MessageDeltaTextFileCitationAnnotationObject.

func (MessageDeltaTextFileCitationAnnotationObject) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type MessageDeltaTextFileCitationAnnotationObject.

func (*MessageDeltaTextFileCitationAnnotationObject) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaTextFileCitationAnnotationObject) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaTextFileCitationAnnotationObject.

type MessageDeltaTextFilePathAnnotation added in v0.2.0

type MessageDeltaTextFilePathAnnotation struct {
	// The file ID for the annotation.
	FileID *string
}

MessageDeltaTextFilePathAnnotation - Represents the data of a streamed file path annotation as applied to a streaming text content part.

func (MessageDeltaTextFilePathAnnotation) MarshalJSON added in v0.2.0

func (m MessageDeltaTextFilePathAnnotation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageDeltaTextFilePathAnnotation.

func (*MessageDeltaTextFilePathAnnotation) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaTextFilePathAnnotation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaTextFilePathAnnotation.

type MessageDeltaTextFilePathAnnotationObject added in v0.2.0

type MessageDeltaTextFilePathAnnotationObject struct {
	// REQUIRED; The index of the annotation within a text content part.
	Index *int32

	// REQUIRED; The type of the text content annotation.
	Type *string

	// The end index of this annotation in the content text.
	EndIndex *int32

	// The file path information.
	FilePath *MessageDeltaTextFilePathAnnotation

	// The start index of this annotation in the content text.
	StartIndex *int32

	// The text in the message content that needs to be replaced
	Text *string
}

MessageDeltaTextFilePathAnnotationObject - Represents a streamed file path annotation applied to a streaming text content part.

func (*MessageDeltaTextFilePathAnnotationObject) GetMessageDeltaTextAnnotation added in v0.2.0

func (m *MessageDeltaTextFilePathAnnotationObject) GetMessageDeltaTextAnnotation() *MessageDeltaTextAnnotation

GetMessageDeltaTextAnnotation implements the MessageDeltaTextAnnotationClassification interface for type MessageDeltaTextFilePathAnnotationObject.

func (MessageDeltaTextFilePathAnnotationObject) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type MessageDeltaTextFilePathAnnotationObject.

func (*MessageDeltaTextFilePathAnnotationObject) UnmarshalJSON added in v0.2.0

func (m *MessageDeltaTextFilePathAnnotationObject) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageDeltaTextFilePathAnnotationObject.

type MessageImageFileContent

type MessageImageFileContent struct {
	// REQUIRED; The image file for this thread message content item.
	ImageFile *MessageImageFileDetails

	// REQUIRED; The object type.
	Type *string
}

MessageImageFileContent - A representation of image file content in a thread message.

func (*MessageImageFileContent) GetMessageContent

func (m *MessageImageFileContent) GetMessageContent() *MessageContent

GetMessageContent implements the MessageContentClassification interface for type MessageImageFileContent.

func (MessageImageFileContent) MarshalJSON

func (m MessageImageFileContent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageImageFileContent.

func (*MessageImageFileContent) UnmarshalJSON

func (m *MessageImageFileContent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageImageFileContent.

type MessageImageFileDetails

type MessageImageFileDetails struct {
	// REQUIRED; The ID for the file associated with this image.
	FileID *string
}

MessageImageFileDetails - An image reference, as represented in thread message content.

func (MessageImageFileDetails) MarshalJSON

func (m MessageImageFileDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageImageFileDetails.

func (*MessageImageFileDetails) UnmarshalJSON

func (m *MessageImageFileDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageImageFileDetails.

type MessageIncompleteDetails added in v0.2.0

type MessageIncompleteDetails struct {
	// REQUIRED; The provided reason describing why the message was marked as incomplete.
	Reason *MessageIncompleteDetailsReason
}

MessageIncompleteDetails - Information providing additional detail about a message entering an incomplete status.

func (MessageIncompleteDetails) MarshalJSON added in v0.2.0

func (m MessageIncompleteDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageIncompleteDetails.

func (*MessageIncompleteDetails) UnmarshalJSON added in v0.2.0

func (m *MessageIncompleteDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageIncompleteDetails.

type MessageIncompleteDetailsReason added in v0.2.0

type MessageIncompleteDetailsReason string

MessageIncompleteDetailsReason - A set of reasons describing why a message is marked as incomplete.

const (
	// MessageIncompleteDetailsReasonContentFilter - The run generating the message was terminated due to content filter flagging.
	MessageIncompleteDetailsReasonContentFilter MessageIncompleteDetailsReason = "content_filter"
	// MessageIncompleteDetailsReasonMaxTokens - The run generating the message exhausted available tokens before completion.
	MessageIncompleteDetailsReasonMaxTokens MessageIncompleteDetailsReason = "max_tokens"
	// MessageIncompleteDetailsReasonRunCancelled - The run generating the message was cancelled before completion.
	MessageIncompleteDetailsReasonRunCancelled MessageIncompleteDetailsReason = "run_cancelled"
	// MessageIncompleteDetailsReasonRunExpired - The run generating the message expired.
	MessageIncompleteDetailsReasonRunExpired MessageIncompleteDetailsReason = "run_expired"
	// MessageIncompleteDetailsReasonRunFailed - The run generating the message failed.
	MessageIncompleteDetailsReasonRunFailed MessageIncompleteDetailsReason = "run_failed"
)

func PossibleMessageIncompleteDetailsReasonValues added in v0.2.0

func PossibleMessageIncompleteDetailsReasonValues() []MessageIncompleteDetailsReason

PossibleMessageIncompleteDetailsReasonValues returns the possible values for the MessageIncompleteDetailsReason const type.

type MessageRole

type MessageRole string

MessageRole - The possible values for roles attributed to messages in a thread.

const (
	// MessageRoleAssistant - The role representing the assistant.
	MessageRoleAssistant MessageRole = "assistant"
	// MessageRoleUser - The role representing the end-user.
	MessageRoleUser MessageRole = "user"
)

func PossibleMessageRoleValues

func PossibleMessageRoleValues() []MessageRole

PossibleMessageRoleValues returns the possible values for the MessageRole const type.

type MessageStatus added in v0.2.0

type MessageStatus string

MessageStatus - The possible execution status values for a thread message.

const (
	// MessageStatusCompleted - This message was successfully completed by a run.
	MessageStatusCompleted MessageStatus = "completed"
	// MessageStatusInProgress - A run is currently creating this message.
	MessageStatusInProgress MessageStatus = "in_progress"
	// MessageStatusIncomplete - This message is incomplete. See incomplete_details for more information.
	MessageStatusIncomplete MessageStatus = "incomplete"
)

func PossibleMessageStatusValues added in v0.2.0

func PossibleMessageStatusValues() []MessageStatus

PossibleMessageStatusValues returns the possible values for the MessageStatus const type.

type MessageStreamEvent added in v0.2.0

type MessageStreamEvent string

MessageStreamEvent - Message operation related streaming events

const (
	// MessageStreamEventThreadMessageCompleted - Event sent when a message is completed. The data of this event is of type ThreadMessage
	MessageStreamEventThreadMessageCompleted MessageStreamEvent = "thread.message.completed"
	// MessageStreamEventThreadMessageCreated - Event sent when a new message is created. The data of this event is of type ThreadMessage
	MessageStreamEventThreadMessageCreated MessageStreamEvent = "thread.message.created"
	// MessageStreamEventThreadMessageDelta - Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk
	MessageStreamEventThreadMessageDelta MessageStreamEvent = "thread.message.delta"
	// MessageStreamEventThreadMessageInProgress - Event sent when a message moves to `in_progress` status. The data of this event
	// is of type ThreadMessage
	MessageStreamEventThreadMessageInProgress MessageStreamEvent = "thread.message.in_progress"
	// MessageStreamEventThreadMessageIncomplete - Event sent before a message is completed. The data of this event is of type
	// ThreadMessage
	MessageStreamEventThreadMessageIncomplete MessageStreamEvent = "thread.message.incomplete"
)

func PossibleMessageStreamEventValues added in v0.2.0

func PossibleMessageStreamEventValues() []MessageStreamEvent

PossibleMessageStreamEventValues returns the possible values for the MessageStreamEvent const type.

type MessageTextAnnotation

type MessageTextAnnotation struct {
	// REQUIRED; The textual content associated with this text annotation item.
	Text *string

	// REQUIRED; The object type.
	Type *string
}

MessageTextAnnotation - An abstract representation of an annotation to text thread message content.

func (*MessageTextAnnotation) GetMessageTextAnnotation

func (m *MessageTextAnnotation) GetMessageTextAnnotation() *MessageTextAnnotation

GetMessageTextAnnotation implements the MessageTextAnnotationClassification interface for type MessageTextAnnotation.

func (MessageTextAnnotation) MarshalJSON

func (m MessageTextAnnotation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageTextAnnotation.

func (*MessageTextAnnotation) UnmarshalJSON

func (m *MessageTextAnnotation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageTextAnnotation.

type MessageTextAnnotationClassification

type MessageTextAnnotationClassification interface {
	// GetMessageTextAnnotation returns the MessageTextAnnotation content of the underlying type.
	GetMessageTextAnnotation() *MessageTextAnnotation
}

MessageTextAnnotationClassification provides polymorphic access to related types. Call the interface's GetMessageTextAnnotation() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *MessageTextAnnotation, *MessageTextFileCitationAnnotation, *MessageTextFilePathAnnotation

type MessageTextContent

type MessageTextContent struct {
	// REQUIRED; The text and associated annotations for this thread message content item.
	Text *MessageTextDetails

	// REQUIRED; The object type.
	Type *string
}

MessageTextContent - A representation of a textual item of thread message content.

func (*MessageTextContent) GetMessageContent

func (m *MessageTextContent) GetMessageContent() *MessageContent

GetMessageContent implements the MessageContentClassification interface for type MessageTextContent.

func (MessageTextContent) MarshalJSON

func (m MessageTextContent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageTextContent.

func (*MessageTextContent) UnmarshalJSON

func (m *MessageTextContent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageTextContent.

type MessageTextDetails

type MessageTextDetails struct {
	// REQUIRED; A list of annotations associated with this text.
	Annotations []MessageTextAnnotationClassification

	// REQUIRED; The text data.
	Value *string
}

MessageTextDetails - The text and associated annotations for a single item of assistant thread message content.

func (MessageTextDetails) MarshalJSON

func (m MessageTextDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageTextDetails.

func (*MessageTextDetails) UnmarshalJSON

func (m *MessageTextDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageTextDetails.

type MessageTextFileCitationAnnotation

type MessageTextFileCitationAnnotation struct {
	// REQUIRED; A citation within the message that points to a specific quote from a specific file. Generated when the assistant
	// uses the "file_search" tool to search files.
	FileCitation *MessageTextFileCitationDetails

	// REQUIRED; The textual content associated with this text annotation item.
	Text *string

	// REQUIRED; The object type.
	Type *string

	// The last text index associated with this text annotation.
	EndIndex *int32

	// The first text index associated with this text annotation.
	StartIndex *int32
}

MessageTextFileCitationAnnotation - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the 'file_search' tool to search files.

func (*MessageTextFileCitationAnnotation) GetMessageTextAnnotation

func (m *MessageTextFileCitationAnnotation) GetMessageTextAnnotation() *MessageTextAnnotation

GetMessageTextAnnotation implements the MessageTextAnnotationClassification interface for type MessageTextFileCitationAnnotation.

func (MessageTextFileCitationAnnotation) MarshalJSON

func (m MessageTextFileCitationAnnotation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageTextFileCitationAnnotation.

func (*MessageTextFileCitationAnnotation) UnmarshalJSON

func (m *MessageTextFileCitationAnnotation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageTextFileCitationAnnotation.

type MessageTextFileCitationDetails

type MessageTextFileCitationDetails struct {
	// REQUIRED; The ID of the file associated with this citation.
	FileID *string

	// REQUIRED; The specific quote cited in the associated file.
	Quote *string
}

MessageTextFileCitationDetails - A representation of a file-based text citation, as used in a file-based annotation of text thread message content.

func (MessageTextFileCitationDetails) MarshalJSON

func (m MessageTextFileCitationDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageTextFileCitationDetails.

func (*MessageTextFileCitationDetails) UnmarshalJSON

func (m *MessageTextFileCitationDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageTextFileCitationDetails.

type MessageTextFilePathAnnotation

type MessageTextFilePathAnnotation struct {
	// REQUIRED; A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.
	FilePath *MessageTextFilePathDetails

	// REQUIRED; The textual content associated with this text annotation item.
	Text *string

	// REQUIRED; The object type.
	Type *string

	// The last text index associated with this text annotation.
	EndIndex *int32

	// The first text index associated with this text annotation.
	StartIndex *int32
}

MessageTextFilePathAnnotation - A citation within the message that points to a file located at a specific path.

func (*MessageTextFilePathAnnotation) GetMessageTextAnnotation

func (m *MessageTextFilePathAnnotation) GetMessageTextAnnotation() *MessageTextAnnotation

GetMessageTextAnnotation implements the MessageTextAnnotationClassification interface for type MessageTextFilePathAnnotation.

func (MessageTextFilePathAnnotation) MarshalJSON

func (m MessageTextFilePathAnnotation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageTextFilePathAnnotation.

func (*MessageTextFilePathAnnotation) UnmarshalJSON

func (m *MessageTextFilePathAnnotation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageTextFilePathAnnotation.

type MessageTextFilePathDetails

type MessageTextFilePathDetails struct {
	// REQUIRED; The ID of the specific file that the citation is from.
	FileID *string
}

MessageTextFilePathDetails - An encapsulation of an image file ID, as used by message image content.

func (MessageTextFilePathDetails) MarshalJSON

func (m MessageTextFilePathDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MessageTextFilePathDetails.

func (*MessageTextFilePathDetails) UnmarshalJSON

func (m *MessageTextFilePathDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MessageTextFilePathDetails.

type ModifyVectorStoreOptions added in v0.2.0

type ModifyVectorStoreOptions struct {
}

ModifyVectorStoreOptions contains the optional parameters for the Client.ModifyVectorStore method.

type ModifyVectorStoreResponse added in v0.2.0

type ModifyVectorStoreResponse struct {
	// A vector store is a collection of processed files can be used by the `file_search` tool.
	VectorStore
}

ModifyVectorStoreResponse contains the response from method Client.ModifyVectorStore.

type OpenAIFile

type OpenAIFile struct {
	// REQUIRED; The size of the file, in bytes.
	Bytes *int32

	// REQUIRED; The Unix timestamp, in seconds, representing when this object was created.
	CreatedAt *time.Time

	// REQUIRED; The name of the file.
	Filename *string

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; The object type, which is always 'file'.
	Object *string

	// REQUIRED; The intended purpose of a file.
	Purpose *FilePurpose

	// The state of the file. This field is available in Azure OpenAI only.
	Status *FileState

	// The error message with details in case processing of this file failed. This field is available in Azure OpenAI only.
	StatusDetails *string
}

OpenAIFile - Represents an assistant that can call the model and use tools.

func (OpenAIFile) MarshalJSON

func (o OpenAIFile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OpenAIFile.

func (*OpenAIFile) UnmarshalJSON

func (o *OpenAIFile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OpenAIFile.

type RequiredAction

type RequiredAction struct {
	// REQUIRED; The object type.
	Type *string
}

RequiredAction - An abstract representation of a required action for an assistant thread run to continue.

func (*RequiredAction) GetRequiredAction

func (r *RequiredAction) GetRequiredAction() *RequiredAction

GetRequiredAction implements the RequiredActionClassification interface for type RequiredAction.

func (RequiredAction) MarshalJSON

func (r RequiredAction) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RequiredAction.

func (*RequiredAction) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RequiredAction.

type RequiredActionClassification

type RequiredActionClassification interface {
	// GetRequiredAction returns the RequiredAction content of the underlying type.
	GetRequiredAction() *RequiredAction
}

RequiredActionClassification provides polymorphic access to related types. Call the interface's GetRequiredAction() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *RequiredAction, *SubmitToolOutputsAction

type RequiredFunctionToolCall

type RequiredFunctionToolCall struct {
	// REQUIRED; Detailed information about the function to be executed by the tool that includes name and arguments.
	Function *RequiredFunctionToolCallDetails

	// REQUIRED; The ID of the tool call. This ID must be referenced when submitting tool outputs.
	ID *string

	// REQUIRED; The object type for the required tool call.
	Type *string
}

RequiredFunctionToolCall - A representation of a requested call to a function tool, needed by the model to continue evaluation of a run.

func (*RequiredFunctionToolCall) GetRequiredToolCall

func (r *RequiredFunctionToolCall) GetRequiredToolCall() *RequiredToolCall

GetRequiredToolCall implements the RequiredToolCallClassification interface for type RequiredFunctionToolCall.

func (RequiredFunctionToolCall) MarshalJSON

func (r RequiredFunctionToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RequiredFunctionToolCall.

func (*RequiredFunctionToolCall) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RequiredFunctionToolCall.

type RequiredFunctionToolCallDetails

type RequiredFunctionToolCallDetails struct {
	// REQUIRED; The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a
	// JSON document that should be validated and parsed for evaluation.
	Arguments *string

	// REQUIRED; The name of the function.
	Name *string
}

RequiredFunctionToolCallDetails - The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function.

func (RequiredFunctionToolCallDetails) MarshalJSON

func (r RequiredFunctionToolCallDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RequiredFunctionToolCallDetails.

func (*RequiredFunctionToolCallDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RequiredFunctionToolCallDetails.

type RequiredToolCall

type RequiredToolCall struct {
	// REQUIRED; The ID of the tool call. This ID must be referenced when submitting tool outputs.
	ID *string

	// REQUIRED; The object type for the required tool call.
	Type *string
}

RequiredToolCall - An abstract representation a a tool invocation needed by the model to continue a run.

func (*RequiredToolCall) GetRequiredToolCall

func (r *RequiredToolCall) GetRequiredToolCall() *RequiredToolCall

GetRequiredToolCall implements the RequiredToolCallClassification interface for type RequiredToolCall.

func (RequiredToolCall) MarshalJSON

func (r RequiredToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RequiredToolCall.

func (*RequiredToolCall) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RequiredToolCall.

type RequiredToolCallClassification

type RequiredToolCallClassification interface {
	// GetRequiredToolCall returns the RequiredToolCall content of the underlying type.
	GetRequiredToolCall() *RequiredToolCall
}

RequiredToolCallClassification provides polymorphic access to related types. Call the interface's GetRequiredToolCall() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *RequiredFunctionToolCall, *RequiredToolCall

type RunCompletionUsage added in v0.2.0

type RunCompletionUsage struct {
	// REQUIRED; Number of completion tokens used over the course of the run.
	CompletionTokens *int64

	// REQUIRED; Number of prompt tokens used over the course of the run.
	PromptTokens *int64

	// REQUIRED; Total number of tokens used (prompt + completion).
	TotalTokens *int64
}

RunCompletionUsage - Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.).

func (RunCompletionUsage) MarshalJSON added in v0.2.0

func (r RunCompletionUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunCompletionUsage.

func (*RunCompletionUsage) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunCompletionUsage.

type RunError

type RunError struct {
	// REQUIRED; The status for the error.
	Code *string

	// REQUIRED; The human-readable text associated with the error.
	Message *string
}

RunError - The details of an error as encountered by an assistant thread run.

func (RunError) MarshalJSON

func (r RunError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunError.

func (*RunError) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunError.

type RunStatus

type RunStatus string

RunStatus - Possible values for the status of an assistant thread run.

const (
	// RunStatusCancelled - Represents a run that has been cancelled.
	RunStatusCancelled RunStatus = "cancelled"
	// RunStatusCancelling - Represents a run that is in the process of cancellation.
	RunStatusCancelling RunStatus = "cancelling"
	// RunStatusCompleted - Represents a run that successfully completed.
	RunStatusCompleted RunStatus = "completed"
	// RunStatusExpired - Represents a run that expired before it could otherwise finish.
	RunStatusExpired RunStatus = "expired"
	// RunStatusFailed - Represents a run that failed.
	RunStatusFailed RunStatus = "failed"
	// RunStatusInProgress - Represents a run that is in progress.
	RunStatusInProgress RunStatus = "in_progress"
	// RunStatusQueued - Represents a run that is queued to start.
	RunStatusQueued RunStatus = "queued"
	// RunStatusRequiresAction - Represents a run that needs another operation, such as tool output submission, to continue.
	RunStatusRequiresAction RunStatus = "requires_action"
)

func PossibleRunStatusValues

func PossibleRunStatusValues() []RunStatus

PossibleRunStatusValues returns the possible values for the RunStatus const type.

type RunStep

type RunStep struct {
	// REQUIRED; The ID of the assistant associated with the run step.
	AssistantID *string

	// REQUIRED; The Unix timestamp, in seconds, representing when this was cancelled.
	CancelledAt *time.Time

	// REQUIRED; The Unix timestamp, in seconds, representing when this completed.
	CompletedAt *time.Time

	// REQUIRED; The Unix timestamp, in seconds, representing when this object was created.
	CreatedAt *time.Time

	// REQUIRED; The Unix timestamp, in seconds, representing when this item expired.
	ExpiredAt *time.Time

	// REQUIRED; The Unix timestamp, in seconds, representing when this failed.
	FailedAt *time.Time

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; If applicable, information about the last error encountered by this run step.
	LastError *RunStepLastError

	// REQUIRED; A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information
	// about that object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// REQUIRED; The object type, which is always 'thread.run.step'.
	Object *string

	// REQUIRED; The ID of the run that this run step is a part of.
	RunID *string

	// REQUIRED; The status of this run step.
	Status *RunStepStatus

	// REQUIRED; The details for this run step.
	StepDetails RunStepDetailsClassification

	// REQUIRED; The ID of the thread that was run.
	ThreadID *string

	// REQUIRED; The type of run step, which can be either messagecreation or toolcalls.
	Type *RunStepType

	// Usage statistics related to the run step. This value will be null while the run step's status is in_progress.
	Usage *RunStepUsage
}

RunStep - Detailed information about a single step of an assistant thread run.

func (*RunStep) GetStreamEventDataContent added in v0.2.0

func (v *RunStep) GetStreamEventDataContent() *StreamEventData

GetStreamEventDataContent returns the common data of the underlying type.

func (RunStep) MarshalJSON

func (r RunStep) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStep.

func (*RunStep) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStep.

type RunStepCodeInterpreterImageOutput

type RunStepCodeInterpreterImageOutput struct {
	// REQUIRED; Referential information for the image associated with this output.
	Image *RunStepCodeInterpreterImageReference

	// REQUIRED; The object type.
	Type *string
}

RunStepCodeInterpreterImageOutput - A representation of an image output emitted by a code interpreter tool in response to a tool call by the model.

func (*RunStepCodeInterpreterImageOutput) GetRunStepCodeInterpreterToolCallOutput

func (r *RunStepCodeInterpreterImageOutput) GetRunStepCodeInterpreterToolCallOutput() *RunStepCodeInterpreterToolCallOutput

GetRunStepCodeInterpreterToolCallOutput implements the RunStepCodeInterpreterToolCallOutputClassification interface for type RunStepCodeInterpreterImageOutput.

func (RunStepCodeInterpreterImageOutput) MarshalJSON

func (r RunStepCodeInterpreterImageOutput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepCodeInterpreterImageOutput.

func (*RunStepCodeInterpreterImageOutput) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepCodeInterpreterImageOutput.

type RunStepCodeInterpreterImageReference

type RunStepCodeInterpreterImageReference struct {
	// REQUIRED; The ID of the file associated with this image.
	FileID *string
}

RunStepCodeInterpreterImageReference - An image reference emitted by a code interpreter tool in response to a tool call by the model.

func (RunStepCodeInterpreterImageReference) MarshalJSON

func (r RunStepCodeInterpreterImageReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepCodeInterpreterImageReference.

func (*RunStepCodeInterpreterImageReference) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepCodeInterpreterImageReference.

type RunStepCodeInterpreterLogOutput

type RunStepCodeInterpreterLogOutput struct {
	// REQUIRED; The serialized log output emitted by the code interpreter.
	Logs *string

	// REQUIRED; The object type.
	Type *string
}

RunStepCodeInterpreterLogOutput - A representation of a log output emitted by a code interpreter tool in response to a tool call by the model.

func (*RunStepCodeInterpreterLogOutput) GetRunStepCodeInterpreterToolCallOutput

func (r *RunStepCodeInterpreterLogOutput) GetRunStepCodeInterpreterToolCallOutput() *RunStepCodeInterpreterToolCallOutput

GetRunStepCodeInterpreterToolCallOutput implements the RunStepCodeInterpreterToolCallOutputClassification interface for type RunStepCodeInterpreterLogOutput.

func (RunStepCodeInterpreterLogOutput) MarshalJSON

func (r RunStepCodeInterpreterLogOutput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepCodeInterpreterLogOutput.

func (*RunStepCodeInterpreterLogOutput) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepCodeInterpreterLogOutput.

type RunStepCodeInterpreterToolCall

type RunStepCodeInterpreterToolCall struct {
	// REQUIRED; The details of the tool call to the code interpreter tool.
	CodeInterpreter *RunStepCodeInterpreterToolCallDetails

	// REQUIRED; The ID of the tool call. This ID must be referenced when you submit tool outputs.
	ID *string

	// REQUIRED; The object type.
	Type *string
}

RunStepCodeInterpreterToolCall - A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that represents inputs and outputs consumed and emitted by the code interpreter.

func (*RunStepCodeInterpreterToolCall) GetRunStepToolCall

func (r *RunStepCodeInterpreterToolCall) GetRunStepToolCall() *RunStepToolCall

GetRunStepToolCall implements the RunStepToolCallClassification interface for type RunStepCodeInterpreterToolCall.

func (RunStepCodeInterpreterToolCall) MarshalJSON

func (r RunStepCodeInterpreterToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepCodeInterpreterToolCall.

func (*RunStepCodeInterpreterToolCall) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepCodeInterpreterToolCall.

type RunStepCodeInterpreterToolCallDetails

type RunStepCodeInterpreterToolCallDetails struct {
	// REQUIRED; The input provided by the model to the code interpreter tool.
	Input *string

	// REQUIRED; The outputs produced by the code interpreter tool back to the model in response to the tool call.
	Outputs []RunStepCodeInterpreterToolCallOutputClassification
}

RunStepCodeInterpreterToolCallDetails - The detailed information about a code interpreter invocation by the model.

func (RunStepCodeInterpreterToolCallDetails) MarshalJSON

func (r RunStepCodeInterpreterToolCallDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepCodeInterpreterToolCallDetails.

func (*RunStepCodeInterpreterToolCallDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepCodeInterpreterToolCallDetails.

type RunStepCodeInterpreterToolCallOutput

type RunStepCodeInterpreterToolCallOutput struct {
	// REQUIRED; The object type.
	Type *string
}

RunStepCodeInterpreterToolCallOutput - An abstract representation of an emitted output from a code interpreter tool.

func (*RunStepCodeInterpreterToolCallOutput) GetRunStepCodeInterpreterToolCallOutput

func (r *RunStepCodeInterpreterToolCallOutput) GetRunStepCodeInterpreterToolCallOutput() *RunStepCodeInterpreterToolCallOutput

GetRunStepCodeInterpreterToolCallOutput implements the RunStepCodeInterpreterToolCallOutputClassification interface for type RunStepCodeInterpreterToolCallOutput.

func (RunStepCodeInterpreterToolCallOutput) MarshalJSON

func (r RunStepCodeInterpreterToolCallOutput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepCodeInterpreterToolCallOutput.

func (*RunStepCodeInterpreterToolCallOutput) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepCodeInterpreterToolCallOutput.

type RunStepCodeInterpreterToolCallOutputClassification

type RunStepCodeInterpreterToolCallOutputClassification interface {
	// GetRunStepCodeInterpreterToolCallOutput returns the RunStepCodeInterpreterToolCallOutput content of the underlying type.
	GetRunStepCodeInterpreterToolCallOutput() *RunStepCodeInterpreterToolCallOutput
}

RunStepCodeInterpreterToolCallOutputClassification provides polymorphic access to related types. Call the interface's GetRunStepCodeInterpreterToolCallOutput() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *RunStepCodeInterpreterImageOutput, *RunStepCodeInterpreterLogOutput, *RunStepCodeInterpreterToolCallOutput

type RunStepCompletionUsage added in v0.2.0

type RunStepCompletionUsage struct {
	// REQUIRED; Number of completion tokens used over the course of the run step.
	CompletionTokens *int64

	// REQUIRED; Number of prompt tokens used over the course of the run step.
	PromptTokens *int64

	// REQUIRED; Total number of tokens used (prompt + completion).
	TotalTokens *int64
}

RunStepCompletionUsage - Usage statistics related to the run step.

func (RunStepCompletionUsage) MarshalJSON added in v0.2.0

func (r RunStepCompletionUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepCompletionUsage.

func (*RunStepCompletionUsage) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepCompletionUsage.

type RunStepDelta added in v0.2.0

type RunStepDelta struct {
	// The details of the run step.
	StepDetails RunStepDeltaDetailClassification
}

RunStepDelta - Represents the delta payload in a streaming run step delta chunk.

func (RunStepDelta) MarshalJSON added in v0.2.0

func (r RunStepDelta) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDelta.

func (*RunStepDelta) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDelta.

type RunStepDeltaChunk added in v0.2.0

type RunStepDeltaChunk struct {
	// REQUIRED; The delta containing the fields that have changed on the run step.
	Delta *RunStepDelta

	// REQUIRED; The identifier of the run step, which can be referenced in API endpoints.
	ID *string

	// CONSTANT; The object type, which is always thread.run.step.delta.
	// Field has constant value "thread.run.step.delta", any specified value is ignored.
	Object *string
}

RunStepDeltaChunk - Represents a run step delta i.e. any changed fields on a run step during streaming.

func (*RunStepDeltaChunk) GetStreamEventDataContent added in v0.2.0

func (v *RunStepDeltaChunk) GetStreamEventDataContent() *StreamEventData

GetStreamEventDataContent returns the common data of the underlying type.

func (RunStepDeltaChunk) MarshalJSON added in v0.2.0

func (r RunStepDeltaChunk) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaChunk.

func (*RunStepDeltaChunk) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaChunk.

type RunStepDeltaCodeInterpreterDetailItemObject added in v0.2.0

type RunStepDeltaCodeInterpreterDetailItemObject struct {
	// The input into the Code Interpreter tool call.
	Input *string

	// The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (logs) or
	// images (image). Each of these are represented by a different object type.
	Outputs []RunStepDeltaCodeInterpreterOutputClassification
}

RunStepDeltaCodeInterpreterDetailItemObject - Represents the Code Interpreter tool call data in a streaming run step's tool calls.

func (RunStepDeltaCodeInterpreterDetailItemObject) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaCodeInterpreterDetailItemObject.

func (*RunStepDeltaCodeInterpreterDetailItemObject) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaCodeInterpreterDetailItemObject.

type RunStepDeltaCodeInterpreterImageOutput added in v0.2.0

type RunStepDeltaCodeInterpreterImageOutput struct {
	// REQUIRED; The index of the output in the streaming run step tool call's Code Interpreter outputs array.
	Index *int32

	// REQUIRED; The type of the streaming run step tool call's Code Interpreter output.
	Type *string

	// The image data for the Code Interpreter tool call output.
	Image *RunStepDeltaCodeInterpreterImageOutputObject
}

RunStepDeltaCodeInterpreterImageOutput - Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection.

func (*RunStepDeltaCodeInterpreterImageOutput) GetRunStepDeltaCodeInterpreterOutput added in v0.2.0

func (r *RunStepDeltaCodeInterpreterImageOutput) GetRunStepDeltaCodeInterpreterOutput() *RunStepDeltaCodeInterpreterOutput

GetRunStepDeltaCodeInterpreterOutput implements the RunStepDeltaCodeInterpreterOutputClassification interface for type RunStepDeltaCodeInterpreterImageOutput.

func (RunStepDeltaCodeInterpreterImageOutput) MarshalJSON added in v0.2.0

func (r RunStepDeltaCodeInterpreterImageOutput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaCodeInterpreterImageOutput.

func (*RunStepDeltaCodeInterpreterImageOutput) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaCodeInterpreterImageOutput.

type RunStepDeltaCodeInterpreterImageOutputObject added in v0.2.0

type RunStepDeltaCodeInterpreterImageOutputObject struct {
	// The file ID for the image.
	FileID *string
}

RunStepDeltaCodeInterpreterImageOutputObject - Represents the data for a streaming run step's Code Interpreter tool call image output.

func (RunStepDeltaCodeInterpreterImageOutputObject) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaCodeInterpreterImageOutputObject.

func (*RunStepDeltaCodeInterpreterImageOutputObject) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaCodeInterpreterImageOutputObject.

type RunStepDeltaCodeInterpreterLogOutput added in v0.2.0

type RunStepDeltaCodeInterpreterLogOutput struct {
	// REQUIRED; The index of the output in the streaming run step tool call's Code Interpreter outputs array.
	Index *int32

	// REQUIRED; The type of the streaming run step tool call's Code Interpreter output.
	Type *string

	// The text output from the Code Interpreter tool call.
	Logs *string
}

RunStepDeltaCodeInterpreterLogOutput - Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection.

func (*RunStepDeltaCodeInterpreterLogOutput) GetRunStepDeltaCodeInterpreterOutput added in v0.2.0

func (r *RunStepDeltaCodeInterpreterLogOutput) GetRunStepDeltaCodeInterpreterOutput() *RunStepDeltaCodeInterpreterOutput

GetRunStepDeltaCodeInterpreterOutput implements the RunStepDeltaCodeInterpreterOutputClassification interface for type RunStepDeltaCodeInterpreterLogOutput.

func (RunStepDeltaCodeInterpreterLogOutput) MarshalJSON added in v0.2.0

func (r RunStepDeltaCodeInterpreterLogOutput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaCodeInterpreterLogOutput.

func (*RunStepDeltaCodeInterpreterLogOutput) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaCodeInterpreterLogOutput.

type RunStepDeltaCodeInterpreterOutput added in v0.2.0

type RunStepDeltaCodeInterpreterOutput struct {
	// REQUIRED; The index of the output in the streaming run step tool call's Code Interpreter outputs array.
	Index *int32

	// REQUIRED; The type of the streaming run step tool call's Code Interpreter output.
	Type *string
}

RunStepDeltaCodeInterpreterOutput - The abstract base representation of a streaming run step tool call's Code Interpreter tool output.

func (*RunStepDeltaCodeInterpreterOutput) GetRunStepDeltaCodeInterpreterOutput added in v0.2.0

func (r *RunStepDeltaCodeInterpreterOutput) GetRunStepDeltaCodeInterpreterOutput() *RunStepDeltaCodeInterpreterOutput

GetRunStepDeltaCodeInterpreterOutput implements the RunStepDeltaCodeInterpreterOutputClassification interface for type RunStepDeltaCodeInterpreterOutput.

func (RunStepDeltaCodeInterpreterOutput) MarshalJSON added in v0.2.0

func (r RunStepDeltaCodeInterpreterOutput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaCodeInterpreterOutput.

func (*RunStepDeltaCodeInterpreterOutput) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaCodeInterpreterOutput.

type RunStepDeltaCodeInterpreterOutputClassification added in v0.2.0

type RunStepDeltaCodeInterpreterOutputClassification interface {
	// GetRunStepDeltaCodeInterpreterOutput returns the RunStepDeltaCodeInterpreterOutput content of the underlying type.
	GetRunStepDeltaCodeInterpreterOutput() *RunStepDeltaCodeInterpreterOutput
}

RunStepDeltaCodeInterpreterOutputClassification provides polymorphic access to related types. Call the interface's GetRunStepDeltaCodeInterpreterOutput() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *RunStepDeltaCodeInterpreterImageOutput, *RunStepDeltaCodeInterpreterLogOutput, *RunStepDeltaCodeInterpreterOutput

type RunStepDeltaCodeInterpreterToolCall added in v0.2.0

type RunStepDeltaCodeInterpreterToolCall struct {
	// REQUIRED; The ID of the tool call, used when submitting outputs to the run.
	ID *string

	// REQUIRED; The index of the tool call detail in the run step's tool_calls array.
	Index *int32

	// REQUIRED; The type of the tool call detail item in a streaming run step's details.
	Type *string

	// The Code Interpreter data for the tool call.
	CodeInterpreter *RunStepDeltaCodeInterpreterDetailItemObject
}

RunStepDeltaCodeInterpreterToolCall - Represents a Code Interpreter tool call within a streaming run step's tool call details.

func (*RunStepDeltaCodeInterpreterToolCall) GetRunStepDeltaToolCall added in v0.2.0

func (r *RunStepDeltaCodeInterpreterToolCall) GetRunStepDeltaToolCall() *RunStepDeltaToolCall

GetRunStepDeltaToolCall implements the RunStepDeltaToolCallClassification interface for type RunStepDeltaCodeInterpreterToolCall.

func (RunStepDeltaCodeInterpreterToolCall) MarshalJSON added in v0.2.0

func (r RunStepDeltaCodeInterpreterToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaCodeInterpreterToolCall.

func (*RunStepDeltaCodeInterpreterToolCall) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaCodeInterpreterToolCall.

type RunStepDeltaDetail added in v0.2.0

type RunStepDeltaDetail struct {
	// REQUIRED; The object type for the run step detail object.
	Type *string
}

RunStepDeltaDetail - Represents a single run step detail item in a streaming run step's delta payload.

func (*RunStepDeltaDetail) GetRunStepDeltaDetail added in v0.2.0

func (r *RunStepDeltaDetail) GetRunStepDeltaDetail() *RunStepDeltaDetail

GetRunStepDeltaDetail implements the RunStepDeltaDetailClassification interface for type RunStepDeltaDetail.

func (RunStepDeltaDetail) MarshalJSON added in v0.2.0

func (r RunStepDeltaDetail) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaDetail.

func (*RunStepDeltaDetail) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaDetail.

type RunStepDeltaDetailClassification added in v0.2.0

type RunStepDeltaDetailClassification interface {
	// GetRunStepDeltaDetail returns the RunStepDeltaDetail content of the underlying type.
	GetRunStepDeltaDetail() *RunStepDeltaDetail
}

RunStepDeltaDetailClassification provides polymorphic access to related types. Call the interface's GetRunStepDeltaDetail() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *RunStepDeltaDetail, *RunStepDeltaMessageCreation, *RunStepDeltaToolCallObject

type RunStepDeltaFileSearchToolCall added in v0.2.0

type RunStepDeltaFileSearchToolCall struct {
	// REQUIRED; The ID of the tool call, used when submitting outputs to the run.
	ID *string

	// REQUIRED; The index of the tool call detail in the run step's tool_calls array.
	Index *int32

	// REQUIRED; The type of the tool call detail item in a streaming run step's details.
	Type *string

	// Reserved for future use.
	FileSearch map[string]*string
}

RunStepDeltaFileSearchToolCall - Represents a file search tool call within a streaming run step's tool call details.

func (*RunStepDeltaFileSearchToolCall) GetRunStepDeltaToolCall added in v0.2.0

func (r *RunStepDeltaFileSearchToolCall) GetRunStepDeltaToolCall() *RunStepDeltaToolCall

GetRunStepDeltaToolCall implements the RunStepDeltaToolCallClassification interface for type RunStepDeltaFileSearchToolCall.

func (RunStepDeltaFileSearchToolCall) MarshalJSON added in v0.2.0

func (r RunStepDeltaFileSearchToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaFileSearchToolCall.

func (*RunStepDeltaFileSearchToolCall) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaFileSearchToolCall.

type RunStepDeltaFunction added in v0.2.0

type RunStepDeltaFunction struct {
	// The arguments passed to the function as input.
	Arguments *string

	// The name of the function.
	Name *string

	// The output of the function, null if outputs have not yet been submitted.
	Output *string
}

RunStepDeltaFunction - Represents the function data in a streaming run step delta's function tool call.

func (RunStepDeltaFunction) MarshalJSON added in v0.2.0

func (r RunStepDeltaFunction) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaFunction.

func (*RunStepDeltaFunction) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaFunction.

type RunStepDeltaFunctionToolCall added in v0.2.0

type RunStepDeltaFunctionToolCall struct {
	// REQUIRED; The ID of the tool call, used when submitting outputs to the run.
	ID *string

	// REQUIRED; The index of the tool call detail in the run step's tool_calls array.
	Index *int32

	// REQUIRED; The type of the tool call detail item in a streaming run step's details.
	Type *string

	// The function data for the tool call.
	Function *RunStepDeltaFunction
}

RunStepDeltaFunctionToolCall - Represents a function tool call within a streaming run step's tool call details.

func (*RunStepDeltaFunctionToolCall) GetRunStepDeltaToolCall added in v0.2.0

func (r *RunStepDeltaFunctionToolCall) GetRunStepDeltaToolCall() *RunStepDeltaToolCall

GetRunStepDeltaToolCall implements the RunStepDeltaToolCallClassification interface for type RunStepDeltaFunctionToolCall.

func (RunStepDeltaFunctionToolCall) MarshalJSON added in v0.2.0

func (r RunStepDeltaFunctionToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaFunctionToolCall.

func (*RunStepDeltaFunctionToolCall) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaFunctionToolCall.

type RunStepDeltaMessageCreation added in v0.2.0

type RunStepDeltaMessageCreation struct {
	// REQUIRED; The object type for the run step detail object.
	Type *string

	// The message creation data.
	MessageCreation *RunStepDeltaMessageCreationObject
}

RunStepDeltaMessageCreation - Represents a message creation within a streaming run step delta.

func (*RunStepDeltaMessageCreation) GetRunStepDeltaDetail added in v0.2.0

func (r *RunStepDeltaMessageCreation) GetRunStepDeltaDetail() *RunStepDeltaDetail

GetRunStepDeltaDetail implements the RunStepDeltaDetailClassification interface for type RunStepDeltaMessageCreation.

func (RunStepDeltaMessageCreation) MarshalJSON added in v0.2.0

func (r RunStepDeltaMessageCreation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaMessageCreation.

func (*RunStepDeltaMessageCreation) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaMessageCreation.

type RunStepDeltaMessageCreationObject added in v0.2.0

type RunStepDeltaMessageCreationObject struct {
	// The ID of the newly-created message.
	MessageID *string
}

RunStepDeltaMessageCreationObject - Represents the data within a streaming run step message creation response object.

func (RunStepDeltaMessageCreationObject) MarshalJSON added in v0.2.0

func (r RunStepDeltaMessageCreationObject) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaMessageCreationObject.

func (*RunStepDeltaMessageCreationObject) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaMessageCreationObject.

type RunStepDeltaToolCall added in v0.2.0

type RunStepDeltaToolCall struct {
	// REQUIRED; The ID of the tool call, used when submitting outputs to the run.
	ID *string

	// REQUIRED; The index of the tool call detail in the run step's tool_calls array.
	Index *int32

	// REQUIRED; The type of the tool call detail item in a streaming run step's details.
	Type *string
}

RunStepDeltaToolCall - The abstract base representation of a single tool call within a streaming run step's delta tool call details.

func (*RunStepDeltaToolCall) GetRunStepDeltaToolCall added in v0.2.0

func (r *RunStepDeltaToolCall) GetRunStepDeltaToolCall() *RunStepDeltaToolCall

GetRunStepDeltaToolCall implements the RunStepDeltaToolCallClassification interface for type RunStepDeltaToolCall.

func (RunStepDeltaToolCall) MarshalJSON added in v0.2.0

func (r RunStepDeltaToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaToolCall.

func (*RunStepDeltaToolCall) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaToolCall.

type RunStepDeltaToolCallClassification added in v0.2.0

type RunStepDeltaToolCallClassification interface {
	// GetRunStepDeltaToolCall returns the RunStepDeltaToolCall content of the underlying type.
	GetRunStepDeltaToolCall() *RunStepDeltaToolCall
}

RunStepDeltaToolCallClassification provides polymorphic access to related types. Call the interface's GetRunStepDeltaToolCall() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *RunStepDeltaCodeInterpreterToolCall, *RunStepDeltaFileSearchToolCall, *RunStepDeltaFunctionToolCall, *RunStepDeltaToolCall

type RunStepDeltaToolCallObject added in v0.2.0

type RunStepDeltaToolCallObject struct {
	// REQUIRED; The object type for the run step detail object.
	Type *string

	// The collection of tool calls for the tool call detail item.
	ToolCalls []RunStepDeltaToolCallClassification
}

RunStepDeltaToolCallObject - Represents an invocation of tool calls as part of a streaming run step.

func (*RunStepDeltaToolCallObject) GetRunStepDeltaDetail added in v0.2.0

func (r *RunStepDeltaToolCallObject) GetRunStepDeltaDetail() *RunStepDeltaDetail

GetRunStepDeltaDetail implements the RunStepDeltaDetailClassification interface for type RunStepDeltaToolCallObject.

func (RunStepDeltaToolCallObject) MarshalJSON added in v0.2.0

func (r RunStepDeltaToolCallObject) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDeltaToolCallObject.

func (*RunStepDeltaToolCallObject) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDeltaToolCallObject.

type RunStepDetails

type RunStepDetails struct {
	// REQUIRED; The object type.
	Type *RunStepType
}

RunStepDetails - An abstract representation of the details for a run step.

func (*RunStepDetails) GetRunStepDetails

func (r *RunStepDetails) GetRunStepDetails() *RunStepDetails

GetRunStepDetails implements the RunStepDetailsClassification interface for type RunStepDetails.

func (RunStepDetails) MarshalJSON

func (r RunStepDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepDetails.

func (*RunStepDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepDetails.

type RunStepDetailsClassification

type RunStepDetailsClassification interface {
	// GetRunStepDetails returns the RunStepDetails content of the underlying type.
	GetRunStepDetails() *RunStepDetails
}

RunStepDetailsClassification provides polymorphic access to related types. Call the interface's GetRunStepDetails() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *RunStepDetails, *RunStepMessageCreationDetails, *RunStepToolCallDetails

type RunStepError

type RunStepError struct {
	// REQUIRED; The error code for this error.
	Code *RunStepErrorCode

	// REQUIRED; The human-readable text associated with this error.
	Message *string
}

RunStepError - The error information associated with a failed run step.

func (RunStepError) MarshalJSON

func (r RunStepError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepError.

func (*RunStepError) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepError.

type RunStepErrorCode

type RunStepErrorCode string

RunStepErrorCode - Possible error code values attributable to a failed run step.

const (
	// RunStepErrorCodeRateLimitExceeded - Represents an error indicating configured rate limits were exceeded.
	RunStepErrorCodeRateLimitExceeded RunStepErrorCode = "rate_limit_exceeded"
	// RunStepErrorCodeServerError - Represents a server error.
	RunStepErrorCodeServerError RunStepErrorCode = "server_error"
)

func PossibleRunStepErrorCodeValues

func PossibleRunStepErrorCodeValues() []RunStepErrorCode

PossibleRunStepErrorCodeValues returns the possible values for the RunStepErrorCode const type.

type RunStepFileSearchToolCall added in v0.2.0

type RunStepFileSearchToolCall struct {
	// REQUIRED; Reserved for future use.
	FileSearch map[string]*string

	// REQUIRED; The ID of the tool call. This ID must be referenced when you submit tool outputs.
	ID *string

	// REQUIRED; The object type.
	Type *string
}

RunStepFileSearchToolCall - A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents executed file search.

func (*RunStepFileSearchToolCall) GetRunStepToolCall added in v0.2.0

func (r *RunStepFileSearchToolCall) GetRunStepToolCall() *RunStepToolCall

GetRunStepToolCall implements the RunStepToolCallClassification interface for type RunStepFileSearchToolCall.

func (RunStepFileSearchToolCall) MarshalJSON added in v0.2.0

func (r RunStepFileSearchToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepFileSearchToolCall.

func (*RunStepFileSearchToolCall) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepFileSearchToolCall.

type RunStepFunctionToolCall

type RunStepFunctionToolCall struct {
	// REQUIRED; The detailed information about the function called by the model.
	Function *RunStepFunctionToolCallDetails

	// REQUIRED; The ID of the tool call. This ID must be referenced when you submit tool outputs.
	ID *string

	// REQUIRED; The object type.
	Type *string
}

RunStepFunctionToolCall - A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs and output consumed and emitted by the specified function.

func (*RunStepFunctionToolCall) GetRunStepToolCall

func (r *RunStepFunctionToolCall) GetRunStepToolCall() *RunStepToolCall

GetRunStepToolCall implements the RunStepToolCallClassification interface for type RunStepFunctionToolCall.

func (RunStepFunctionToolCall) MarshalJSON

func (r RunStepFunctionToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepFunctionToolCall.

func (*RunStepFunctionToolCall) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepFunctionToolCall.

type RunStepFunctionToolCallDetails

type RunStepFunctionToolCallDetails struct {
	// REQUIRED; The arguments that the model requires are provided to the named function.
	Arguments *string

	// REQUIRED; The name of the function.
	Name *string

	// REQUIRED; The output of the function, only populated for function calls that have already have had their outputs submitted.
	Output *string
}

RunStepFunctionToolCallDetails - The detailed information about the function called by the model.

func (RunStepFunctionToolCallDetails) MarshalJSON

func (r RunStepFunctionToolCallDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepFunctionToolCallDetails.

func (*RunStepFunctionToolCallDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepFunctionToolCallDetails.

type RunStepLastError

type RunStepLastError struct {
	// REQUIRED; The error code for this error.
	Code *RunStepErrorCode

	// REQUIRED; The human-readable text associated with this error.
	Message *string
}

RunStepLastError - If applicable, information about the last error encountered by this run step.

func (RunStepLastError) MarshalJSON

func (r RunStepLastError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepLastError.

func (*RunStepLastError) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepLastError.

type RunStepMessageCreationDetails

type RunStepMessageCreationDetails struct {
	// REQUIRED; Information about the message creation associated with this run step.
	MessageCreation *RunStepMessageCreationReference

	// REQUIRED; The object type.
	Type *RunStepType
}

RunStepMessageCreationDetails - The detailed information associated with a message creation run step.

func (*RunStepMessageCreationDetails) GetRunStepDetails

func (r *RunStepMessageCreationDetails) GetRunStepDetails() *RunStepDetails

GetRunStepDetails implements the RunStepDetailsClassification interface for type RunStepMessageCreationDetails.

func (RunStepMessageCreationDetails) MarshalJSON

func (r RunStepMessageCreationDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepMessageCreationDetails.

func (*RunStepMessageCreationDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepMessageCreationDetails.

type RunStepMessageCreationReference

type RunStepMessageCreationReference struct {
	// REQUIRED; The ID of the message created by this run step.
	MessageID *string
}

RunStepMessageCreationReference - The details of a message created as a part of a run step.

func (RunStepMessageCreationReference) MarshalJSON

func (r RunStepMessageCreationReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepMessageCreationReference.

func (*RunStepMessageCreationReference) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepMessageCreationReference.

type RunStepStatus

type RunStepStatus string

RunStepStatus - Possible values for the status of a run step.

const (
	// RunStepStatusCancelled - Represents a run step that was cancelled.
	RunStepStatusCancelled RunStepStatus = "cancelled"
	// RunStepStatusCompleted - Represents a run step that successfully completed.
	RunStepStatusCompleted RunStepStatus = "completed"
	// RunStepStatusExpired - Represents a run step that expired before otherwise finishing.
	RunStepStatusExpired RunStepStatus = "expired"
	// RunStepStatusFailed - Represents a run step that failed.
	RunStepStatusFailed RunStepStatus = "failed"
	// RunStepStatusInProgress - Represents a run step still in progress.
	RunStepStatusInProgress RunStepStatus = "in_progress"
)

func PossibleRunStepStatusValues

func PossibleRunStepStatusValues() []RunStepStatus

PossibleRunStepStatusValues returns the possible values for the RunStepStatus const type.

type RunStepStreamEvent added in v0.2.0

type RunStepStreamEvent string

RunStepStreamEvent - Run step operation related streaming events

const (
	// RunStepStreamEventThreadRunStepCancelled - Event sent when a run step is cancelled. The data of this event is of type RunStep
	RunStepStreamEventThreadRunStepCancelled RunStepStreamEvent = "thread.run.step.cancelled"
	// RunStepStreamEventThreadRunStepCompleted - Event sent when a run step is completed. The data of this event is of type RunStep
	RunStepStreamEventThreadRunStepCompleted RunStepStreamEvent = "thread.run.step.completed"
	// RunStepStreamEventThreadRunStepCreated - Event sent when a new thread run step is created. The data of this event is of
	// type RunStep
	RunStepStreamEventThreadRunStepCreated RunStepStreamEvent = "thread.run.step.created"
	// RunStepStreamEventThreadRunStepDelta - Event sent when a run stepis being streamed. The data of this event is of type RunStepDeltaChunk
	RunStepStreamEventThreadRunStepDelta RunStepStreamEvent = "thread.run.step.delta"
	// RunStepStreamEventThreadRunStepExpired - Event sent when a run step is expired. The data of this event is of type RunStep
	RunStepStreamEventThreadRunStepExpired RunStepStreamEvent = "thread.run.step.expired"
	// RunStepStreamEventThreadRunStepFailed - Event sent when a run step fails. The data of this event is of type RunStep
	RunStepStreamEventThreadRunStepFailed RunStepStreamEvent = "thread.run.step.failed"
	// RunStepStreamEventThreadRunStepInProgress - Event sent when a run step moves to `in_progress` status. The data of this
	// event is of type RunStep
	RunStepStreamEventThreadRunStepInProgress RunStepStreamEvent = "thread.run.step.in_progress"
)

func PossibleRunStepStreamEventValues added in v0.2.0

func PossibleRunStepStreamEventValues() []RunStepStreamEvent

PossibleRunStepStreamEventValues returns the possible values for the RunStepStreamEvent const type.

type RunStepToolCall

type RunStepToolCall struct {
	// REQUIRED; The ID of the tool call. This ID must be referenced when you submit tool outputs.
	ID *string

	// REQUIRED; The object type.
	Type *string
}

RunStepToolCall - An abstract representation of a detailed tool call as recorded within a run step for an existing run.

func (*RunStepToolCall) GetRunStepToolCall

func (r *RunStepToolCall) GetRunStepToolCall() *RunStepToolCall

GetRunStepToolCall implements the RunStepToolCallClassification interface for type RunStepToolCall.

func (RunStepToolCall) MarshalJSON

func (r RunStepToolCall) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepToolCall.

func (*RunStepToolCall) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepToolCall.

type RunStepToolCallClassification

type RunStepToolCallClassification interface {
	// GetRunStepToolCall returns the RunStepToolCall content of the underlying type.
	GetRunStepToolCall() *RunStepToolCall
}

RunStepToolCallClassification provides polymorphic access to related types. Call the interface's GetRunStepToolCall() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *RunStepCodeInterpreterToolCall, *RunStepFileSearchToolCall, *RunStepFunctionToolCall, *RunStepToolCall

type RunStepToolCallDetails

type RunStepToolCallDetails struct {
	// REQUIRED; A list of tool call details for this run step.
	ToolCalls []RunStepToolCallClassification

	// REQUIRED; The object type.
	Type *RunStepType
}

RunStepToolCallDetails - The detailed information associated with a run step calling tools.

func (*RunStepToolCallDetails) GetRunStepDetails

func (r *RunStepToolCallDetails) GetRunStepDetails() *RunStepDetails

GetRunStepDetails implements the RunStepDetailsClassification interface for type RunStepToolCallDetails.

func (RunStepToolCallDetails) MarshalJSON

func (r RunStepToolCallDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepToolCallDetails.

func (*RunStepToolCallDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepToolCallDetails.

type RunStepType

type RunStepType string

RunStepType - The possible types of run steps.

const (
	// RunStepTypeMessageCreation - Represents a run step to create a message.
	RunStepTypeMessageCreation RunStepType = "message_creation"
	// RunStepTypeToolCalls - Represents a run step that calls tools.
	RunStepTypeToolCalls RunStepType = "tool_calls"
)

func PossibleRunStepTypeValues

func PossibleRunStepTypeValues() []RunStepType

PossibleRunStepTypeValues returns the possible values for the RunStepType const type.

type RunStepUsage added in v0.2.0

type RunStepUsage struct {
	// REQUIRED; Number of completion tokens used over the course of the run step.
	CompletionTokens *int64

	// REQUIRED; Number of prompt tokens used over the course of the run step.
	PromptTokens *int64

	// REQUIRED; Total number of tokens used (prompt + completion).
	TotalTokens *int64
}

RunStepUsage - Usage statistics related to the run step. This value will be null while the run step's status is in_progress.

func (RunStepUsage) MarshalJSON added in v0.2.0

func (r RunStepUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RunStepUsage.

func (*RunStepUsage) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type RunStepUsage.

type RunStreamEvent added in v0.2.0

type RunStreamEvent string

RunStreamEvent - Run operation related streaming events

const (
	// RunStreamEventThreadRunCancelled - Event sent when a run is cancelled. The data of this event is of type ThreadRun
	RunStreamEventThreadRunCancelled RunStreamEvent = "thread.run.cancelled"
	// RunStreamEventThreadRunCancelling - Event sent when a run moves to `cancelling` status. The data of this event is of type
	// ThreadRun
	RunStreamEventThreadRunCancelling RunStreamEvent = "thread.run.cancelling"
	// RunStreamEventThreadRunCompleted - Event sent when a run is completed. The data of this event is of type ThreadRun
	RunStreamEventThreadRunCompleted RunStreamEvent = "thread.run.completed"
	// RunStreamEventThreadRunCreated - Event sent when a new run is created. The data of this event is of type ThreadRun
	RunStreamEventThreadRunCreated RunStreamEvent = "thread.run.created"
	// RunStreamEventThreadRunExpired - Event sent when a run is expired. The data of this event is of type ThreadRun
	RunStreamEventThreadRunExpired RunStreamEvent = "thread.run.expired"
	// RunStreamEventThreadRunFailed - Event sent when a run fails. The data of this event is of type ThreadRun
	RunStreamEventThreadRunFailed RunStreamEvent = "thread.run.failed"
	// RunStreamEventThreadRunInProgress - Event sent when a run moves to `in_progress` status. The data of this event is of type
	// ThreadRun
	RunStreamEventThreadRunInProgress RunStreamEvent = "thread.run.in_progress"
	// RunStreamEventThreadRunQueued - Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun
	RunStreamEventThreadRunQueued RunStreamEvent = "thread.run.queued"
	// RunStreamEventThreadRunRequiresAction - Event sent when a run moves to `requires_action` status. The data of this event
	// is of type ThreadRun
	RunStreamEventThreadRunRequiresAction RunStreamEvent = "thread.run.requires_action"
)

func PossibleRunStreamEventValues added in v0.2.0

func PossibleRunStreamEventValues() []RunStreamEvent

PossibleRunStreamEventValues returns the possible values for the RunStreamEvent const type.

type StreamEvent added in v0.2.0

type StreamEvent struct {
	// Reason identifies the reason this event was sent.
	Reason AssistantStreamEvent

	// Event is the payload for the StreamEvent.
	Event StreamEventDataClassification
}

StreamEvent contains an event from an Assistants API stream.

type StreamEventData added in v0.2.0

type StreamEventData struct{}

StreamEventData is the common data for all stream events.

type StreamEventDataClassification added in v0.2.0

type StreamEventDataClassification interface {
	// GetStreamEventDataContent returns the StreamEventData content of the underlying type.
	GetStreamEventDataContent() *StreamEventData
}

StreamEventDataClassification provides polymorphic access to related types. Call the interface's GetStreamEventDataContent() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *AssistantThread - *MessageDeltaChunk - *RunStep - *RunStepDeltaChunk - *ThreadMessage - *ThreadRun

type SubmitToolOutputsAction

type SubmitToolOutputsAction struct {
	// REQUIRED; The details describing tools that should be called to submit tool outputs.
	SubmitToolOutputs *SubmitToolOutputsDetails

	// REQUIRED; The object type.
	Type *string
}

SubmitToolOutputsAction - The details for required tool calls that must be submitted for an assistant thread run to continue.

func (*SubmitToolOutputsAction) GetRequiredAction

func (s *SubmitToolOutputsAction) GetRequiredAction() *RequiredAction

GetRequiredAction implements the RequiredActionClassification interface for type SubmitToolOutputsAction.

func (SubmitToolOutputsAction) MarshalJSON

func (s SubmitToolOutputsAction) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SubmitToolOutputsAction.

func (*SubmitToolOutputsAction) UnmarshalJSON

func (s *SubmitToolOutputsAction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SubmitToolOutputsAction.

type SubmitToolOutputsDetails

type SubmitToolOutputsDetails struct {
	// REQUIRED; The list of tool calls that must be resolved for the assistant thread run to continue.
	ToolCalls []RequiredToolCallClassification
}

SubmitToolOutputsDetails - The details describing tools that should be called to submit tool outputs.

func (SubmitToolOutputsDetails) MarshalJSON

func (s SubmitToolOutputsDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SubmitToolOutputsDetails.

func (*SubmitToolOutputsDetails) UnmarshalJSON

func (s *SubmitToolOutputsDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SubmitToolOutputsDetails.

type SubmitToolOutputsToRunBody

type SubmitToolOutputsToRunBody struct {
	// REQUIRED; A list of tools for which the outputs are being submitted.
	ToolOutputs []ToolOutput
	// contains filtered or unexported fields
}

SubmitToolOutputsToRunBody contains arguments for the [SubmitToolOutputsToRun] method.

func (SubmitToolOutputsToRunBody) MarshalJSON

func (s SubmitToolOutputsToRunBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SubmitToolOutputsToRunBody.

func (*SubmitToolOutputsToRunBody) UnmarshalJSON

func (s *SubmitToolOutputsToRunBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SubmitToolOutputsToRunBody.

type SubmitToolOutputsToRunOptions

type SubmitToolOutputsToRunOptions struct {
}

SubmitToolOutputsToRunOptions contains the optional parameters for the Client.SubmitToolOutputsToRun method.

type SubmitToolOutputsToRunResponse

type SubmitToolOutputsToRunResponse struct {
	// Data representing a single evaluation run of an assistant thread.
	ThreadRun
}

SubmitToolOutputsToRunResponse contains the response from method Client.SubmitToolOutputsToRun.

type SubmitToolOutputsToRunStreamOptions added in v0.2.0

type SubmitToolOutputsToRunStreamOptions struct {
}

SubmitToolOutputsToRunStreamOptions contains the optional parameters for [SubmitToolOutputsToRunStream].

type SubmitToolOutputsToRunStreamResponse added in v0.2.0

type SubmitToolOutputsToRunStreamResponse struct {
	// Stream can be used to stream response events.
	Stream *EventReader[StreamEvent]
}

SubmitToolOutputsToRunStreamResponse contains the response from [SubmitToolOutputsToRunStream].

type ThreadDeletionStatus

type ThreadDeletionStatus struct {
	// REQUIRED; A value indicating whether deletion was successful.
	Deleted *bool

	// REQUIRED; The ID of the resource specified for deletion.
	ID *string

	// REQUIRED; The object type, which is always 'thread.deleted'.
	Object *string
}

ThreadDeletionStatus - The status of a thread deletion operation.

func (ThreadDeletionStatus) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ThreadDeletionStatus.

func (*ThreadDeletionStatus) UnmarshalJSON

func (t *ThreadDeletionStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadDeletionStatus.

type ThreadMessage

type ThreadMessage struct {
	// REQUIRED; If applicable, the ID of the assistant that authored this message.
	AssistantID *string

	// REQUIRED; A list of files attached to the message, and the tools they were added to.
	Attachments []MessageAttachment

	// REQUIRED; The Unix timestamp (in seconds) for when the message was completed.
	CompletedAt *time.Time

	// REQUIRED; The list of content items associated with the assistant thread message.
	Content []MessageContentClassification

	// REQUIRED; The Unix timestamp, in seconds, representing when this object was created.
	CreatedAt *time.Time

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; The Unix timestamp (in seconds) for when the message was marked as incomplete.
	IncompleteAt *time.Time

	// REQUIRED; On an incomplete message, details about why the message is incomplete.
	IncompleteDetails *ThreadMessageIncompleteDetails

	// REQUIRED; A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information
	// about that object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// CONSTANT; The object type, which is always 'thread.message'.
	// Field has constant value "thread.message", any specified value is ignored.
	Object *string

	// REQUIRED; The role associated with the assistant thread message.
	Role *MessageRole

	// REQUIRED; If applicable, the ID of the run associated with the authoring of this message.
	RunID *string

	// REQUIRED; The status of the message.
	Status *MessageStatus

	// REQUIRED; The ID of the thread that this message belongs to.
	ThreadID *string
}

ThreadMessage - A single, existing message within an assistant thread.

func (*ThreadMessage) GetStreamEventDataContent added in v0.2.0

func (v *ThreadMessage) GetStreamEventDataContent() *StreamEventData

GetStreamEventDataContent returns the common data of the underlying type.

func (ThreadMessage) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ThreadMessage.

func (*ThreadMessage) UnmarshalJSON

func (t *ThreadMessage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadMessage.

type ThreadMessageIncompleteDetails added in v0.2.0

type ThreadMessageIncompleteDetails struct {
	// REQUIRED; The provided reason describing why the message was marked as incomplete.
	Reason *MessageIncompleteDetailsReason
}

ThreadMessageIncompleteDetails - On an incomplete message, details about why the message is incomplete.

func (ThreadMessageIncompleteDetails) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type ThreadMessageIncompleteDetails.

func (*ThreadMessageIncompleteDetails) UnmarshalJSON added in v0.2.0

func (t *ThreadMessageIncompleteDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadMessageIncompleteDetails.

type ThreadMessagesPage added in v0.2.0

type ThreadMessagesPage struct {
	// REQUIRED; The requested list of items.
	Data []ThreadMessage

	// REQUIRED; The first ID represented in this list.
	FirstID *string

	// REQUIRED; A value indicating whether there are additional values available not captured in this list.
	HasMore *bool

	// REQUIRED; The last ID represented in this list.
	LastID *string

	// REQUIRED; The object type, which is always list.
	Object *string
}

ThreadMessagesPage - The response data for a requested list of items.

func (ThreadMessagesPage) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type ThreadMessagesPage.

func (*ThreadMessagesPage) UnmarshalJSON added in v0.2.0

func (t *ThreadMessagesPage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadMessagesPage.

type ThreadRun

type ThreadRun struct {
	// REQUIRED; The ID of the assistant associated with the thread this run was performed against.
	AssistantID *string

	// REQUIRED; The Unix timestamp, in seconds, representing when this was cancelled.
	CancelledAt *time.Time

	// REQUIRED; The Unix timestamp, in seconds, representing when this completed.
	CompletedAt *time.Time

	// REQUIRED; The Unix timestamp, in seconds, representing when this object was created.
	CreatedAt *time.Time

	// REQUIRED; The Unix timestamp, in seconds, representing when this item expires.
	ExpiresAt *time.Time

	// REQUIRED; The Unix timestamp, in seconds, representing when this failed.
	FailedAt *time.Time

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; Details on why the run is incomplete. Will be null if the run is not incomplete.
	IncompleteDetails *IncompleteRunDetails

	// REQUIRED; The overridden system instructions used for this assistant thread run.
	Instructions *string

	// REQUIRED; The last error, if any, encountered by this assistant thread run.
	LastError *ThreadRunLastError

	// REQUIRED; The maximum number of completion tokens specified to have been used over the course of the run.
	MaxCompletionTokens *int32

	// REQUIRED; The maximum number of prompt tokens specified to have been used over the course of the run.
	MaxPromptTokens *int32

	// REQUIRED; A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information
	// about that object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// REQUIRED; The ID of the model to use.
	Model *string

	// REQUIRED; The object type, which is always 'thread.run'.
	Object *string

	// REQUIRED; The response format of the tool calls used in this run.
	ResponseFormat *AssistantResponseFormat

	// REQUIRED; The Unix timestamp, in seconds, representing when this item was started.
	StartedAt *time.Time

	// REQUIRED; The status of the assistant thread run.
	Status *RunStatus

	// REQUIRED; The ID of the thread associated with this run.
	ThreadID *string

	// REQUIRED; Controls whether or not and which tool is called by the model.
	ToolChoice *AssistantsAPIToolChoiceOption

	// REQUIRED; The overridden enabled tools used for this assistant thread run.
	Tools []ToolDefinitionClassification

	// REQUIRED; The strategy to use for dropping messages as the context windows moves forward.
	TruncationStrategy *ThreadRunTruncationStrategy

	// REQUIRED; Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress,
	// queued, etc.).
	Usage *ThreadRunUsage

	// The details of the action required for the assistant thread run to continue.
	RequiredAction RequiredActionClassification

	// The sampling temperature used for this run. If not set, defaults to 1.
	Temperature *float32

	// The nucleus sampling value used for this run. If not set, defaults to 1.
	TopP *float32
}

ThreadRun - Data representing a single evaluation run of an assistant thread.

func (*ThreadRun) GetStreamEventDataContent added in v0.2.0

func (v *ThreadRun) GetStreamEventDataContent() *StreamEventData

GetStreamEventDataContent returns the common data of the underlying type.

func (ThreadRun) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ThreadRun.

func (*ThreadRun) UnmarshalJSON

func (t *ThreadRun) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadRun.

type ThreadRunLastError

type ThreadRunLastError struct {
	// REQUIRED; The status for the error.
	Code *string

	// REQUIRED; The human-readable text associated with the error.
	Message *string
}

ThreadRunLastError - The last error, if any, encountered by this assistant thread run.

func (ThreadRunLastError) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ThreadRunLastError.

func (*ThreadRunLastError) UnmarshalJSON

func (t *ThreadRunLastError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadRunLastError.

type ThreadRunStepsPage added in v0.2.0

type ThreadRunStepsPage struct {
	// REQUIRED; The requested list of items.
	Data []RunStep

	// REQUIRED; The first ID represented in this list.
	FirstID *string

	// REQUIRED; A value indicating whether there are additional values available not captured in this list.
	HasMore *bool

	// REQUIRED; The last ID represented in this list.
	LastID *string

	// REQUIRED; The object type, which is always list.
	Object *string
}

ThreadRunStepsPage - The response data for a requested list of items.

func (ThreadRunStepsPage) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type ThreadRunStepsPage.

func (*ThreadRunStepsPage) UnmarshalJSON added in v0.2.0

func (t *ThreadRunStepsPage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadRunStepsPage.

type ThreadRunTruncationStrategy added in v0.2.0

type ThreadRunTruncationStrategy struct {
	// REQUIRED; The truncation strategy to use for the thread. The default is auto. If set to last_messages, the thread will
	// be truncated to the lastMessages count most recent messages in the thread. When set to auto
	// , messages in the middle of the thread will be dropped to fit the context length of the model, max_prompt_tokens.
	Type *TruncationStrategy

	// The number of most recent messages from the thread when constructing the context for the run.
	LastMessages *int32
}

ThreadRunTruncationStrategy - The strategy to use for dropping messages as the context windows moves forward.

func (ThreadRunTruncationStrategy) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type ThreadRunTruncationStrategy.

func (*ThreadRunTruncationStrategy) UnmarshalJSON added in v0.2.0

func (t *ThreadRunTruncationStrategy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadRunTruncationStrategy.

type ThreadRunUsage added in v0.2.0

type ThreadRunUsage struct {
	// REQUIRED; Number of completion tokens used over the course of the run.
	CompletionTokens *int64

	// REQUIRED; Number of prompt tokens used over the course of the run.
	PromptTokens *int64

	// REQUIRED; Total number of tokens used (prompt + completion).
	TotalTokens *int64
}

ThreadRunUsage - Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.).

func (ThreadRunUsage) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type ThreadRunUsage.

func (*ThreadRunUsage) UnmarshalJSON added in v0.2.0

func (t *ThreadRunUsage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadRunUsage.

type ThreadRunsPage

type ThreadRunsPage struct {
	// REQUIRED; The requested list of items.
	Data []ThreadRun

	// REQUIRED; The first ID represented in this list.
	FirstID *string

	// REQUIRED; A value indicating whether there are additional values available not captured in this list.
	HasMore *bool

	// REQUIRED; The last ID represented in this list.
	LastID *string

	// REQUIRED; The object type, which is always list.
	Object *string
}

ThreadRunsPage - The response data for a requested list of items.

func (ThreadRunsPage) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ThreadRunsPage.

func (*ThreadRunsPage) UnmarshalJSON

func (t *ThreadRunsPage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ThreadRunsPage.

type ThreadStreamEvent added in v0.2.0

type ThreadStreamEvent string

ThreadStreamEvent - Thread operation related streaming events

const (
	// ThreadStreamEventThreadCreated - Event sent when a new thread is created. The data of this event is of type AssistantThread
	ThreadStreamEventThreadCreated ThreadStreamEvent = "thread.created"
)

func PossibleThreadStreamEventValues added in v0.2.0

func PossibleThreadStreamEventValues() []ThreadStreamEvent

PossibleThreadStreamEventValues returns the possible values for the ThreadStreamEvent const type.

type ToolDefinition

type ToolDefinition struct {
	// REQUIRED; The object type.
	Type *string
}

ToolDefinition - An abstract representation of an input tool definition that an assistant can use.

func (*ToolDefinition) GetToolDefinition

func (t *ToolDefinition) GetToolDefinition() *ToolDefinition

GetToolDefinition implements the ToolDefinitionClassification interface for type ToolDefinition.

func (ToolDefinition) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ToolDefinition.

func (*ToolDefinition) UnmarshalJSON

func (t *ToolDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ToolDefinition.

type ToolDefinitionClassification

type ToolDefinitionClassification interface {
	// GetToolDefinition returns the ToolDefinition content of the underlying type.
	GetToolDefinition() *ToolDefinition
}

ToolDefinitionClassification provides polymorphic access to related types. Call the interface's GetToolDefinition() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *CodeInterpreterToolDefinition, *FileSearchToolDefinition, *FunctionToolDefinition, *ToolDefinition

type ToolOutput

type ToolOutput struct {
	// The output from the tool to be submitted.
	Output *string

	// The ID of the tool call being resolved, as provided in the tool calls of a required action from a run.
	ToolCallID *string
}

ToolOutput - The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue.

func (ToolOutput) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ToolOutput.

func (*ToolOutput) UnmarshalJSON

func (t *ToolOutput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ToolOutput.

type ToolResources added in v0.2.0

type ToolResources struct {
	// Resources to be used by the code_interpreter tool consisting of file IDs.
	CodeInterpreter *CodeInterpreterToolResource

	// Resources to be used by the file_search tool consisting of vector store IDs.
	FileSearch *FileSearchToolResource
}

ToolResources - A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_searchtool requires a list of vector store IDs.

func (ToolResources) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type ToolResources.

func (*ToolResources) UnmarshalJSON added in v0.2.0

func (t *ToolResources) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ToolResources.

type TruncationObject added in v0.2.0

type TruncationObject struct {
	// REQUIRED; The truncation strategy to use for the thread. The default is auto. If set to last_messages, the thread will
	// be truncated to the lastMessages count most recent messages in the thread. When set to auto
	// , messages in the middle of the thread will be dropped to fit the context length of the model, max_prompt_tokens.
	Type *TruncationStrategy

	// The number of most recent messages from the thread when constructing the context for the run.
	LastMessages *int32
}

TruncationObject - Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run.

func (TruncationObject) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type TruncationObject.

func (*TruncationObject) UnmarshalJSON added in v0.2.0

func (t *TruncationObject) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TruncationObject.

type TruncationStrategy added in v0.2.0

type TruncationStrategy string

TruncationStrategy - The truncation strategy to use for the thread. The default is auto. If set to last_messages, the thread will be truncated to the lastMessages count most recent messages in the thread. When set to auto , messages in the middle of the thread will be dropped to fit the context length of the model, max_prompt_tokens.

const (
	// TruncationStrategyAuto - Default value. Messages in the middle of the thread will be dropped to fit the context length
	// of the model.
	TruncationStrategyAuto TruncationStrategy = "auto"
	// TruncationStrategyLastMessages - The thread will truncate to the `lastMessages` count of recent messages.
	TruncationStrategyLastMessages TruncationStrategy = "last_messages"
)

func PossibleTruncationStrategyValues added in v0.2.0

func PossibleTruncationStrategyValues() []TruncationStrategy

PossibleTruncationStrategyValues returns the possible values for the TruncationStrategy const type.

type UpdateAssistantBody

type UpdateAssistantBody struct {
	// The ID of the model to use.
	DeploymentName *string

	// The modified description for the assistant to use.
	Description *string

	// The modified system instructions for the new assistant to use.
	Instructions *string

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// The modified name for the assistant to use.
	Name *string

	// The response format of the tool calls used by this assistant.
	ResponseFormat *AssistantResponseFormat

	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower
	// values like 0.2 will make it more focused and deterministic.
	Temperature *float32

	// A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example,
	// the code_interpreter tool requires a list of file IDs, while the file_search
	// tool requires a list of vector store IDs.
	ToolResources *UpdateToolResourcesOptions

	// The modified collection of tools to enable for the assistant.
	Tools []ToolDefinitionClassification

	// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens
	// with top_p probability mass. So 0.1 means only the tokens comprising the top
	// 10% probability mass are considered.
	// We generally recommend altering this or temperature but not both.
	TopP *float32
}

UpdateAssistantBody - The request details to use when modifying an existing assistant.

func (UpdateAssistantBody) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type UpdateAssistantBody.

func (*UpdateAssistantBody) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type UpdateAssistantBody.

type UpdateAssistantOptions

type UpdateAssistantOptions struct {
}

UpdateAssistantOptions contains the optional parameters for the Client.UpdateAssistant method.

type UpdateAssistantResponse

type UpdateAssistantResponse struct {
	// Represents an assistant that can call the model and use tools.
	Assistant
}

UpdateAssistantResponse contains the response from method Client.UpdateAssistant.

type UpdateAssistantThreadOptionsToolResources added in v0.2.0

type UpdateAssistantThreadOptionsToolResources struct {
	// Overrides the list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated
	// with the tool.
	CodeInterpreter *UpdateCodeInterpreterToolResourceOptions

	// Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
	FileSearch *UpdateFileSearchToolResourceOptions
}

UpdateAssistantThreadOptionsToolResources - A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs

func (UpdateAssistantThreadOptionsToolResources) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type UpdateAssistantThreadOptionsToolResources.

func (*UpdateAssistantThreadOptionsToolResources) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type UpdateAssistantThreadOptionsToolResources.

type UpdateCodeInterpreterToolResourceOptions added in v0.2.0

type UpdateCodeInterpreterToolResourceOptions struct {
	// A list of file IDs to override the current list of the assistant.
	FileIDs []string
}

UpdateCodeInterpreterToolResourceOptions - Request object to update code_interpreted tool resources.

func (UpdateCodeInterpreterToolResourceOptions) MarshalJSON added in v0.2.0

MarshalJSON implements the json.Marshaller interface for type UpdateCodeInterpreterToolResourceOptions.

func (*UpdateCodeInterpreterToolResourceOptions) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type UpdateCodeInterpreterToolResourceOptions.

type UpdateFileSearchToolResourceOptions added in v0.2.0

type UpdateFileSearchToolResourceOptions struct {
	// A list of vector store IDs to override the current list of the assistant.
	VectorStoreIDs []string
}

UpdateFileSearchToolResourceOptions - Request object to update file_search tool resources.

func (UpdateFileSearchToolResourceOptions) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type UpdateFileSearchToolResourceOptions.

func (*UpdateFileSearchToolResourceOptions) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type UpdateFileSearchToolResourceOptions.

type UpdateMessageBody

type UpdateMessageBody struct {
	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string
}

UpdateMessageBody contains arguments for the [UpdateMessage] method.

func (UpdateMessageBody) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type UpdateMessageBody.

func (*UpdateMessageBody) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type UpdateMessageBody.

type UpdateMessageOptions

type UpdateMessageOptions struct {
}

UpdateMessageOptions contains the optional parameters for the Client.UpdateMessage method.

type UpdateMessageResponse

type UpdateMessageResponse struct {
	// A single, existing message within an assistant thread.
	ThreadMessage
}

UpdateMessageResponse contains the response from method Client.UpdateMessage.

type UpdateRunBody

type UpdateRunBody struct {
	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string
}

UpdateRunBody contains arguments for the [UpdateRun] method.

func (UpdateRunBody) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type UpdateRunBody.

func (*UpdateRunBody) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRunBody.

type UpdateRunOptions

type UpdateRunOptions struct {
}

UpdateRunOptions contains the optional parameters for the Client.UpdateRun method.

type UpdateRunResponse

type UpdateRunResponse struct {
	// Data representing a single evaluation run of an assistant thread.
	ThreadRun
}

UpdateRunResponse contains the response from method Client.UpdateRun.

type UpdateThreadBody

type UpdateThreadBody struct {
	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type
	// of tool. For example, the code_interpreter tool requires a list of file IDs,
	// while the file_search tool requires a list of vector store IDs
	ToolResources *UpdateAssistantThreadOptionsToolResources
}

UpdateThreadBody - The details used to update an existing assistant thread

func (UpdateThreadBody) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type UpdateThreadBody.

func (*UpdateThreadBody) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type UpdateThreadBody.

type UpdateThreadOptions

type UpdateThreadOptions struct {
}

UpdateThreadOptions contains the optional parameters for the Client.UpdateThread method.

type UpdateThreadResponse

type UpdateThreadResponse struct {
	// Information about a single thread associated with an assistant.
	AssistantThread
}

UpdateThreadResponse contains the response from method Client.UpdateThread.

type UpdateToolResourcesOptions added in v0.2.0

type UpdateToolResourcesOptions struct {
	// Overrides the list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated
	// with the tool.
	CodeInterpreter *UpdateCodeInterpreterToolResourceOptions

	// Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
	FileSearch *UpdateFileSearchToolResourceOptions
}

UpdateToolResourcesOptions - Request object. A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

func (UpdateToolResourcesOptions) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type UpdateToolResourcesOptions.

func (*UpdateToolResourcesOptions) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type UpdateToolResourcesOptions.

type UploadFileOptions

type UploadFileOptions struct {
	// A filename to associate with the uploaded data.
	Filename *string
}

UploadFileOptions contains the optional parameters for the Client.UploadFile method.

type UploadFileResponse

type UploadFileResponse struct {
	// Represents an assistant that can call the model and use tools.
	OpenAIFile
}

UploadFileResponse contains the response from method Client.UploadFile.

type VectorStore added in v0.2.0

type VectorStore struct {
	// REQUIRED; The Unix timestamp (in seconds) for when the vector store was created.
	CreatedAt *time.Time

	// REQUIRED; Files count grouped by status processed or being processed by this vector store.
	FileCounts *VectorStoreFileCount

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; The Unix timestamp (in seconds) for when the vector store was last active.
	LastActiveAt *time.Time

	// REQUIRED; A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information
	// about that object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// REQUIRED; The name of the vector store.
	Name *string

	// REQUIRED; The object type, which is always vector_store
	Object *string

	// REQUIRED; The status of the vector store, which can be either expired, in_progress, or completed. A status of completed
	// indicates that the vector store is ready for use.
	Status *VectorStoreStatus

	// REQUIRED; The total number of bytes used by the files in the vector store.
	UsageBytes *int32

	// Details on when this vector store expires
	ExpiresAfter *VectorStoreExpirationPolicy

	// The Unix timestamp (in seconds) for when the vector store will expire.
	ExpiresAt *time.Time
}

VectorStore - A vector store is a collection of processed files can be used by the file_search tool.

func (VectorStore) MarshalJSON added in v0.2.0

func (v VectorStore) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStore.

func (*VectorStore) UnmarshalJSON added in v0.2.0

func (v *VectorStore) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStore.

type VectorStoreAutoChunkingStrategyRequest added in v0.2.1

type VectorStoreAutoChunkingStrategyRequest struct {
	// REQUIRED; The object type.
	Type *VectorStoreChunkingStrategyRequestType
}

VectorStoreAutoChunkingStrategyRequest - The default strategy. This strategy currently uses a maxchunksizetokens of 800 and chunkoverlap_tokens of 400.

func (*VectorStoreAutoChunkingStrategyRequest) GetVectorStoreChunkingStrategyRequest added in v0.2.1

func (v *VectorStoreAutoChunkingStrategyRequest) GetVectorStoreChunkingStrategyRequest() *VectorStoreChunkingStrategyRequest

GetVectorStoreChunkingStrategyRequest implements the VectorStoreChunkingStrategyRequestClassification interface for type VectorStoreAutoChunkingStrategyRequest.

func (VectorStoreAutoChunkingStrategyRequest) MarshalJSON added in v0.2.1

func (v VectorStoreAutoChunkingStrategyRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreAutoChunkingStrategyRequest.

func (*VectorStoreAutoChunkingStrategyRequest) UnmarshalJSON added in v0.2.1

func (v *VectorStoreAutoChunkingStrategyRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreAutoChunkingStrategyRequest.

type VectorStoreAutoChunkingStrategyResponse added in v0.2.1

type VectorStoreAutoChunkingStrategyResponse struct {
	// REQUIRED; The object type.
	Type *VectorStoreChunkingStrategyResponseType
}

VectorStoreAutoChunkingStrategyResponse - This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the chunking_strategy concept was introduced in the API.

func (*VectorStoreAutoChunkingStrategyResponse) GetVectorStoreChunkingStrategyResponse added in v0.2.1

func (v *VectorStoreAutoChunkingStrategyResponse) GetVectorStoreChunkingStrategyResponse() *VectorStoreChunkingStrategyResponse

GetVectorStoreChunkingStrategyResponse implements the VectorStoreChunkingStrategyResponseClassification interface for type VectorStoreAutoChunkingStrategyResponse.

func (VectorStoreAutoChunkingStrategyResponse) MarshalJSON added in v0.2.1

func (v VectorStoreAutoChunkingStrategyResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreAutoChunkingStrategyResponse.

func (*VectorStoreAutoChunkingStrategyResponse) UnmarshalJSON added in v0.2.1

func (v *VectorStoreAutoChunkingStrategyResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreAutoChunkingStrategyResponse.

type VectorStoreBody added in v0.2.0

type VectorStoreBody struct {
	// The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is
	// non-empty.
	ChunkingStrategy VectorStoreChunkingStrategyRequestClassification

	// Details on when this vector store expires
	ExpiresAfter *VectorStoreExpirationPolicy

	// A list of file IDs that the vector store should use. Useful for tools like file_search that can access files.
	FileIDs []string

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// The name of the vector store.
	Name *string
}

VectorStoreBody - Request object for creating a vector store.

func (VectorStoreBody) MarshalJSON added in v0.2.0

func (v VectorStoreBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreBody.

func (*VectorStoreBody) UnmarshalJSON added in v0.2.0

func (v *VectorStoreBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreBody.

type VectorStoreChunkingStrategyRequest added in v0.2.1

type VectorStoreChunkingStrategyRequest struct {
	// REQUIRED; The object type.
	Type *VectorStoreChunkingStrategyRequestType
}

VectorStoreChunkingStrategyRequest - An abstract representation of a vector store chunking strategy configuration.

func (*VectorStoreChunkingStrategyRequest) GetVectorStoreChunkingStrategyRequest added in v0.2.1

func (v *VectorStoreChunkingStrategyRequest) GetVectorStoreChunkingStrategyRequest() *VectorStoreChunkingStrategyRequest

GetVectorStoreChunkingStrategyRequest implements the VectorStoreChunkingStrategyRequestClassification interface for type VectorStoreChunkingStrategyRequest.

func (VectorStoreChunkingStrategyRequest) MarshalJSON added in v0.2.1

func (v VectorStoreChunkingStrategyRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreChunkingStrategyRequest.

func (*VectorStoreChunkingStrategyRequest) UnmarshalJSON added in v0.2.1

func (v *VectorStoreChunkingStrategyRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreChunkingStrategyRequest.

type VectorStoreChunkingStrategyRequestClassification added in v0.2.1

type VectorStoreChunkingStrategyRequestClassification interface {
	// GetVectorStoreChunkingStrategyRequest returns the VectorStoreChunkingStrategyRequest content of the underlying type.
	GetVectorStoreChunkingStrategyRequest() *VectorStoreChunkingStrategyRequest
}

VectorStoreChunkingStrategyRequestClassification provides polymorphic access to related types. Call the interface's GetVectorStoreChunkingStrategyRequest() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *VectorStoreAutoChunkingStrategyRequest, *VectorStoreChunkingStrategyRequest, *VectorStoreStaticChunkingStrategyRequest

type VectorStoreChunkingStrategyRequestType added in v0.2.1

type VectorStoreChunkingStrategyRequestType string

VectorStoreChunkingStrategyRequestType - Type of chunking strategy

const (
	VectorStoreChunkingStrategyRequestTypeAuto   VectorStoreChunkingStrategyRequestType = "auto"
	VectorStoreChunkingStrategyRequestTypeStatic VectorStoreChunkingStrategyRequestType = "static"
)

func PossibleVectorStoreChunkingStrategyRequestTypeValues added in v0.2.1

func PossibleVectorStoreChunkingStrategyRequestTypeValues() []VectorStoreChunkingStrategyRequestType

PossibleVectorStoreChunkingStrategyRequestTypeValues returns the possible values for the VectorStoreChunkingStrategyRequestType const type.

type VectorStoreChunkingStrategyResponse added in v0.2.1

type VectorStoreChunkingStrategyResponse struct {
	// REQUIRED; The object type.
	Type *VectorStoreChunkingStrategyResponseType
}

VectorStoreChunkingStrategyResponse - An abstract representation of a vector store chunking strategy configuration.

func (*VectorStoreChunkingStrategyResponse) GetVectorStoreChunkingStrategyResponse added in v0.2.1

func (v *VectorStoreChunkingStrategyResponse) GetVectorStoreChunkingStrategyResponse() *VectorStoreChunkingStrategyResponse

GetVectorStoreChunkingStrategyResponse implements the VectorStoreChunkingStrategyResponseClassification interface for type VectorStoreChunkingStrategyResponse.

func (VectorStoreChunkingStrategyResponse) MarshalJSON added in v0.2.1

func (v VectorStoreChunkingStrategyResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreChunkingStrategyResponse.

func (*VectorStoreChunkingStrategyResponse) UnmarshalJSON added in v0.2.1

func (v *VectorStoreChunkingStrategyResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreChunkingStrategyResponse.

type VectorStoreChunkingStrategyResponseClassification added in v0.2.1

type VectorStoreChunkingStrategyResponseClassification interface {
	// GetVectorStoreChunkingStrategyResponse returns the VectorStoreChunkingStrategyResponse content of the underlying type.
	GetVectorStoreChunkingStrategyResponse() *VectorStoreChunkingStrategyResponse
}

VectorStoreChunkingStrategyResponseClassification provides polymorphic access to related types. Call the interface's GetVectorStoreChunkingStrategyResponse() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *VectorStoreAutoChunkingStrategyResponse, *VectorStoreChunkingStrategyResponse, *VectorStoreStaticChunkingStrategyResponse

type VectorStoreChunkingStrategyResponseType added in v0.2.1

type VectorStoreChunkingStrategyResponseType string

VectorStoreChunkingStrategyResponseType - Type of chunking strategy

const (
	VectorStoreChunkingStrategyResponseTypeOther  VectorStoreChunkingStrategyResponseType = "other"
	VectorStoreChunkingStrategyResponseTypeStatic VectorStoreChunkingStrategyResponseType = "static"
)

func PossibleVectorStoreChunkingStrategyResponseTypeValues added in v0.2.1

func PossibleVectorStoreChunkingStrategyResponseTypeValues() []VectorStoreChunkingStrategyResponseType

PossibleVectorStoreChunkingStrategyResponseTypeValues returns the possible values for the VectorStoreChunkingStrategyResponseType const type.

type VectorStoreDeletionStatus added in v0.2.0

type VectorStoreDeletionStatus struct {
	// REQUIRED; A value indicating whether deletion was successful.
	Deleted *bool

	// REQUIRED; The ID of the resource specified for deletion.
	ID *string

	// REQUIRED; The object type, which is always 'vector_store.deleted'.
	Object *string
}

VectorStoreDeletionStatus - Response object for deleting a vector store.

func (VectorStoreDeletionStatus) MarshalJSON added in v0.2.0

func (v VectorStoreDeletionStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreDeletionStatus.

func (*VectorStoreDeletionStatus) UnmarshalJSON added in v0.2.0

func (v *VectorStoreDeletionStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreDeletionStatus.

type VectorStoreExpirationPolicy added in v0.2.0

type VectorStoreExpirationPolicy struct {
	// REQUIRED; Anchor timestamp after which the expiration policy applies. Supported anchors: last_active_at.
	Anchor *VectorStoreExpirationPolicyAnchor

	// REQUIRED; The anchor timestamp after which the expiration policy applies.
	Days *int32
}

VectorStoreExpirationPolicy - The expiration policy for a vector store.

func (VectorStoreExpirationPolicy) MarshalJSON added in v0.2.0

func (v VectorStoreExpirationPolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreExpirationPolicy.

func (*VectorStoreExpirationPolicy) UnmarshalJSON added in v0.2.0

func (v *VectorStoreExpirationPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreExpirationPolicy.

type VectorStoreExpirationPolicyAnchor added in v0.2.0

type VectorStoreExpirationPolicyAnchor string

VectorStoreExpirationPolicyAnchor - Describes the relationship between the days and the expiration of this vector store

const (
	// VectorStoreExpirationPolicyAnchorLastActiveAt - The expiration policy is based on the last time the vector store was active.
	VectorStoreExpirationPolicyAnchorLastActiveAt VectorStoreExpirationPolicyAnchor = "last_active_at"
)

func PossibleVectorStoreExpirationPolicyAnchorValues added in v0.2.0

func PossibleVectorStoreExpirationPolicyAnchorValues() []VectorStoreExpirationPolicyAnchor

PossibleVectorStoreExpirationPolicyAnchorValues returns the possible values for the VectorStoreExpirationPolicyAnchor const type.

type VectorStoreFile added in v0.2.0

type VectorStoreFile struct {
	// REQUIRED; The strategy used to chunk the file.
	ChunkingStrategy VectorStoreChunkingStrategyResponseClassification

	// REQUIRED; The Unix timestamp (in seconds) for when the vector store file was created.
	CreatedAt *time.Time

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; The last error associated with this vector store file. Will be null if there are no errors.
	LastError *VectorStoreFileLastError

	// REQUIRED; The object type, which is always vector_store.file.
	Object *string

	// REQUIRED; The status of the vector store file, which can be either in_progress, completed, cancelled, or failed. The status
	// completed indicates that the vector store file is ready for use.
	Status *VectorStoreFileStatus

	// REQUIRED; The total vector store usage in bytes. Note that this may be different from the original file size.
	UsageBytes *int32

	// REQUIRED; The ID of the vector store that the file is attached to.
	VectorStoreID *string
}

VectorStoreFile - Description of a file attached to a vector store.

func (VectorStoreFile) MarshalJSON added in v0.2.0

func (v VectorStoreFile) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreFile.

func (*VectorStoreFile) UnmarshalJSON added in v0.2.0

func (v *VectorStoreFile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreFile.

type VectorStoreFileBatch added in v0.2.0

type VectorStoreFileBatch struct {
	// REQUIRED; The Unix timestamp (in seconds) for when the vector store files batch was created.
	CreatedAt *time.Time

	// REQUIRED; Files count grouped by status processed or being processed by this vector store.
	FileCounts *VectorStoreFileCount

	// REQUIRED; The identifier, which can be referenced in API endpoints.
	ID *string

	// REQUIRED; The object type, which is always vector_store.file_batch.
	Object *string

	// REQUIRED; The status of the vector store files batch, which can be either in_progress, completed, cancelled or failed.
	Status *VectorStoreFileBatchStatus

	// REQUIRED; The ID of the vector store that the file is attached to.
	VectorStoreID *string
}

VectorStoreFileBatch - A batch of files attached to a vector store.

func (VectorStoreFileBatch) MarshalJSON added in v0.2.0

func (v VectorStoreFileBatch) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreFileBatch.

func (*VectorStoreFileBatch) UnmarshalJSON added in v0.2.0

func (v *VectorStoreFileBatch) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreFileBatch.

type VectorStoreFileBatchStatus added in v0.2.0

type VectorStoreFileBatchStatus string

VectorStoreFileBatchStatus - The status of the vector store file batch.

const (
	// VectorStoreFileBatchStatusCancelled - The vector store file batch was cancelled.
	VectorStoreFileBatchStatusCancelled VectorStoreFileBatchStatus = "cancelled"
	// VectorStoreFileBatchStatusCompleted - the vector store file batch is ready for use.
	VectorStoreFileBatchStatusCompleted VectorStoreFileBatchStatus = "completed"
	// VectorStoreFileBatchStatusFailed - The vector store file batch failed to process.
	VectorStoreFileBatchStatusFailed VectorStoreFileBatchStatus = "failed"
	// VectorStoreFileBatchStatusInProgress - The vector store is still processing this file batch.
	VectorStoreFileBatchStatusInProgress VectorStoreFileBatchStatus = "in_progress"
)

func PossibleVectorStoreFileBatchStatusValues added in v0.2.0

func PossibleVectorStoreFileBatchStatusValues() []VectorStoreFileBatchStatus

PossibleVectorStoreFileBatchStatusValues returns the possible values for the VectorStoreFileBatchStatus const type.

type VectorStoreFileBatchesPage added in v0.2.0

type VectorStoreFileBatchesPage struct {
	// REQUIRED; The requested list of items.
	Data []VectorStoreFile

	// REQUIRED; The first ID represented in this list.
	FirstID *string

	// REQUIRED; A value indicating whether there are additional values available not captured in this list.
	HasMore *bool

	// REQUIRED; The last ID represented in this list.
	LastID *string

	// REQUIRED; The object type, which is always list.
	Object *string
}

VectorStoreFileBatchesPage - The response data for a requested list of items.

func (VectorStoreFileBatchesPage) MarshalJSON added in v0.2.0

func (v VectorStoreFileBatchesPage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreFileBatchesPage.

func (*VectorStoreFileBatchesPage) UnmarshalJSON added in v0.2.0

func (v *VectorStoreFileBatchesPage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreFileBatchesPage.

type VectorStoreFileCount added in v0.2.0

type VectorStoreFileCount struct {
	// REQUIRED; The number of files that were cancelled.
	Cancelled *int32

	// REQUIRED; The number of files that have been successfully processed.
	Completed *int32

	// REQUIRED; The number of files that have failed to process.
	Failed *int32

	// REQUIRED; The number of files that are currently being processed.
	InProgress *int32

	// REQUIRED; The total number of files.
	Total *int32
}

VectorStoreFileCount - Counts of files processed or being processed by this vector store grouped by status.

func (VectorStoreFileCount) MarshalJSON added in v0.2.0

func (v VectorStoreFileCount) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreFileCount.

func (*VectorStoreFileCount) UnmarshalJSON added in v0.2.0

func (v *VectorStoreFileCount) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreFileCount.

type VectorStoreFileDeletionStatus added in v0.2.0

type VectorStoreFileDeletionStatus struct {
	// REQUIRED; A value indicating whether deletion was successful.
	Deleted *bool

	// REQUIRED; The ID of the resource specified for deletion.
	ID *string

	// REQUIRED; The object type, which is always 'vector_store.deleted'.
	Object *string
}

VectorStoreFileDeletionStatus - Response object for deleting a vector store file relationship.

func (VectorStoreFileDeletionStatus) MarshalJSON added in v0.2.0

func (v VectorStoreFileDeletionStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreFileDeletionStatus.

func (*VectorStoreFileDeletionStatus) UnmarshalJSON added in v0.2.0

func (v *VectorStoreFileDeletionStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreFileDeletionStatus.

type VectorStoreFileError added in v0.2.0

type VectorStoreFileError struct {
	// REQUIRED; One of server_error or rate_limit_exceeded.
	Code *VectorStoreFileErrorCode

	// REQUIRED; A human-readable description of the error.
	Message *string
}

VectorStoreFileError - Details on the error that may have ocurred while processing a file for this vector store

func (VectorStoreFileError) MarshalJSON added in v0.2.0

func (v VectorStoreFileError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreFileError.

func (*VectorStoreFileError) UnmarshalJSON added in v0.2.0

func (v *VectorStoreFileError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreFileError.

type VectorStoreFileErrorCode added in v0.2.0

type VectorStoreFileErrorCode string

VectorStoreFileErrorCode - Error code variants for vector store file processing

const (
	// VectorStoreFileErrorCodeFileNotFound - The file was not found.
	VectorStoreFileErrorCodeFileNotFound VectorStoreFileErrorCode = "file_not_found"
	// VectorStoreFileErrorCodeInternalError - An internal error occurred.
	VectorStoreFileErrorCodeInternalError VectorStoreFileErrorCode = "internal_error"
	// VectorStoreFileErrorCodeParsingError - The file could not be parsed.
	VectorStoreFileErrorCodeParsingError VectorStoreFileErrorCode = "parsing_error"
	// VectorStoreFileErrorCodeUnhandledMimeType - The file has an unhandled mime type.
	VectorStoreFileErrorCodeUnhandledMimeType VectorStoreFileErrorCode = "unhandled_mime_type"
)

func PossibleVectorStoreFileErrorCodeValues added in v0.2.0

func PossibleVectorStoreFileErrorCodeValues() []VectorStoreFileErrorCode

PossibleVectorStoreFileErrorCodeValues returns the possible values for the VectorStoreFileErrorCode const type.

type VectorStoreFileLastError added in v0.2.0

type VectorStoreFileLastError struct {
	// REQUIRED; One of server_error or rate_limit_exceeded.
	Code *VectorStoreFileErrorCode

	// REQUIRED; A human-readable description of the error.
	Message *string
}

VectorStoreFileLastError - The last error associated with this vector store file. Will be null if there are no errors.

func (VectorStoreFileLastError) MarshalJSON added in v0.2.0

func (v VectorStoreFileLastError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreFileLastError.

func (*VectorStoreFileLastError) UnmarshalJSON added in v0.2.0

func (v *VectorStoreFileLastError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreFileLastError.

type VectorStoreFileStatus added in v0.2.0

type VectorStoreFileStatus string

VectorStoreFileStatus - Vector store file status

const (
	// VectorStoreFileStatusCancelled - The file was cancelled.
	VectorStoreFileStatusCancelled VectorStoreFileStatus = "cancelled"
	// VectorStoreFileStatusCompleted - The file has been successfully processed.
	VectorStoreFileStatusCompleted VectorStoreFileStatus = "completed"
	// VectorStoreFileStatusFailed - The file has failed to process.
	VectorStoreFileStatusFailed VectorStoreFileStatus = "failed"
	// VectorStoreFileStatusInProgress - The file is currently being processed.
	VectorStoreFileStatusInProgress VectorStoreFileStatus = "in_progress"
)

func PossibleVectorStoreFileStatusValues added in v0.2.0

func PossibleVectorStoreFileStatusValues() []VectorStoreFileStatus

PossibleVectorStoreFileStatusValues returns the possible values for the VectorStoreFileStatus const type.

type VectorStoreFileStatusFilter added in v0.2.0

type VectorStoreFileStatusFilter string

VectorStoreFileStatusFilter - Query parameter filter for vector store file retrieval endpoint

const (
	// VectorStoreFileStatusFilterCancelled - Retrieve only files that were cancelled
	VectorStoreFileStatusFilterCancelled VectorStoreFileStatusFilter = "cancelled"
	// VectorStoreFileStatusFilterCompleted - Retrieve only files that have been successfully processed
	VectorStoreFileStatusFilterCompleted VectorStoreFileStatusFilter = "completed"
	// VectorStoreFileStatusFilterFailed - Retrieve only files that have failed to process
	VectorStoreFileStatusFilterFailed VectorStoreFileStatusFilter = "failed"
	// VectorStoreFileStatusFilterInProgress - Retrieve only files that are currently being processed
	VectorStoreFileStatusFilterInProgress VectorStoreFileStatusFilter = "in_progress"
)

func PossibleVectorStoreFileStatusFilterValues added in v0.2.0

func PossibleVectorStoreFileStatusFilterValues() []VectorStoreFileStatusFilter

PossibleVectorStoreFileStatusFilterValues returns the possible values for the VectorStoreFileStatusFilter const type.

type VectorStoreFilesPage added in v0.2.0

type VectorStoreFilesPage struct {
	// REQUIRED; The requested list of items.
	Data []VectorStoreFile

	// REQUIRED; The first ID represented in this list.
	FirstID *string

	// REQUIRED; A value indicating whether there are additional values available not captured in this list.
	HasMore *bool

	// REQUIRED; The last ID represented in this list.
	LastID *string

	// REQUIRED; The object type, which is always list.
	Object *string
}

VectorStoreFilesPage - The response data for a requested list of items.

func (VectorStoreFilesPage) MarshalJSON added in v0.2.0

func (v VectorStoreFilesPage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreFilesPage.

func (*VectorStoreFilesPage) UnmarshalJSON added in v0.2.0

func (v *VectorStoreFilesPage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreFilesPage.

type VectorStoreStaticChunkingStrategyOptions added in v0.2.1

type VectorStoreStaticChunkingStrategyOptions struct {
	// REQUIRED; The number of tokens that overlap between chunks. The default value is 400. Note that the overlap must not exceed
	// half of maxchunksize_tokens. *
	ChunkOverlapTokens *int32

	// REQUIRED; The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum
	// value is 4096.
	MaxChunkSizeTokens *int32
}

VectorStoreStaticChunkingStrategyOptions - Options to configure a vector store static chunking strategy.

func (VectorStoreStaticChunkingStrategyOptions) MarshalJSON added in v0.2.1

MarshalJSON implements the json.Marshaller interface for type VectorStoreStaticChunkingStrategyOptions.

func (*VectorStoreStaticChunkingStrategyOptions) UnmarshalJSON added in v0.2.1

func (v *VectorStoreStaticChunkingStrategyOptions) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreStaticChunkingStrategyOptions.

type VectorStoreStaticChunkingStrategyRequest added in v0.2.1

type VectorStoreStaticChunkingStrategyRequest struct {
	// REQUIRED; The options for the static chunking strategy.
	Static *VectorStoreStaticChunkingStrategyOptions

	// REQUIRED; The object type.
	Type *VectorStoreChunkingStrategyRequestType
}

VectorStoreStaticChunkingStrategyRequest - A statically configured chunking strategy.

func (*VectorStoreStaticChunkingStrategyRequest) GetVectorStoreChunkingStrategyRequest added in v0.2.1

func (v *VectorStoreStaticChunkingStrategyRequest) GetVectorStoreChunkingStrategyRequest() *VectorStoreChunkingStrategyRequest

GetVectorStoreChunkingStrategyRequest implements the VectorStoreChunkingStrategyRequestClassification interface for type VectorStoreStaticChunkingStrategyRequest.

func (VectorStoreStaticChunkingStrategyRequest) MarshalJSON added in v0.2.1

MarshalJSON implements the json.Marshaller interface for type VectorStoreStaticChunkingStrategyRequest.

func (*VectorStoreStaticChunkingStrategyRequest) UnmarshalJSON added in v0.2.1

func (v *VectorStoreStaticChunkingStrategyRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreStaticChunkingStrategyRequest.

type VectorStoreStaticChunkingStrategyResponse added in v0.2.1

type VectorStoreStaticChunkingStrategyResponse struct {
	// REQUIRED; The options for the static chunking strategy.
	Static *VectorStoreStaticChunkingStrategyOptions

	// REQUIRED; The object type.
	Type *VectorStoreChunkingStrategyResponseType
}

VectorStoreStaticChunkingStrategyResponse - A statically configured chunking strategy.

func (*VectorStoreStaticChunkingStrategyResponse) GetVectorStoreChunkingStrategyResponse added in v0.2.1

func (v *VectorStoreStaticChunkingStrategyResponse) GetVectorStoreChunkingStrategyResponse() *VectorStoreChunkingStrategyResponse

GetVectorStoreChunkingStrategyResponse implements the VectorStoreChunkingStrategyResponseClassification interface for type VectorStoreStaticChunkingStrategyResponse.

func (VectorStoreStaticChunkingStrategyResponse) MarshalJSON added in v0.2.1

MarshalJSON implements the json.Marshaller interface for type VectorStoreStaticChunkingStrategyResponse.

func (*VectorStoreStaticChunkingStrategyResponse) UnmarshalJSON added in v0.2.1

func (v *VectorStoreStaticChunkingStrategyResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreStaticChunkingStrategyResponse.

type VectorStoreStatus added in v0.2.0

type VectorStoreStatus string

VectorStoreStatus - Vector store possible status

const (
	// VectorStoreStatusCompleted - completed status indicates that this vector store is ready for use.
	VectorStoreStatusCompleted VectorStoreStatus = "completed"
	// VectorStoreStatusExpired - expired status indicates that this vector store has expired and is no longer available for use.
	VectorStoreStatusExpired VectorStoreStatus = "expired"
	// VectorStoreStatusInProgress - in_progress status indicates that this vector store is still processing files.
	VectorStoreStatusInProgress VectorStoreStatus = "in_progress"
)

func PossibleVectorStoreStatusValues added in v0.2.0

func PossibleVectorStoreStatusValues() []VectorStoreStatus

PossibleVectorStoreStatusValues returns the possible values for the VectorStoreStatus const type.

type VectorStoreUpdateBody added in v0.2.0

type VectorStoreUpdateBody struct {
	// Details on when this vector store expires
	ExpiresAfter *VectorStoreUpdateOptionsExpiresAfter

	// A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that
	// object in a structured format. Keys may be up to 64 characters in length and
	// values may be up to 512 characters in length.
	Metadata map[string]*string

	// The name of the vector store.
	Name *string
}

VectorStoreUpdateBody - Request object for updating a vector store.

func (VectorStoreUpdateBody) MarshalJSON added in v0.2.0

func (v VectorStoreUpdateBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreUpdateBody.

func (*VectorStoreUpdateBody) UnmarshalJSON added in v0.2.0

func (v *VectorStoreUpdateBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreUpdateBody.

type VectorStoreUpdateOptionsExpiresAfter added in v0.2.0

type VectorStoreUpdateOptionsExpiresAfter struct {
	// REQUIRED; Anchor timestamp after which the expiration policy applies. Supported anchors: last_active_at.
	Anchor *VectorStoreExpirationPolicyAnchor

	// REQUIRED; The anchor timestamp after which the expiration policy applies.
	Days *int32
}

VectorStoreUpdateOptionsExpiresAfter - Details on when this vector store expires

func (VectorStoreUpdateOptionsExpiresAfter) MarshalJSON added in v0.2.0

func (v VectorStoreUpdateOptionsExpiresAfter) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoreUpdateOptionsExpiresAfter.

func (*VectorStoreUpdateOptionsExpiresAfter) UnmarshalJSON added in v0.2.0

func (v *VectorStoreUpdateOptionsExpiresAfter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoreUpdateOptionsExpiresAfter.

type VectorStoresPage added in v0.2.0

type VectorStoresPage struct {
	// REQUIRED; The requested list of items.
	Data []VectorStore

	// REQUIRED; The first ID represented in this list.
	FirstID *string

	// REQUIRED; A value indicating whether there are additional values available not captured in this list.
	HasMore *bool

	// REQUIRED; The last ID represented in this list.
	LastID *string

	// REQUIRED; The object type, which is always list.
	Object *string
}

VectorStoresPage - The response data for a requested list of items.

func (VectorStoresPage) MarshalJSON added in v0.2.0

func (v VectorStoresPage) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type VectorStoresPage.

func (*VectorStoresPage) UnmarshalJSON added in v0.2.0

func (v *VectorStoresPage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type VectorStoresPage.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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