Validators

OpenAI API request validators

smarter.apps.prompt.providers.validators.validate_completion_request(request_body, version='v1')[source]

See openai.chat.completion.request.json

Return type:

None

smarter.apps.prompt.providers.validators.validate_embedding_request(request_body)[source]

See openai.embedding.request.json

Return type:

None

smarter.apps.prompt.providers.validators.validate_endpoint(end_point)[source]

Ensure that end_point is a valid endpoint based on the OpenAIEndPoint enum

Return type:

None

smarter.apps.prompt.providers.validators.validate_max_completion_tokens(max_completion_tokens)[source]

Ensure that max_completion_tokens is an int between 1 and 2048

Return type:

None

smarter.apps.prompt.providers.validators.validate_messages(request_body)[source]

See openai.chat.completion.request.json

smarter.apps.prompt.providers.validators.validate_object_types(object_type)[source]

Ensure that object_type is a valid object type based on the OpenAIObjectTypes enum

Return type:

None

smarter.apps.prompt.providers.validators.validate_request_body(request_body)[source]

See openai.chat.completion.request.json

Return type:

None

smarter.apps.prompt.providers.validators.validate_temperature(temperature)[source]

Ensure that temperature is a float between 0 and 1

Return type:

None