llmgleam/types

Types

pub type ChatMessage {
  ChatMessage(content: String, role: Role)
}

Constructors

  • ChatMessage(content: String, role: Role)

A model response containing text, tool calls, or both.

pub type Completion {
  Completion(
    content: option.Option(String),
    tool_calls: List(ToolCall),
    response_id: option.Option(String),
  )
}

Constructors

pub type CompletionError {
  HttpError(String)
  JsonError(String)
  ApiError(String)
}

Constructors

  • HttpError(String)
  • JsonError(String)
  • ApiError(String)
pub type Role {
  User
  Assistant
}

Constructors

  • User
  • Assistant

A function tool that can be called by a model.

pub type Tool {
  Tool(
    name: String,
    description: String,
    parameters: schema.Parameters,
    strict: Bool,
  )
}

Constructors

  • Tool(
      name: String,
      description: String,
      parameters: schema.Parameters,
      strict: Bool,
    )
pub type ToolCall {
  ToolCall(
    id: String,
    call_id: String,
    name: String,
    arguments: String,
    thought_signature: option.Option(String),
  )
}

Constructors

  • ToolCall(
      id: String,
      call_id: String,
      name: String,
      arguments: String,
      thought_signature: option.Option(String),
    )
pub type ToolOutput {
  ToolOutput(
    call_id: String,
    tool_name: option.Option(String),
    output: String,
  )
}

Constructors

  • ToolOutput(
      call_id: String,
      tool_name: option.Option(String),
      output: String,
    )

Values

pub fn str_to_role(role_str: String) -> option.Option(Role)
✨ Search Document