llmgleam/client

Types

pub opaque type Client
pub type Provider {
  Gemini
  GPT
  Claude
}

Constructors

  • Gemini
  • GPT
  • Claude
pub opaque type Request

Values

pub fn completion(
  request: Request,
  model: String,
) -> Result(types.Completion, types.CompletionError)
pub fn continue_from(
  request: Request,
  completion: types.Completion,
) -> Result(Request, types.CompletionError)

Continues a tool-calling exchange from an earlier completion.

Tools and system instructions are retained. GPT continues by response ID; Claude and Gemini retain tool calls and their corresponding results.

pub fn new_client(provider: Provider, api_key: String) -> Client
pub fn request(c: Client) -> Request
pub fn with_message(
  request: Request,
  message: types.ChatMessage,
) -> Request
pub fn with_messages(
  request: Request,
  messages: List(types.ChatMessage),
) -> Request
pub fn with_system_instruction(
  request: Request,
  system_instruction: String,
) -> Request
pub fn with_tool(request: Request, tool: types.Tool) -> Request

Adds a function tool that GPT may call.

Tool calling is supported by the GPT, Claude, and Gemini clients.

pub fn with_tool_output(
  request: Request,
  output: types.ToolOutput,
) -> Request

Adds the result of executing a tool call.

pub fn with_tool_outputs(
  request: Request,
  outputs: List(types.ToolOutput),
) -> Request

Adds the results of executing multiple tool calls.

pub fn with_tools(
  request: Request,
  tools: List(types.Tool),
) -> Request

Adds function tools that GPT may call.

✨ Search Document