struct Anthropic::Messages

Defined in:

messages.cr

Constant Summary

CREATE_HEADERS = HTTP::Headers {"anthropic-beta" => {"tools-2024-04-04", "max-tokens-3-5-sonnet-2024-07-15", "prompt-caching-2024-07-31"}.join(',')}

Instance Method Summary

Instance methods inherited from struct Anthropic::API

client : Client client

Constructor methods inherited from struct Anthropic::API

new(client : Anthropic::Client) new

Instance Method Detail

def create(*, model : String, max_tokens : Int32, messages : Array(Anthropic::Message), system : String | Anthropic::MessageContent | Array | Nil = nil, temperature : Float64 | Nil = nil, top_k : Int64 | Nil = nil, top_p : Float64 | Nil = nil) #

[View source]
def create(*, model : String, max_tokens : Int32, messages : Array(Anthropic::Message), system : String | Anthropic::MessageContent | Array | Nil = nil, temperature : Float64 | Nil = nil, top_k : Int64 | Nil = nil, top_p : Float64 | Nil = nil, tools : Array, run_tools : Bool = true) : Array(GeneratedMessage) #

[View source]
def create(*, model : String, max_tokens : Int32, messages : Array(Anthropic::Message), system : String | Nil = nil, temperature : Float64 | Nil = nil, top_k : Int64 | Nil = nil, top_p : Float64 | Nil = nil, &block : Event -> T) forall T #

Send your prompt to the API and yield Events as they are fed back in.

EXPERIMENTAL Streaming message events kinda/sorta works, but needs further testing


[View source]