Calling Prompts via API
Hyperleap AI makes it incredibly easy to go from creating prompts to leveraging them via API within your applications. Here is how the workflow looks:
Designing Prompts
You first design prompts using the intuitive Prompt Playground interface. The prompts get saved to your personal "My Prompts" section.
Organizing Prompts
To share your prompts with other users, or to make them available for integration into apps via APIs, you need to organize them into Workspaces. Think of Workspaces as containers where you can collaboratively group prompts for different apps or functions.
To add a prompt to a Workspace, open any prompt from your "My Prompts" and use the "Copy to Workspace" option from the more options. Select the Workspace you want to copy the prompt into.
Exposing Prompts as APIs
This is where the magic happens. Within a Workspace, find the prompt you want, and click on it to check the prompt details. On the top of the page, click the "API Integration" button. Use the "Enable API" toggle to enable the API on the prompt. Hit Save.
Tip 💡: Did you notice the cURL request as you were enabling the API. Using the cURL, build integrations from your apps, by simply passing in the promptId. This is as simple as it can get. To explore the full power of prompts, check out the API documentation
Voila! This immediately exposes the prompt as a REST API endpoint.
Leveraging Prompt APIs
You can now start leveraging the prompt API within your applications. Call the API endpoint with your app's programming language of choice like Python, Node, Java etc.
The prompt will execute behind the scenes and return the AI-generated response back to your app.
Managing Versions
Both "My Prompts" and Workspaces allow managing multiple versions of a prompt. Using versions, you can seamlessly test variations, optimize prompts, and integrate the best version without disruptions.
Updated 8 months ago