Documentation
¶
Index ¶
- Constants
- func AIClientFromObject(obj object.Object) mcpai.Client
- func GetChatStreamClass() *object.Class
- func GetOpenAIClientClass() *object.Class
- func GetPipelineClass() *object.Class
- func GetResponseStreamClass() *object.Class
- func MaxParallelLimit() int
- func Register(registrar interface{ ... }, cfg ...*netsecurity.Config)
- func SetMaxParallelLimit(n int)
- func WrapClient(c ai.Client) object.Object
- type ChatStreamInstance
- type ClientInstance
- type PipelineInstance
- type ResponseStreamInstance
Constants ¶
const ( AILibraryName = "scriptling.ai" AILibraryDesc = "AI and LLM functions for interacting with multiple AI provider APIs" )
Variables ¶
This section is empty.
Functions ¶
func AIClientFromObject ¶ added in v0.2.23
AIClientFromObject extracts the underlying ai.Client from a Scriptling object.Instance created by ai.Client(...). Returns nil if the object is not a valid AI client instance.
func GetChatStreamClass ¶
func GetOpenAIClientClass ¶
GetOpenAIClientClass returns the OpenAI Client class (thread-safe singleton)
func GetPipelineClass ¶ added in v0.9.0
GetPipelineClass returns the Pipeline class singleton.
func GetResponseStreamClass ¶ added in v0.2.0
GetResponseStreamClass returns the ResponseStream class (thread-safe singleton)
func MaxParallelLimit ¶ added in v0.27.3
func MaxParallelLimit() int
MaxParallelLimit returns the current ceiling on max_parallel, 0 when none.
func Register ¶
func Register(registrar interface{ RegisterLibrary(*object.Library) }, cfg ...*netsecurity.Config)
Register registers the ai library with the given registrar. cfg is an optional outbound network policy: when provided (non-nil), every client created via ai.Client() — including its remote MCP servers — is restricted to it (an invalid policy fails closed rather than falling back to unrestricted access). Omitting cfg preserves the previous, unrestricted behaviour.
First call with no cfg builds and caches the unrestricted library; subsequent calls just register it. A call with cfg always builds a fresh, guard-bound library.
func SetMaxParallelLimit ¶ added in v0.27.3
func SetMaxParallelLimit(n int)
SetMaxParallelLimit caps the max_parallel a script may request from client.Pipeline, client.completion_parallel and client.ask_parallel. A script asking for more than the ceiling silently gets the ceiling; it is a resource policy for the host, not an error for the script. A limit of 0 removes the ceiling; negative values are treated as 0. The check is one atomic load when a pipeline is created, so it costs nothing per request.
Types ¶
type ChatStreamInstance ¶
type ChatStreamInstance struct {
// contains filtered or unexported fields
}
ChatStreamInstance wraps an AI chat stream for use in scriptling
type ClientInstance ¶
type ClientInstance struct {
// contains filtered or unexported fields
}
ClientInstance wraps an AI client for use in scriptling
type PipelineInstance ¶ added in v0.9.0
type PipelineInstance struct {
// contains filtered or unexported fields
}
PipelineInstance holds the state for a running pipeline. Workers are started immediately at construction and drain the queue until it is closed by flush() / complete().
type ResponseStreamInstance ¶ added in v0.2.0
type ResponseStreamInstance struct {
// contains filtered or unexported fields
}
ResponseStreamInstance wraps an AI response stream for use in scriptling