Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) CreateResponse(req CreateResponseRequest) (*OpenAIResponse, error)
- func (c *Client) DeleteFile(fileID string) error
- func (c *Client) GetUsage(path string, params url.Values) ([]UsageBucket, error)
- func (c *Client) ListModels() ([]Model, error)
- func (c *Client) UploadFile(content io.Reader, filename, purpose, contentType string) (string, error)
- func (c *Client) Verify() error
- func (c *Client) VerifyAdmin() error
- type Configuration
- type CreateResponse
- func (c *CreateResponse) Cancel(ctx core.ExecutionContext) error
- func (c *CreateResponse) Cleanup(ctx core.SetupContext) error
- func (c *CreateResponse) Color() string
- func (c *CreateResponse) Configuration() []configuration.Field
- func (c *CreateResponse) Description() string
- func (c *CreateResponse) Documentation() string
- func (c *CreateResponse) ExampleOutput() map[string]any
- func (c *CreateResponse) Execute(ctx core.ExecutionContext) error
- func (c *CreateResponse) HandleHook(ctx core.ActionHookContext) error
- func (c *CreateResponse) HandleWebhook(ctx core.WebhookRequestContext) (int, *core.WebhookResponseBody, error)
- func (c *CreateResponse) Hooks() []core.Hook
- func (c *CreateResponse) Icon() string
- func (c *CreateResponse) Label() string
- func (c *CreateResponse) Name() string
- func (c *CreateResponse) OutputChannels(configuration any) []core.OutputChannel
- func (c *CreateResponse) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
- func (c *CreateResponse) Setup(ctx core.SetupContext) error
- type CreateResponseRequest
- type CreateResponseSpec
- type GetUsage
- func (c *GetUsage) Cancel(ctx core.ExecutionContext) error
- func (c *GetUsage) Cleanup(ctx core.SetupContext) error
- func (c *GetUsage) Color() string
- func (c *GetUsage) Configuration() []configuration.Field
- func (c *GetUsage) Description() string
- func (c *GetUsage) Documentation() string
- func (c *GetUsage) ExampleOutput() map[string]any
- func (c *GetUsage) Execute(ctx core.ExecutionContext) error
- func (c *GetUsage) HandleHook(ctx core.ActionHookContext) error
- func (c *GetUsage) HandleWebhook(ctx core.WebhookRequestContext) (int, *core.WebhookResponseBody, error)
- func (c *GetUsage) Hooks() []core.Hook
- func (c *GetUsage) Icon() string
- func (c *GetUsage) Label() string
- func (c *GetUsage) Name() string
- func (c *GetUsage) OutputChannels(config any) []core.OutputChannel
- func (c *GetUsage) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
- func (c *GetUsage) Setup(ctx core.SetupContext) error
- type GetUsageOutput
- type GetUsageSpec
- type InputMessage
- type InputPart
- type Model
- type ModelsResponse
- type OpenAI
- func (o *OpenAI) Actions() []core.Action
- func (o *OpenAI) Cleanup(ctx core.IntegrationCleanupContext) error
- func (o *OpenAI) Configuration() []configuration.Field
- func (o *OpenAI) Description() string
- func (o *OpenAI) HandleHook(ctx core.IntegrationHookContext) error
- func (o *OpenAI) HandleRequest(ctx core.HTTPRequestContext)
- func (o *OpenAI) Hooks() []core.Hook
- func (o *OpenAI) Icon() string
- func (o *OpenAI) Instructions() string
- func (o *OpenAI) Label() string
- func (o *OpenAI) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)
- func (o *OpenAI) Name() string
- func (o *OpenAI) Sync(ctx core.SyncContext) error
- func (o *OpenAI) Triggers() []core.Trigger
- type OpenAIResponse
- type ResponseContent
- type ResponseFormat
- type ResponseNodeMetadata
- type ResponseOutput
- type ResponsePayload
- type ResponseTextConfig
- type ResponseUsage
- type UsageBucket
- type UsagePage
Constants ¶
const (
GetUsagePayloadType = "openai.getUsage.result"
)
const ResponsePayloadType = "openai.response"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
APIKey string
AdminKey string
BaseURL string
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(httpClient core.HTTPContext, ctx core.IntegrationContext) (*Client, error)
func (*Client) CreateResponse ¶
func (c *Client) CreateResponse(req CreateResponseRequest) (*OpenAIResponse, error)
func (*Client) DeleteFile ¶ added in v0.28.0
DeleteFile removes an uploaded file. Best-effort cleanup; no-op for empty IDs.
func (*Client) GetUsage ¶ added in v0.28.0
GetUsage fetches all buckets for an org Usage/Costs API path (e.g. "/organization/usage/completions"), following the next_page cursor. Requires the admin API key. Organization usage endpoints only exist on the OpenAI platform API, so requests always target the default base URL even when a custom baseURL is configured for model endpoints.
func (*Client) ListModels ¶
func (*Client) UploadFile ¶ added in v0.28.0
func (c *Client) UploadFile(content io.Reader, filename, purpose, contentType string) (string, error)
UploadFile uploads a file to the OpenAI Files API with the given purpose ("vision" for images, "user_data" for documents) and returns its file id.
func (*Client) VerifyAdmin ¶ added in v0.28.0
VerifyAdmin checks the admin API key by requesting a single usage bucket.
type Configuration ¶
type CreateResponse ¶
type CreateResponse struct{}
func (*CreateResponse) Cancel ¶
func (c *CreateResponse) Cancel(ctx core.ExecutionContext) error
func (*CreateResponse) Cleanup ¶ added in v0.7.0
func (c *CreateResponse) Cleanup(ctx core.SetupContext) error
func (*CreateResponse) Color ¶
func (c *CreateResponse) Color() string
func (*CreateResponse) Configuration ¶
func (c *CreateResponse) Configuration() []configuration.Field
func (*CreateResponse) Description ¶
func (c *CreateResponse) Description() string
func (*CreateResponse) Documentation ¶
func (c *CreateResponse) Documentation() string
func (*CreateResponse) ExampleOutput ¶
func (c *CreateResponse) ExampleOutput() map[string]any
func (*CreateResponse) Execute ¶
func (c *CreateResponse) Execute(ctx core.ExecutionContext) error
func (*CreateResponse) HandleHook ¶ added in v0.18.0
func (c *CreateResponse) HandleHook(ctx core.ActionHookContext) error
func (*CreateResponse) HandleWebhook ¶
func (c *CreateResponse) HandleWebhook(ctx core.WebhookRequestContext) (int, *core.WebhookResponseBody, error)
func (*CreateResponse) Hooks ¶ added in v0.18.0
func (c *CreateResponse) Hooks() []core.Hook
func (*CreateResponse) Icon ¶
func (c *CreateResponse) Icon() string
func (*CreateResponse) Label ¶
func (c *CreateResponse) Label() string
func (*CreateResponse) Name ¶
func (c *CreateResponse) Name() string
func (*CreateResponse) OutputChannels ¶
func (c *CreateResponse) OutputChannels(configuration any) []core.OutputChannel
func (*CreateResponse) ProcessQueueItem ¶
func (c *CreateResponse) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
func (*CreateResponse) Setup ¶
func (c *CreateResponse) Setup(ctx core.SetupContext) error
type CreateResponseRequest ¶
type CreateResponseRequest struct {
Model string `json:"model"`
Input any `json:"input"`
Text *ResponseTextConfig `json:"text,omitempty"`
}
CreateResponseRequest is the Responses API request. Input is a plain string for text-only prompts, or []InputMessage when attaching files/images.
type CreateResponseSpec ¶
type GetUsage ¶ added in v0.28.0
type GetUsage struct{}
func (*GetUsage) Cancel ¶ added in v0.28.0
func (c *GetUsage) Cancel(ctx core.ExecutionContext) error
func (*GetUsage) Configuration ¶ added in v0.28.0
func (c *GetUsage) Configuration() []configuration.Field
func (*GetUsage) Description ¶ added in v0.28.0
func (*GetUsage) Documentation ¶ added in v0.28.0
func (*GetUsage) ExampleOutput ¶ added in v0.28.0
func (*GetUsage) Execute ¶ added in v0.28.0
func (c *GetUsage) Execute(ctx core.ExecutionContext) error
func (*GetUsage) HandleHook ¶ added in v0.28.0
func (c *GetUsage) HandleHook(ctx core.ActionHookContext) error
func (*GetUsage) HandleWebhook ¶ added in v0.28.0
func (c *GetUsage) HandleWebhook(ctx core.WebhookRequestContext) (int, *core.WebhookResponseBody, error)
func (*GetUsage) OutputChannels ¶ added in v0.28.0
func (c *GetUsage) OutputChannels(config any) []core.OutputChannel
func (*GetUsage) ProcessQueueItem ¶ added in v0.28.0
type GetUsageOutput ¶ added in v0.28.0
type GetUsageSpec ¶ added in v0.28.0
type InputMessage ¶ added in v0.28.0
InputMessage is a role + content-parts entry in the Responses API input array.
type InputPart ¶ added in v0.28.0
type InputPart struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
FileID string `json:"file_id,omitempty"`
}
InputPart is a content part: input_text, input_image, or input_file.
type ModelsResponse ¶
type ModelsResponse struct {
Data []Model `json:"data"`
}
type OpenAI ¶
type OpenAI struct{}
func (*OpenAI) Cleanup ¶ added in v0.6.0
func (o *OpenAI) Cleanup(ctx core.IntegrationCleanupContext) error
func (*OpenAI) Configuration ¶
func (o *OpenAI) Configuration() []configuration.Field
func (*OpenAI) Description ¶
func (*OpenAI) HandleHook ¶ added in v0.18.0
func (o *OpenAI) HandleHook(ctx core.IntegrationHookContext) error
func (*OpenAI) HandleRequest ¶
func (o *OpenAI) HandleRequest(ctx core.HTTPRequestContext)
func (*OpenAI) Instructions ¶
func (*OpenAI) ListResources ¶
func (o *OpenAI) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)
type OpenAIResponse ¶
type OpenAIResponse struct {
ID string `json:"id"`
Model string `json:"model"`
OutputText string `json:"output_text"`
Output []ResponseOutput `json:"output"`
Usage *ResponseUsage `json:"usage,omitempty"`
}
type ResponseContent ¶
type ResponseFormat ¶ added in v0.28.0
type ResponseFormat struct {
Type string `json:"type"` // "json_schema"
Name string `json:"name"` // required by the Responses API
Schema any `json:"schema"` // the JSON Schema object
Strict bool `json:"strict,omitempty"` // enforce exact schema conformance
}
ResponseFormat constrains the response to a JSON schema (Responses API: text.format).
type ResponseNodeMetadata ¶ added in v0.28.0
type ResponseNodeMetadata struct {
Model string `json:"model" mapstructure:"model"`
StructuredOutput bool `json:"structuredOutput" mapstructure:"structuredOutput"`
}
ResponseNodeMetadata is node-level metadata surfaced in the UI so the configured model and options are visible on the node without opening it.
type ResponseOutput ¶
type ResponseOutput struct {
Type string `json:"type"`
Role string `json:"role"`
Content []ResponseContent `json:"content"`
}
type ResponsePayload ¶
type ResponsePayload struct {
ID string `json:"id"`
Model string `json:"model"`
Text string `json:"text"`
Parsed any `json:"parsed,omitempty"`
Usage *ResponseUsage `json:"usage,omitempty"`
Response *OpenAIResponse `json:"response"`
}
type ResponseTextConfig ¶ added in v0.28.0
type ResponseTextConfig struct {
Format *ResponseFormat `json:"format,omitempty"`
}
ResponseTextConfig carries the structured-output format for the Responses API.
type ResponseUsage ¶
type UsageBucket ¶ added in v0.28.0
type UsageBucket struct {
Object string `json:"object"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
Results []map[string]any `json:"results"`
}
UsageBucket is a time bucket of usage results. Results are kept generic because each usage category returns different metric fields.