module OpenAI

Defined in:

openai.cr
openai/api/audio.cr
openai/api/chat.cr
openai/api/completion.cr
openai/api/embeddings.cr
openai/api/file.cr
openai/api/fine_tuning.cr
openai/api/image.cr
openai/api/model.cr
openai/api/moderation.cr
openai/api/usage.cr
openai/client.cr
openai/config.cr
openai/constants.cr
openai/errors.cr
openai/stream.cr

Constant Summary

API_BASE = ENV["OPENAI_API_BASE"]?
API_KEY = ENV["OPENAI_API_KEY"]?
API_KEY_PATH = ENV["OPENAI_API_KEY_PATH"]?
API_TYPE = ApiType.parse(ENV["OPENAI_API_TYPE"]? || "open_ai")
API_VERSION = ENV["OPENAI_API_VERSION"]? || (if API_TYPE.azure? AZURE_API_VERSION end)
AZURE_API_HEADER = "api-key"
AZURE_API_PREFIX = "openai"
AZURE_API_VERSION = "2023-05-15"
AZURE_DEPLOYMENT_PREFIX = "deployments"
CodexCodeCushman001 = "code-cushman-001"
CodexCodeDavinci001 = "code-davinci-001"
CodexCodeDavinci002 = "code-davinci-002"

Codex Defines the models provided by OpenAI. These models are designed for code-specific tasks, and use a different tokenizer which optimizes for whitespace.

EMPTY_MESSAGES_LIMIT = 300
GPT3Ada = "ada"
GPT3Ada002 = "ada-002"
GPT3Babbage = "babbage"
GPT3Babbage002 = "babbage-002"
GPT3Curie = "curie"
GPT3Curie002 = "curie-002"
GPT3CurieInstructBeta = "curie-instruct-beta"

Deprecated: Will be shut down on January 04, 2024. Use gpt-3.5-turbo-instruct instead.

GPT3Davinci = "davinci"
GPT3Davinci002 = "davinci-002"
GPT3DavinciInstructBeta = "davinci-instruct-beta"

Deprecated: Will be shut down on January 04, 2024. Use gpt-3.5-turbo-instruct instead.

GPT3Dot5Turbo = "gpt-3.5-turbo"
GPT3Dot5Turbo0301 = "gpt-3.5-turbo-0301"
GPT3Dot5Turbo0613 = "gpt-3.5-turbo-0613"
GPT3Dot5Turbo1106 = "gpt-3.5-turbo-1106"
GPT3Dot5Turbo16K = "gpt-3.5-turbo-16k"
GPT3Dot5Turbo16K0613 = "gpt-3.5-turbo-16k-0613"
GPT3Dot5TurboInstruct = "gpt-3.5-turbo-instruct"
GPT3TextAda001 = "text-ada-001"

Deprecated: Will be shut down on January 04, 2024. Use gpt-3.5-turbo-instruct instead.

GPT3TextBabbage001 = "text-babbage-001"

Deprecated: Will be shut down on January 04, 2024. Use gpt-3.5-turbo-instruct instead.

GPT3TextCurie001 = "text-curie-001"

Deprecated: Will be shut down on January 04, 2024. Use gpt-3.5-turbo-instruct instead.

GPT3TextDavinci001 = "text-davinci-001"

Deprecated: Will be shut down on January 04, 2024. Use gpt-3.5-turbo-instruct instead.

GPT3TextDavinci002 = "text-davinci-002"

Deprecated: Will be shut down on January 04, 2024. Use gpt-3.5-turbo-instruct instead.

GPT3TextDavinci003 = "text-davinci-003"

Deprecated: Will be shut down on January 04, 2024. Use gpt-3.5-turbo-instruct instead.

GPT4 = "gpt-4"
GPT40314 = "gpt-4-0314"
GPT40613 = "gpt-4-0613"
GPT41106 = "gpt-4-1106-preview"
GPT432K = "gpt-4-32k"
GPT432K0314 = "gpt-4-32k-0314"
GPT432K0613 = "gpt-4-32k-0613"

GPT3 Defines the models provided by OpenAI to use when generating completions from OpenAI. GPT3 Models are designed for text-based tasks. For code-specific tasks, please refer to the Codex series of models.

OPENAI_API_DEFAULT_URL = "https://api.openai.com/v1"
ORGANIZATION = ENV["OPENAI_ORGANIZATION"]? || ""
VERSION = {{ (`shards version \"/srv/crystaldoc.info/github-spider-gazelle-crystal-openai-main/src\"`).chomp.stringify }}

Class Method Summary

Class Method Detail

def self.default_apikey : String #

[View source]
def self.disabled_models_for_endpoints #

[View source]
def self.em_2_text #

:nodoc


[View source]
def self.endpoint_supports_model?(endpoint : String, model : String) : Bool #

[View source]