1. Set Up API Configuration
API Name: Anthropic
Authentication: Choose None or self-handled
Shared Headers:
x-api-key: Your Anthropic API Key (set to hidden)
accept: application/json
anthropic-version: 2023-06-01
content-type: application/json
2. Define the API Call
Call Name: Create a completion
Method: POST
Use as: Action
Data Type: JSON
URL:
https://api.anthropic.com/v1/complete3. Setup the Request Body
Use a JSON object in the request body with the following structure:
json
Copy
Edit
{
"model": "claude-2",
"prompt": "<Prompt>",
"max_tokens_to_sample": <Max tokens>,
"temperature": <Temperature>,
"top_k": <Top K>,
"top_p": <Top P>,
"stop_sequences": ["Human:", "Assistant:"]
}
4. Parameters to Configure
Each parameter can be set dynamically in Bubble workflows:
5. Using in Workflows
Go to the Workflow Editor in Bubble.
Add an Action.
Search for and use the "Create a completion" API action.
Pass your values into the fields like Prompt, Max Tokens, Temperature, etc.
You can then use the response in elements, states, or other workflows.