Integrations
OpenAI
APIs
Chat Completion

Chat Completion

Leverage advanced AI models from OpenAI to perform complex tasks such as categorization, analysis, summarization, or decision support.

For more information on OpenAI's API, see OpenAI Documentation (opens in a new tab).

SDK Import:

from admyral.actions import openai_chat_completion

Arguments:

Argument NameDescriptionRequired
Model modelThe model to use for the chat completion (e.g., gpt-4).Yes
Prompt promptThe input prompt to use for generating the chat completion.Yes
Top P top_üValue between 0 and 1 for nucleus sampling. Only tokens with the top P probability mass are considered. Recommended to tweak this or temperature, but not both.-
Temperature temperatureSampling temperature, between 0 and 2. Higher values (e.g., 0.8) increase randomness, while lower values (e.g., 0.2) make output more deterministic. Recommended to adjust this or Top P, but not both.-
Stop Tokens stop_tokensA list of tokens to stop the completion upon encountering.-

Returns

A string.

Required Secrets

Secret PlaceholderDescription
OPENAI_SECRETOpenAI secret. See OpenAI setup

SDK Example

response = openai_chat_completion(
	model="gpt-4o",
	prompt="Why is the ocean salty?",
	secrets={
		"OPENAI_SECRET": "my_stored_openai_secret"
	}
)