Const

Constants for the OpenAI provider.

class smarter.apps.provider.services.text_completion.const.OpenAIEndPoint[source]

Bases: object

A class representing an endpoint for the OpenAI API.

api_key

The API key to use for authentication.

Type:

str

endpoint

The URL of the OpenAI API endpoint.

Type:

str

ChatCompletion = 'prompt/completions'
all_endpoints = ['prompt/completions']
class smarter.apps.provider.services.text_completion.const.OpenAIMessageKeys[source]

Bases: object

A class representing the keys for a message in the OpenAI API.

ASSISTANT_MESSAGE_KEY = 'assistant'
MESSAGE_CONTENT_KEY = 'content'
MESSAGE_NAME_KEY = 'name'
MESSAGE_ROLE_KEY = 'role'
SMARTER_ERROR_KEY = 'smarter_error'
SMARTER_MESSAGE_KEY = 'smarter'
SYSTEM_MESSAGE_KEY = 'system'
TOOL_CALL_ID = 'tool_call_id'
TOOL_MESSAGE_KEY = 'tool'
USER_MESSAGE_KEY = 'user'
all = ['system', 'assistant', 'user', 'tool']
all_openai_roles = ['system', 'assistant', 'user', 'tool']
all_roles = ['system', 'assistant', 'user', 'tool', 'smarter', 'smarter_error']
no_tools = ['system', 'assistant', 'user']
class smarter.apps.provider.services.text_completion.const.OpenAIObjectTypes[source]

Bases: object

V1 API Object Types (replace OpeanAIEndPoint).

ChatCompletion = 'prompt.completion'
all_object_types = ['prompt.completion']
class smarter.apps.provider.services.text_completion.const.OpenAIRequestKeys[source]

Bases: object

A class representing the keys for a request in the OpenAI API.

MAX_COMPLETION_TOKENS_KEY = 'max_completion_tokens'
MESSAGES_KEY = 'messages'
MODEL_KEY = 'model'
TEMPERATURE_KEY = 'temperature'
TOOLS_KEY = 'tools'
all = ['model', 'tools', 'messages', 'max_completion_tokens', 'temperature']
class smarter.apps.provider.services.text_completion.const.OpenAIResponseChoices[source]

Bases: object

A class representing the keys for a response in the OpenAI API.

FINISH_REASON_KEY = 'finish_reason'
INDEX_KEY = 'index'
LOGPROBS_KEY = 'logprobs'
MESSAGE_KEY = 'message'
all = ['index', 'message', 'logprobs', 'finish_reason']
class smarter.apps.provider.services.text_completion.const.OpenAIResponseChoicesMessage[source]

Bases: object

A class representing the keys for a response choice message in the OpenAI API.

AUDIO_KEY = 'audio'
CONTENT_KEY = 'content'
FUNCTION_CALL_KEY = 'function_call'
REFUSAL_KEY = 'refusal'
ROLE_KEY = 'role'
TOOL_CALLS_KEY = 'tool_calls'
all = ['role', 'audio', 'content', 'refusal', 'tool_calls', 'function_call']
class smarter.apps.provider.services.text_completion.const.OpenAIResponseKeys[source]

Bases: object

A class representing the keys for a response in the OpenAI API.

CHOICES_KEY = 'choices'
CREATED_KEY = 'created'
ID_KEY = 'id'
METADATA_KEY = 'metadata'
MODEL_KEY = 'model'
OBJECT_KEY = 'object'
SERVICE_TIER = 'service_tier'
SYSTEM_FINGERPRINT = 'system_fingerprint'
USAGE_KEY = 'usage'
all = ['id', 'model', 'usage', 'object', 'choices', 'created', 'metadata', 'service_tier', 'system_fingerprint']