OpenAI -> Summarize
Action summary
OpenAI -> Summarize
Function Documentation: OpenAI -> Summarize (Simple)
Overview
This function summarizes a piece of text using the OpenAI API. It requires an input text and returns a summary of that text.
Inputs
openai_api_key (registry | text) Required
- Description: The API key required to access the OpenAI API for processing the input text.
input_text (text) Required
- Description: The text that needs to be summarized.
model (enum) Optional
- Description: Specifies the model to be used for generating the summary.
- Options:
gpt-4o-mini
(default)gpt-4o
gpt-4o-turbo
Function Stack
1. OpenAI API Request
- API Request to
https://api.openai.com/v1/chat/completions
- Purpose: Sends a request to the OpenAI API to summarize the input text.
2. Precondition: API Request Success
- Precondition:
openai_api.response.status == 200
- Purpose: Ensures that the API request was successful (HTTP status code 200).
3. OpenAI API Response Content
- Create Variable:
response
- Purpose: Stores the summary response content from the OpenAI API, retrieved from the result.
Response
- The function returns a summary of the provided input text.
Success response
{
"summary": "A brief and concise explanation of the input text."
}
Error response
{
"error": {
"message": "API key is missing or invalid."
}
}
Example
Input
{
"openai_api_key": "sk-xxxxxx",
"input_text": "Artificial Intelligence has transformed many industries...",
"model": "gpt-4"
}
Output
{
"summary": "AI has greatly impacted various industries through automation and efficiency."
}
Version notes
2024-10-07 18:26:57
Current
Function Documentation: OpenAI -> Summarize (Simple)
Overview
This function summarizes a piece of text using the OpenAI API. It requires an input text and returns a summary of that text.
Inputs
openai_api_key (registry | text) Required
- Description: The API key required to access the OpenAI API for processing the input text.
input_text (text) Required
- Description: The text that needs to be summarized.
model (enum) Optional
- Description: Specifies the model to be used for generating the summary.
- Options:
gpt-3
(default)gpt-4
Function Stack
1. OpenAI API Request
- API Request to
https://api.openai.com/v1/chat/completions
- Purpose: Sends a request to the OpenAI API to summarize the input text.
2. Precondition: API Request Success
- Precondition:
openai_api.response.status == 200
- Purpose: Ensures that the API request was successful (HTTP status code 200).
3. OpenAI API Response Content
- Create Variable:
response
- Purpose: Stores the summary response content from the OpenAI API, retrieved from the result.
Response
- The function returns a summary of the provided input text.
Success response
{
"summary": "A brief and concise explanation of the input text."
}
Error response
{
"error": {
"message": "API key is missing or invalid."
}
}
Example
Input
{
"openai_api_key": "sk-xxxxxx",
"input_text": "Artificial Intelligence has transformed many industries...",
"model": "gpt-4"
}
Output
{
"summary": "AI has greatly impacted various industries through automation and efficiency."
}