pyrit.prompt_target.OpenAICompletionTarget#
- class OpenAICompletionTarget(max_tokens: int | None | NotGiven = NOT_GIVEN, temperature: float = 1.0, top_p: float = 1.0, frequency_penalty: float = 0.0, presence_penalty: float = 0.0, *args, **kwargs)[source]#
Bases:
OpenAITarget
- __init__(max_tokens: int | None | NotGiven = NOT_GIVEN, temperature: float = 1.0, top_p: float = 1.0, frequency_penalty: float = 0.0, presence_penalty: float = 0.0, *args, **kwargs)[source]#
- Parameters:
max_tokens (int, Optional) – The maximum number of tokens that can be generated in the completion. The token count of your prompt plus max_tokens cannot exceed the model’s context length.
Methods
__init__
([max_tokens, temperature, top_p, ...])dispose_db_engine
()Dispose DuckDB database engine to release database connections and resources.
get_identifier
()send_chat_prompt_async
(*, prompt, ...[, ...])Sends a text prompt to the target without having to build the prompt request.
send_prompt_async
(**kwargs)Sends a normalized prompt async to the prompt target.
set_system_prompt
(*, system_prompt, ...[, ...])Sets the system prompt for the prompt target.
Attributes
ADDITIONAL_REQUEST_HEADERS
deployment_environment_variable
endpoint_uri_environment_variable
api_key_environment_variable
supported_converters
- async send_prompt_async(**kwargs)#
Sends a normalized prompt async to the prompt target.