Documentation
¶
Overview ¶
Package datacircle gives go-openai four function tools on Datacircle's open API: find the best GTM APIs.
The API needs no key: https://api.datacircle.dev/v1 (its spec: https://api.datacircle.dev/v1/openapi.json). More at https://datacircle.dev
Index ¶
- Constants
- Variables
- type BestPlansInput
- type Config
- type Count
- type ListAPIsInput
- type ProviderInput
- type SearchPlansInput
- type Toolset
- func (t *Toolset) Call(ctx context.Context, call openai.ToolCall) (openai.ChatCompletionMessage, bool)
- func (t *Toolset) Functions() []openai.FunctionDefinition
- func (t *Toolset) Handles(name string) bool
- func (t *Toolset) Outputs(ctx context.Context, output []any) []any
- func (t *Toolset) Run(ctx context.Context, name, arguments string) (string, error)
- func (t *Toolset) Tools() []openai.Tool
Constants ¶
const ( ListAPIsName = "datacircle_list_apis" BestPlansName = "datacircle_best_plans" SearchPlansName = "datacircle_search_plans" ProviderName = "datacircle_provider" )
const BaseURL = "https://api.datacircle.dev/v1"
BaseURL is the API's address.
const Version = "0.1.1"
Version is this module's version, sent in each call's User-Agent.
Variables ¶
var Names = []string{ListAPIsName, BestPlansName, SearchPlansName, ProviderName}
Names are the four tools' names, in the order Tools and Functions give them.
Functions ¶
This section is empty.
Types ¶
type BestPlansInput ¶
BestPlansInput is datacircle_best_plans' input.
type Config ¶
Config sets where the tools call. Its zero value, or nil, calls BaseURL with http.DefaultClient.
type Count ¶
type Count int
Count is a whole number a model may send as a number, as text ("3") or as null, which is 0: left out.
func (*Count) UnmarshalJSON ¶
type ListAPIsInput ¶
type ListAPIsInput struct {
Query string `json:"query,omitempty"`
Limit Count `json:"limit,omitempty"`
}
ListAPIsInput is datacircle_list_apis' input.
type ProviderInput ¶
ProviderInput is datacircle_provider's input.
type SearchPlansInput ¶
type SearchPlansInput struct {
API string `json:"api,omitempty"`
Query string `json:"query,omitempty"`
Sort string `json:"sort,omitempty"`
Limit Count `json:"limit,omitempty"`
Offset Count `json:"offset,omitempty"`
}
SearchPlansInput is datacircle_search_plans' input.
type Toolset ¶
type Toolset struct {
// contains filtered or unexported fields
}
Toolset runs the four tools: datacircle_list_apis, datacircle_best_plans, datacircle_search_plans and datacircle_provider. Its methods are safe to call from many goroutines.
func New ¶
New gives the four tools, calling where cfg says: nil calls BaseURL with http.DefaultClient.
func (*Toolset) Call ¶
func (t *Toolset) Call(ctx context.Context, call openai.ToolCall) (openai.ChatCompletionMessage, bool)
Call runs a tool call of an assistant message, one of its ToolCalls, into the tool message that answers it: its result as JSON, or {"error": ...} with the API's words or the failure's, which the model reads and can call again on. Its false is a call of none of the four tools, for the app to run.
func (*Toolset) Functions ¶
func (t *Toolset) Functions() []openai.FunctionDefinition
Functions gives the four tools' function definitions: each one's name, description and parameters (a JSON schema). For the Responses API (go-openai v1.42.0 and later), openai.NewResponseFunctionTool makes each one a tool.
func (*Toolset) Outputs ¶
Outputs runs the function calls of a Responses API response, its Output, that call the four tools, and gives the function_call_output item of each, for the next request's Input. An item of another kind, or a call of another function, gives none: the app runs it.