ChatAPICall
Documentation for ChatAPICall.
ChatAPICall.ChatChatAPICall.ErrRespChatAPICall.RespBase.copyBase.lengthBase.pop!Base.printBase.printBase.showChatAPICall.add!ChatAPICall.add!ChatAPICall.addassistant!ChatAPICall.addsystem!ChatAPICall.adduser!ChatAPICall.defaultpromptChatAPICall.getresponseChatAPICall.proxy_offChatAPICall.proxy_onChatAPICall.proxy_statusChatAPICall.showapikey
ChatAPICall.Chat — TypeChatChat with OpenAI API.
Fields
chatlog::Vector{Dict}: The chat log.
ChatAPICall.ErrResp — TypeErrRespError response from OpenAI API.
Fields
message::String: The error message.type::String: The error type.param::Union{Nothing, String}: The parameter that caused the error.code::String: The error code.
ChatAPICall.Resp — TypeRespResponse from OpenAI API.
Fields
total_tokens::Int: Total number of tokens in the response.prompt_tokens::Int: Number of tokens in the prompt.completion_tokens::Int: Number of tokens in the completion.content::String: The completion.id::String: The ID of the completion.model::String: The model used to generate the completion.
Base.copy — Methodcopy(chat::Chat)Copy a chat log.
Base.length — Methodlength(chat::Chat)Get the number of messages in the chat log.
Base.pop! — Methodpop!(chat::Chat)Pop the last message from the chat log.
Base.print — Methodprint(io::IO, chat::Chat)Print the chat log.
Base.print — Methodprint(io::IO, chat::Chat)Print the chat log.
Base.show — Methodshow(io::IO, chat::Chat)Show information of the chat log.
ChatAPICall.add! — Methodadd!(chat::Chat, role::AbstractString, content::AbstractString)Add a message to the chat log.
ChatAPICall.add! — Methodadd!(chat::Chat, resp::Resp)Add a response from OpenAI API to the chat log.
Arguments
chat::Chat: The chat log.resp::Resp: The response from OpenAI API.
ChatAPICall.addassistant! — Methodaddassistant!(chat::Chat, content::AbstractString)Add an assistant message to the chat log.
ChatAPICall.addsystem! — Methodaddsystem!(chat::Chat, content::AbstractString)Add a system message to the chat log.
ChatAPICall.adduser! — Methodadduser!(chat::Chat, content::AbstractString)Add a user message to the chat log.
ChatAPICall.defaultprompt — Methoddefaultprompt(msg::AbstractString)Default prompt for Chat(msg:AbstractString).
ChatAPICall.getresponse — Functiongetresponse( chat::Chat
, maxrequests::Int=1
, compact::Bool=true
, model::AbstractString="gpt-3.5-turbo"
, options...)::RespGet a response from OpenAI API.
Arguments
chat::Chat: The chat log.maxrequests::Int: The maximum number of requests to OpenAI API.compact::Bool: Whether to compact the response.model::AbstractString: The model to use.**options: Other options to pass toChatAPICall.request.
ChatAPICall.proxy_off — Methodproxy_off()Turn off proxy.
ChatAPICall.proxy_on — Methodproxy_on(http::Union{Nothing, AbstractString}, https::Union{Nothing, AbstractString})Turn on proxy.
ChatAPICall.proxy_status — Methodproxy_status()Get proxy status.
ChatAPICall.showapikey — Methodshowapikey()Show the OpenAI API key.