llmgleam/gpt

Types

pub type ChatCompletion {
  ChatCompletion(
    id: String,
    output: List(types.ChatMessage),
    usage: option.Option(Usage),
  )
}

Constructors

pub type ChatCompletionRequest {
  ChatCompletionRequest(
    model: String,
    input: List(types.ChatMessage),
  )
}

Constructors

pub type GPTClientInternal {
  GPTClientInternal(api_key: String)
}

Constructors

  • GPTClientInternal(api_key: String)
pub type Usage {
  Usage(
    prompt_tokens: Int,
    completion_tokens: Int,
    total_tokens: Int,
  )
}

Constructors

  • Usage(
      prompt_tokens: Int,
      completion_tokens: Int,
      total_tokens: Int,
    )

Values

pub fn generate_content(
  client: GPTClientInternal,
  model: String,
  messages: List(types.ChatMessage),
  system_instruction: option.Option(String),
) -> Result(types.Completion, types.CompletionError)
pub fn role_to_str(role: types.Role) -> String
Search Document