llmgleam/claude

Types

pub type ClaudeClientInternal {
  ClaudeClientInternal(api_key: String)
}

Constructors

  • ClaudeClientInternal(api_key: String)
pub type ContentBlock {
  TextBlock(text: String)
  ToolUseBlock(call: types.ToolCall)
  IgnoredBlock
}

Constructors

  • TextBlock(text: String)
  • ToolUseBlock(call: types.ToolCall)
  • IgnoredBlock
pub type MessagesRequest {
  MessagesRequest(
    model: String,
    messages: List(types.ChatMessage),
    system: option.Option(String),
    max_tokens: Int,
    tools: List(types.Tool),
    tool_exchanges: List(
      #(types.Completion, List(types.ToolOutput)),
    ),
    pending_completion: option.Option(types.Completion),
    tool_outputs: List(types.ToolOutput),
  )
}

Constructors

pub type MessagesResponse {
  MessagesResponse(
    id: String,
    content: List(ContentBlock),
    role: String,
    usage: option.Option(Usage),
  )
}

Constructors

pub type Usage {
  Usage(input_tokens: Int, output_tokens: Int)
}

Constructors

  • Usage(input_tokens: Int, output_tokens: Int)

Values

pub fn generate_content(
  client: ClaudeClientInternal,
  model: String,
  messages: List(types.ChatMessage),
  system_instruction: option.Option(String),
  tools: List(types.Tool),
  tool_exchanges: List(
    #(types.Completion, List(types.ToolOutput)),
  ),
  pending_completion: option.Option(types.Completion),
  tool_outputs: List(types.ToolOutput),
) -> Result(types.Completion, types.CompletionError)
pub fn role_to_str(role: types.Role) -> String
✨ Search Document