Documentation
¶
Index ¶
- func Create(db *gdb.DB, obj Storer) error
- func CreateAny(db *gdb.DB, dataObj any) error
- func CreateChatCompletionModelFromPublic(openAIModel openai.CreateChatCompletionRequest_Model) (string, error)
- func Delete[T any](db *gdb.DB, id string) error
- func DeleteExpired(db *gdb.DB, expiration time.Time, objs ...Storer) error
- func Dequeue(db *gdb.DB, request Storer, agentID string) error
- func EmbeddingModelFromPublic(openAIModel openai.CreateEmbeddingRequest_Model) (string, error)
- func EmitRunStepDeltaOutputEvent(gbd *gorm.DB, run *Run, ...) error
- func ExtractRunStepDetails(details openai.RunStepObject_StepDetails) (any, error)
- func Get(db *gdb.DB, dataObj any, id string) error
- func IsTerminal(status string) bool
- func List[T any](db *gdb.DB, objs *[]T) error
- func LoadBuiltInTool(ctx context.Context, gdb *gorm.DB, toolName string, ...) (types.Program, error)
- func MessageContentFromString(message string) (*openai.MessageObject_Content_Item, error)
- func Modify(db *gdb.DB, obj any, id string, updates any) error
- func SetNewID(obj Storer)
- func SetOutputForRunStepToolCall(item *openai.RunStepDetailsToolCallsObject_ToolCalls_Item, output string) error
- type Assistant
- func (a *Assistant) ExtractGPTScriptTools(gptScriptToolDefinitions map[string]*openai.FunctionObject) ([]string, error)
- func (a *Assistant) FromPublic(obj any) error
- func (a *Assistant) IDPrefix() string
- func (a *Assistant) ToPublic() any
- func (a *Assistant) ToolsToChatCompletionTools(gptScriptToolDefinitions, tools map[string]*openai.FunctionObject) ([]openai.ChatCompletionTool, error)
- type AssistantFile
- type Base
- type BuiltInTool
- type ChatCompletionResponseChunk
- type Choice
- type ChunkChoice
- type CreateChatCompletionRequest
- type CreateChatCompletionResponse
- type CreateEmbeddingRequest
- type CreateEmbeddingResponse
- type CreateImageEditRequest
- type CreateImageRequest
- type CreateImageVariationRequest
- type CreateSpeechRequest
- type CreateSpeechResponse
- type CreateTranscriptionRequest
- type CreateTranscriptionResponse
- type CreateTranslationRequest
- type CreateTranslationResponse
- type DB
- type Embedding
- type EmbeddingUsage
- type File
- type FineTuningJob
- type FineTuningJobError
- type FineTuningJobHyperParameters
- type GenericToolCallInfo
- type ImagesResponse
- type InvalidTypeError
- type JobRequest
- type JobResponse
- type Lobprob
- type Message
- type MessageDelta
- type MessageDeltaContentTextObjectText
- type MessageDeltaDelta
- type MessageFile
- type Metadata
- type Model
- type Run
- type RunEvent
- type RunLastError
- type RunRequiredAction
- type RunRequiredActionXConfirm
- type RunStep
- func (r *RunStep) BeforeUpdate(tx *gorm.DB) error
- func (r *RunStep) FromPublic(obj any) error
- func (r *RunStep) GetRunStepFunctionCalls() ([]openai.RunStepDetailsToolCallsFunctionObject, error)
- func (r *RunStep) GetStatus() string
- func (r *RunStep) IDPrefix() string
- func (r *RunStep) Merge(toolCalls *[]GenericToolCallInfo, chunk ChatCompletionResponseChunk) (*RunStepDelta, error)
- func (r *RunStep) RunStepConfirmed(id string) (bool, error)
- func (r *RunStep) SetConfirmed(id string, confirmed *bool) error
- func (r *RunStep) ToPublic() any
- type RunStepDelta
- type RunStepDeltaDelta
- type RunStepEvent
- type RunToolObject
- type Storer
- type Thread
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create saves an object to the database. It will first set the ID and CreatedAt fields. It is the responsibility of the caller to validate the object before calling this function.
func CreateAny ¶
CreateAny creates an object from the database type. This should only be used for objects that cannot be retrieved after creation.
func CreateChatCompletionModelFromPublic ¶
func CreateChatCompletionModelFromPublic(openAIModel openai.CreateChatCompletionRequest_Model) (string, error)
func DeleteExpired ¶
DeleteExpired deletes objects from the database created before or at the given expiration time.
func Dequeue ¶
Dequeue dequeues the next request from the database, marking it as claimed by the given agent.
func EmbeddingModelFromPublic ¶
func EmbeddingModelFromPublic(openAIModel openai.CreateEmbeddingRequest_Model) (string, error)
func ExtractRunStepDetails ¶
func ExtractRunStepDetails(details openai.RunStepObject_StepDetails) (any, error)
func IsTerminal ¶
func LoadBuiltInTool ¶
func MessageContentFromString ¶
func MessageContentFromString(message string) (*openai.MessageObject_Content_Item, error)
func Modify ¶
Modify modifies the object in the database. All validation should be done before calling this function.
func SetOutputForRunStepToolCall ¶
func SetOutputForRunStepToolCall(item *openai.RunStepDetailsToolCallsObject_ToolCalls_Item, output string) error
Types ¶
type Assistant ¶
type Assistant struct { Metadata `json:",inline"` Description *string `json:"description"` FileIDs datatypes.JSONSlice[string] `json:"file_ids"` Instructions *string `json:"instructions"` Model string `json:"model"` Name *string `json:"name"` Tools datatypes.JSONSlice[openai.AssistantObject_Tools_Item] `json:"tools"` }
func (*Assistant) ExtractGPTScriptTools ¶
func (*Assistant) FromPublic ¶
func (*Assistant) ToolsToChatCompletionTools ¶
func (a *Assistant) ToolsToChatCompletionTools(gptScriptToolDefinitions, tools map[string]*openai.FunctionObject) ([]openai.ChatCompletionTool, error)
type AssistantFile ¶
func (*AssistantFile) FromPublic ¶
func (af *AssistantFile) FromPublic(obj any) error
func (*AssistantFile) IDPrefix ¶
func (af *AssistantFile) IDPrefix() string
func (*AssistantFile) ToPublic ¶
func (af *AssistantFile) ToPublic() any
type Base ¶
type Base struct { ID string `json:"id" gorm:"primarykey"` CreatedAt int `json:"created_at,omitempty"` }
func (*Base) GetCreatedAt ¶
func (*Base) SetCreatedAt ¶
type BuiltInTool ¶
type ChatCompletionResponseChunk ¶
type ChatCompletionResponseChunk struct { Base `json:",inline"` Choices datatypes.JSONSlice[ChunkChoice] `json:"choices"` Model string `json:"model"` SystemFingerprint *string `json:"system_fingerprint,omitempty"` // Not part of the public API JobResponse `json:",inline"` ResponseIdx int `json:"response_idx"` }
func (*ChatCompletionResponseChunk) FromPublic ¶
func (c *ChatCompletionResponseChunk) FromPublic(obj any) error
func (*ChatCompletionResponseChunk) GetEvent ¶
func (c *ChatCompletionResponseChunk) GetEvent() string
func (*ChatCompletionResponseChunk) GetIndex ¶
func (c *ChatCompletionResponseChunk) GetIndex() int
func (*ChatCompletionResponseChunk) IDPrefix ¶
func (c *ChatCompletionResponseChunk) IDPrefix() string
func (*ChatCompletionResponseChunk) ToPublic ¶
func (c *ChatCompletionResponseChunk) ToPublic() any
type ChunkChoice ¶
type CreateChatCompletionRequest ¶
type CreateChatCompletionRequest struct { // The following fields are not exposed in the public API JobRequest `json:",inline"` ModelAPI string `json:"model_api"` // The following fields are exposed in the public API FrequencyPenalty *float32 `json:"frequency_penalty"` LogitBias datatypes.JSONType[map[string]int] `json:"logit_bias"` Logprobs *bool `json:"logprobs"` MaxTokens *int `json:"max_tokens"` Messages datatypes.JSONSlice[openai.ChatCompletionRequestMessage] `json:"messages"` Model string `json:"model"` N *int `json:"n"` PresencePenalty *float32 `json:"presence_penalty"` ResponseFormat *string `json:"response_format,omitempty"` Seed *int `json:"seed"` Stop datatypes.JSONType[*openai.CreateChatCompletionRequest_Stop] `json:"stop,omitempty"` Stream *bool `json:"stream"` Temperature *float32 `json:"temperature"` ToolChoice datatypes.JSONType[*openai.ChatCompletionToolChoiceOption] `json:"tool_choice,omitempty"` Tools datatypes.JSONSlice[openai.ChatCompletionTool] `json:"tools,omitempty"` TopLogprobs *int `json:"top_logprobs"` TopP *float32 `json:"top_p"` User *string `json:"user,omitempty"` }
func (*CreateChatCompletionRequest) FromPublic ¶
func (c *CreateChatCompletionRequest) FromPublic(obj any) error
func (*CreateChatCompletionRequest) IDPrefix ¶
func (c *CreateChatCompletionRequest) IDPrefix() string
func (*CreateChatCompletionRequest) ToPublic ¶
func (c *CreateChatCompletionRequest) ToPublic() any
type CreateChatCompletionResponse ¶
type CreateChatCompletionResponse struct { // The following fields are not exposed in the public API JobResponse `json:",inline"` Base `json:",inline"` // The following fields are exposed in the public API Choices datatypes.JSONSlice[Choice] `json:"choices"` Model string `json:"model"` SystemFingerprint *string `json:"system_fingerprint,omitempty"` Usage datatypes.JSONType[*openai.CompletionUsage] `json:"usage,omitempty"` }
func (*CreateChatCompletionResponse) FromPublic ¶
func (c *CreateChatCompletionResponse) FromPublic(obj any) error
func (*CreateChatCompletionResponse) IDPrefix ¶
func (c *CreateChatCompletionResponse) IDPrefix() string
func (*CreateChatCompletionResponse) ToPublic ¶
func (c *CreateChatCompletionResponse) ToPublic() any
type CreateEmbeddingRequest ¶
type CreateEmbeddingRequest struct { // The following fields are not exposed in the public API JobRequest `json:",inline"` ModelAPI string `json:"model_api"` // The following fields are exposed in the public API // Required fields Input datatypes.JSONType[openai.CreateEmbeddingRequest_Input] `json:"input"` Model string `json:"model"` // Optional fields EncodingFormat *string `json:"encoding_format,omitempty"` Dimensions *int `json:"dimensions,omitempty"` User *string `json:"user,omitempty"` }
func (*CreateEmbeddingRequest) FromPublic ¶
func (e *CreateEmbeddingRequest) FromPublic(obj any) error
func (*CreateEmbeddingRequest) IDPrefix ¶
func (e *CreateEmbeddingRequest) IDPrefix() string
func (*CreateEmbeddingRequest) ToPublic ¶
func (e *CreateEmbeddingRequest) ToPublic() any
type CreateEmbeddingResponse ¶
type CreateEmbeddingResponse struct { // The following fields are not exposed in the public API JobResponse `json:",inline"` Base `json:",inline"` // The following fields are exposed in the public API Data datatypes.JSONSlice[Embedding] `json:"data"` Model string `json:"model"` Usage datatypes.JSONType[EmbeddingUsage] `json:"usage,omitempty"` }
func (*CreateEmbeddingResponse) FromPublic ¶
func (e *CreateEmbeddingResponse) FromPublic(obj any) error
func (*CreateEmbeddingResponse) IDPrefix ¶
func (e *CreateEmbeddingResponse) IDPrefix() string
func (*CreateEmbeddingResponse) ToPublic ¶
func (e *CreateEmbeddingResponse) ToPublic() any
type CreateImageEditRequest ¶
type CreateImageEditRequest struct { JobRequest `json:",inline"` Image []byte `json:"image"` Mask []byte `json:"mask"` Model *string `json:"model"` N *int `json:"n"` Prompt string `json:"prompt"` ResponseFormat *string `json:"response_format"` Size *string `json:"size"` User *string `json:"user,omitempty"` }
func (*CreateImageEditRequest) FromPublic ¶
func (c *CreateImageEditRequest) FromPublic(obj any) error
func (*CreateImageEditRequest) IDPrefix ¶
func (*CreateImageEditRequest) IDPrefix() string
func (*CreateImageEditRequest) ToPublic ¶
func (c *CreateImageEditRequest) ToPublic() any
type CreateImageRequest ¶
type CreateImageRequest struct { // The following fields are not exposed in the public API JobRequest `json:",inline"` // The following fields are exposed in the public API Model *string `json:"model"` N *int `json:"n"` Prompt string `json:"prompt"` Quality *string `json:"quality,omitempty"` ResponseFormat *string `json:"response_format"` Size *string `json:"size"` Style *string `json:"style"` User *string `json:"user,omitempty"` }
func (*CreateImageRequest) FromPublic ¶
func (i *CreateImageRequest) FromPublic(obj any) error
func (*CreateImageRequest) IDPrefix ¶
func (*CreateImageRequest) IDPrefix() string
func (*CreateImageRequest) ToPublic ¶
func (i *CreateImageRequest) ToPublic() any
type CreateImageVariationRequest ¶
type CreateImageVariationRequest struct { JobRequest `json:",inline"` Image []byte `json:"image"` Model *string `json:"model"` N *int `json:"n"` ResponseFormat *string `json:"response_format"` Size *string `json:"size"` User *string `json:"user,omitempty"` }
func (*CreateImageVariationRequest) FromPublic ¶
func (c *CreateImageVariationRequest) FromPublic(obj any) error
func (*CreateImageVariationRequest) IDPrefix ¶
func (*CreateImageVariationRequest) IDPrefix() string
func (*CreateImageVariationRequest) ToPublic ¶
func (c *CreateImageVariationRequest) ToPublic() any
type CreateSpeechRequest ¶
type CreateSpeechRequest struct { JobRequest `json:",inline"` Input string `json:"input"` Model datatypes.JSONType[openai.CreateSpeechRequest_Model] `json:"model"` ResponseFormat *string `json:"response_format,omitempty"` Speed *float32 `json:"speed,omitempty"` Voice string `json:"voice"` }
func (*CreateSpeechRequest) FromPublic ¶
func (s *CreateSpeechRequest) FromPublic(obj any) error
func (*CreateSpeechRequest) IDPrefix ¶
func (s *CreateSpeechRequest) IDPrefix() string
func (*CreateSpeechRequest) ToPublic ¶
func (s *CreateSpeechRequest) ToPublic() any
type CreateSpeechResponse ¶
type CreateSpeechResponse struct { JobResponse `json:",inline"` Base `json:",inline"` Content []byte `json:"content"` }
func (*CreateSpeechResponse) FromPublic ¶
func (c *CreateSpeechResponse) FromPublic(obj any) error
func (*CreateSpeechResponse) IDPrefix ¶
func (*CreateSpeechResponse) IDPrefix() string
func (*CreateSpeechResponse) ToPublic ¶
func (c *CreateSpeechResponse) ToPublic() any
type CreateTranscriptionRequest ¶
type CreateTranscriptionRequest struct { JobRequest `json:",inline"` FileName string `json:"file_name"` File []byte `json:"file"` Language *string `json:"language,omitempty"` Model string `json:"model"` Prompt *string `json:"prompt,omitempty"` ResponseFormat *string `json:"response_format,omitempty"` Temperature *float32 `json:"temperature,omitempty"` TimestampGranularities datatypes.JSONSlice[string] `json:"timestamp_granularities,omitempty"` }
func (*CreateTranscriptionRequest) FromPublic ¶
func (c *CreateTranscriptionRequest) FromPublic(obj any) error
func (*CreateTranscriptionRequest) IDPrefix ¶
func (*CreateTranscriptionRequest) IDPrefix() string
func (*CreateTranscriptionRequest) ToPublic ¶
func (c *CreateTranscriptionRequest) ToPublic() any
type CreateTranscriptionResponse ¶
type CreateTranscriptionResponse struct { // The following fields are not exposed in the public API JobResponse `json:",inline"` // The following fields are exposed in the public API Base `json:",inline"` Text string }
func (*CreateTranscriptionResponse) FromPublic ¶
func (c *CreateTranscriptionResponse) FromPublic(obj any) error
func (*CreateTranscriptionResponse) IDPrefix ¶
func (*CreateTranscriptionResponse) IDPrefix() string
func (*CreateTranscriptionResponse) ToPublic ¶
func (c *CreateTranscriptionResponse) ToPublic() any
type CreateTranslationRequest ¶
type CreateTranslationRequest struct { JobRequest `json:",inline"` FileName string `json:"file_name"` File []byte `json:"file"` Model string `json:"model"` Prompt *string `json:"prompt,omitempty"` ResponseFormat *string `json:"response_format,omitempty"` Temperature *float32 `json:"temperature,omitempty"` }
func (*CreateTranslationRequest) FromPublic ¶
func (c *CreateTranslationRequest) FromPublic(obj any) error
func (*CreateTranslationRequest) IDPrefix ¶
func (*CreateTranslationRequest) IDPrefix() string
func (*CreateTranslationRequest) ToPublic ¶
func (c *CreateTranslationRequest) ToPublic() any
type CreateTranslationResponse ¶
type CreateTranslationResponse struct { // The following fields are not exposed in the public API JobResponse `json:",inline"` // The following fields are exposed in the public API Base `json:",inline"` Text string }
func (*CreateTranslationResponse) FromPublic ¶
func (c *CreateTranslationResponse) FromPublic(obj any) error
func (*CreateTranslationResponse) IDPrefix ¶
func (*CreateTranslationResponse) IDPrefix() string
func (*CreateTranslationResponse) ToPublic ¶
func (c *CreateTranslationResponse) ToPublic() any
type Embedding ¶
type Embedding struct { Index int `json:"index"` Embedding datatypes.JSONType[openai.Embedding_Embedding] `json:"embedding"` }
type EmbeddingUsage ¶
type EmbeddingUsage struct { PromptTokens int `json:"prompt_tokens"` TotalTokens int `json:"total_tokens"` }
EmbeddingUsage represents the inline CreateEmbeddingResponse.Usage struct which is not generated as a separate type
type File ¶
type File struct { Base Content []byte `json:"file"` Purpose string `json:"purpose"` Filename string `json:"filename"` }
func (*File) FromPublic ¶
type FineTuningJob ¶
type FineTuningJob struct { Base `json:",inline"` Error datatypes.JSONType[FineTuningJobError] `json:"error"` FineTunedModel *string `json:"fine_tuned_model"` FinishedAt *int `json:"finished_at"` Hyperparameters datatypes.JSONType[FineTuningJobHyperParameters] `json:"hyperparameters"` Model string `json:"model"` OrganizationID string `json:"organization_id"` ResultFiles datatypes.JSONSlice[string] `json:"result_files"` Status string `json:"status"` TrainedTokens *int `json:"trained_tokens"` TrainingFile string `json:"training_file"` ValidationFile *string `json:"validation_file"` }
func (*FineTuningJob) FromPublic ¶
func (f *FineTuningJob) FromPublic(obj any) error
func (*FineTuningJob) IDPrefix ¶
func (f *FineTuningJob) IDPrefix() string
func (*FineTuningJob) ToPublic ¶
func (f *FineTuningJob) ToPublic() any
type FineTuningJobError ¶
type FineTuningJobHyperParameters ¶
type FineTuningJobHyperParameters struct {
NEpochs datatypes.JSONType[openai.FineTuningJob_Hyperparameters_NEpochs] `json:"n_epochs"`
}
type GenericToolCallInfo ¶
func GetOutputForRunStepToolCall ¶
func GetOutputForRunStepToolCall(item *openai.RunStepDetailsToolCallsObject_ToolCalls_Item) (GenericToolCallInfo, error)
type ImagesResponse ¶
type ImagesResponse struct { // The following fields are not exposed in the public API JobResponse `json:",inline"` // The following fields are exposed in the public API Base `json:",inline"` Data datatypes.JSONSlice[openai.Image] `json:"data"` }
func (*ImagesResponse) FromPublic ¶
func (i *ImagesResponse) FromPublic(obj any) error
func (*ImagesResponse) IDPrefix ¶
func (*ImagesResponse) IDPrefix() string
func (*ImagesResponse) ToPublic ¶
func (i *ImagesResponse) ToPublic() any
type InvalidTypeError ¶
type InvalidTypeError struct {
Expected, Got any
}
func (InvalidTypeError) Error ¶
func (e InvalidTypeError) Error() string
type JobRequest ¶
type JobRequest struct { Base `json:",inline"` ClaimedBy *string `json:"claimed_by,omitempty"` Done bool `json:"done"` }
func (JobRequest) IsDone ¶
func (j JobRequest) IsDone() bool
type JobResponse ¶
type JobResponse struct { RequestID string `json:"request_id"` Error *string `json:"error"` StatusCode int `json:"status_code"` Done bool `json:"done"` }
func (JobResponse) GetErrorString ¶
func (j JobResponse) GetErrorString() string
func (JobResponse) GetRequestID ¶
func (j JobResponse) GetRequestID() string
func (JobResponse) GetStatusCode ¶
func (j JobResponse) GetStatusCode() int
func (JobResponse) IsDone ¶
func (j JobResponse) IsDone() bool
type Lobprob ¶
type Lobprob struct {
Content []openai.ChatCompletionTokenLogprob `json:"content"`
}
type Message ¶
type Message struct { Metadata `json:",inline"` Role string `json:"role"` Content datatypes.JSONSlice[openai.MessageObject_Content_Item] `json:"content"` AssistantID *string `json:"assistant_id,omitempty"` ThreadID string `json:"thread_id,omitempty"` RunID *string `json:"run_id,omitempty"` FileIDs datatypes.JSONSlice[string] `json:"file_ids,omitempty"` Status string `json:"status,omitempty"` CompletedAt *int `json:"completed_at,omitempty"` IncompleteAt *int `json:"incomplete_at,omitempty"` IncompleteDetails datatypes.JSONType[*struct { Reason openai.MessageObjectIncompleteDetailsReason `json:"reason"` }] `json:"incomplete_details,omitempty"` }
func (*Message) FromPublic ¶
func (*Message) WithTextContent ¶
type MessageDelta ¶
type MessageDelta struct { ID string `json:"id"` Delta datatypes.JSONType[MessageDeltaDelta] `json:"delta"` }
func NewMessageDeltaWithText ¶
func NewMessageDeltaWithText(index int, id, text string) (*MessageDelta, error)
func (*MessageDelta) FromPublic ¶
func (m *MessageDelta) FromPublic(obj any) error
func (*MessageDelta) ToPublic ¶
func (m *MessageDelta) ToPublic() any
type MessageDeltaContentTextObjectText ¶
type MessageDeltaContentTextObjectText struct { Annotations *[]openai.MessageDeltaContentTextObject_Text_Annotations_Item `json:"annotations,omitempty"` Value *string `json:"value,omitempty"` }
type MessageDeltaDelta ¶
type MessageDeltaDelta struct { Content *[]openai.MessageDeltaObject_Delta_Content_Item `json:"content,omitempty"` // Keeping this field as FileIds makes the casting to the openai types much easier. //nolint:revive FileIds *[]string `json:"file_ids,omitempty"` Role *openai.MessageDeltaObjectDeltaRole `json:"role,omitempty"` }
type MessageFile ¶
func (*MessageFile) FromPublic ¶
func (m *MessageFile) FromPublic(obj any) error
func (*MessageFile) IDPrefix ¶
func (m *MessageFile) IDPrefix() string
func (*MessageFile) ToPublic ¶
func (m *MessageFile) ToPublic() any
type Model ¶
func (*Model) FromPublic ¶
type Run ¶
type Run struct { Metadata `json:",inline"` AssistantID string `json:"assistant_id"` ThreadID string `json:"thread_id"` Status string `json:"status"` RequiredAction datatypes.JSONType[*RunRequiredAction] `json:"required_action"` LastError datatypes.JSONType[*RunLastError] `json:"last_error"` ExpiresAt *int `json:"expires_at,omitempty"` StartedAt *int `json:"started_at,omitempty"` CancelledAt *int `json:"cancelled_at,omitempty"` CompletedAt *int `json:"completed_at,omitempty"` FailedAt *int `json:"failed_at,omitempty"` Model string `json:"model"` Instructions string `json:"instructions,omitempty"` Tools datatypes.JSONSlice[openai.RunObject_Tools_Item] `json:"tools"` FileIDs datatypes.JSONSlice[string] `json:"file_ids,omitempty"` Usage datatypes.JSONType[*openai.RunCompletionUsage] `json:"usage"` // These are not part of the public API ClaimedBy *string `json:"claimed_by,omitempty"` SystemClaimedBy *string `json:"system_claimed_by,omitempty"` SystemStatus *string `json:"system_status,omitempty"` EventIndex int `json:"event_index,omitempty"` }
func CancelRun ¶
CancelRun cancels a run that is in progress. If the run is not in progress, it will return an error.
func (*Run) FromPublic ¶
type RunEvent ¶
type RunEvent struct { JobResponse `json:",inline"` Base `json:",inline"` EventName string `json:"event_name"` Run datatypes.JSONType[*Run] `json:"run,omitempty"` Thread datatypes.JSONType[*Thread] `json:"thread,omitempty"` RunStep datatypes.JSONType[*RunStep] `json:"run_step,omitempty"` RunStepDelta datatypes.JSONType[*RunStepDelta] `json:"run_step_delta,omitempty"` Message datatypes.JSONType[*Message] `json:"message,omitempty"` MessageDelta datatypes.JSONType[*MessageDelta] `json:"message_delta,omitempty"` ResponseIdx int `json:"response_idx"` }
func (*RunEvent) FromPublic ¶
type RunLastError ¶
type RunRequiredAction ¶
type RunRequiredAction struct { SubmitToolOutputs []openai.RunToolCallObject `json:"submit_tool_outputs"` XConfirm *RunRequiredActionXConfirm `json:"x-confirm"` Type openai.RunObjectRequiredActionType `json:"type"` }
type RunStep ¶
type RunStep struct { Metadata `json:",inline"` AssistantID string `json:"assistant_id"` CancelledAt *int `json:"cancelled_at"` CompletedAt *int `json:"completed_at"` ExpiredAt *int `json:"expired_at"` FailedAt *int `json:"failed_at"` LastError datatypes.JSONType[RunLastError] `json:"last_error"` RunID string `json:"run_id"` Status string `json:"status"` StepDetails datatypes.JSONType[openai.RunStepObject_StepDetails] `json:"step_details"` ThreadID string `json:"thread_id"` Type string `json:"type"` Usage datatypes.JSONType[*openai.RunStepCompletionUsage] `json:"usage"` // These are not part of the public API ClaimedBy *string `json:"claimed_by,omitempty"` RunnerType *string `json:"runner_type,omitempty"` RetrievalArguments string `json:"retrieval_arguments,omitempty"` }
func (*RunStep) FromPublic ¶
func (*RunStep) GetRunStepFunctionCalls ¶
func (r *RunStep) GetRunStepFunctionCalls() ([]openai.RunStepDetailsToolCallsFunctionObject, error)
func (*RunStep) Merge ¶
func (r *RunStep) Merge(toolCalls *[]GenericToolCallInfo, chunk ChatCompletionResponseChunk) (*RunStepDelta, error)
Merge will merge the given chunk into the current run step.
type RunStepDelta ¶
type RunStepDelta struct { ID string `json:"id"` Delta datatypes.JSONType[RunStepDeltaDelta] `json:"delta"` }
func (*RunStepDelta) FromPublic ¶
func (r *RunStepDelta) FromPublic(obj any) error
func (*RunStepDelta) ToPublic ¶
func (r *RunStepDelta) ToPublic() any
type RunStepDeltaDelta ¶
type RunStepDeltaDelta struct {
StepDetails *openai.RunStepDeltaObject_Delta_StepDetails `json:"step_details,omitempty"`
}
type RunStepEvent ¶
type RunStepEvent struct { Base `json:",inline"` JobResponse `json:",inline"` CallContext datatypes.JSONMap `json:"call_context,omitempty"` ToolSubCalls datatypes.JSONMap `json:"tool_sub_calls,omitempty"` ToolResults int `json:"tool_results,omitempty"` Type string `json:"type,omitempty"` ChatCompletionID string `json:"chat_completion_id,omitempty"` ChatRequest datatypes.JSONType[any] `json:"chat_request,omitempty"` ChatResponse datatypes.JSONType[any] `json:"chat_response,omitempty"` ChatResponseCached bool `json:"chat_response_cached,omitempty"` Content string `json:"content,omitempty"` RunID string `json:"run_id,omitempty"` Input string `json:"input,omitempty"` Output string `json:"output,omitempty"` Err string `json:"err,omitempty"` ResponseIdx int `json:"response_idx"` }
func FromGPTScriptEvent ¶
func (*RunStepEvent) FromPublic ¶
func (r *RunStepEvent) FromPublic(obj any) error
func (*RunStepEvent) GetEvent ¶
func (r *RunStepEvent) GetEvent() string
func (*RunStepEvent) GetIndex ¶
func (r *RunStepEvent) GetIndex() int
func (*RunStepEvent) IDPrefix ¶
func (r *RunStepEvent) IDPrefix() string
func (*RunStepEvent) ToPublic ¶
func (r *RunStepEvent) ToPublic() any
type RunToolObject ¶
type RunToolObject struct { JobRequest EnvVars datatypes.JSONSlice[string] `json:"env_vars,omitempty"` File string `json:"file"` Input string `json:"input,omitempty"` Subtool string `json:"subtool"` Chdir string `json:"chdir,omitempty"` DisableCache bool `json:"disable_cache,omitempty"` DangerousMode bool `json:"dangerous_mode,omitempty"` Output string `json:"output,omitempty"` Status string `json:"status,omitempty"` Confirmed *bool `json:"confirmed,omitempty"` }
func (*RunToolObject) FromPublic ¶
func (r *RunToolObject) FromPublic(obj any) error
func (*RunToolObject) IDPrefix ¶
func (r *RunToolObject) IDPrefix() string
func (*RunToolObject) ToPublic ¶
func (r *RunToolObject) ToPublic() any
type Thread ¶
type Thread struct { Metadata `json:",inline"` // This is not part of the public API LockedByRunID string `json:"locked_by_run_id"` }
func (*Thread) FromPublic ¶
func (*Thread) GetThreadID ¶
func (*Thread) SetThreadID ¶
type Tool ¶
type Tool struct { Base `json:",inline"` Name string `json:"name"` Description string `json:"description"` Contents *string `json:"contents"` URL *string `json:"url"` Subtool *string `json:"subtool"` EnvVars datatypes.JSONSlice[string] `json:"env_vars"` // Not part of the public API Program datatypes.JSON `json:"program"` }
func (*Tool) FromPublic ¶
Source Files
¶
- assistant.go
- assistantfile.go
- chatcompletionchunk.go
- common.go
- createchatcompletionrequest.go
- createchatcompletionresponse.go
- createembeddingrequest.go
- createimageeditrequest.go
- createimagerequest.go
- createimagevariationrequest.go
- createspeechrequest.go
- createspeechresponse.go
- createtranscriptionrequest.go
- createtranscriptionresponse.go
- createtranslationrequest.go
- createtranslationresponse.go
- db.go
- embeddingsresponse.go
- error.go
- file.go
- finetuningjob.go
- imageresponse.go
- message.go
- messagedelta.go
- model.go
- ops.go
- run.go
- runevent.go
- runstep.go
- runstepdelta.go
- runstepevent.go
- runtool.go
- thread.go
- tool.go
- util.go