Introducing PromptQL Program API: Dynamic Integrations made simple
What are PromptQL Programs?
- Read/write or search through data by invoking Python functions. The tools are implemented outside of PromptQL. Example tools:
- Search: Vector, attribute, keyword, etc.
- Reading and writing data: Interact with databases effectively.
- Interacting with APIs: Seamlessly integrate external APIs.
- Use PromptQL Primitives (classify, summarize, extract) to make use of LLM’s capabilities.
- Create memory artifacts (text or table) to reference the data anytime in a thread.
Generating the API
POST https://api.promptql.pro.hasura.io/execute_program
Content-Type: application/json
{
"code": "<your code>",
"promptql_api_key": "<promptql api key created from project settings>",
"ai_primitives_llm": {
"provider": "hasura"
},
"ddn": {
"url": "<project sql endpoint url, eg: https://tidy-katydid-4994.ddn.hasura.app/v1/sql>",
"headers": {}
},
"artifacts": []
}
{
"output": "<program output>",
"error": null,
"modified_artifacts": [
{
"identifier": "my_artifact",
"title": "My artifact",
"artifact_type": "table",
"data": [
{
"my_column": 1
},
{
"my_column": 2
}
]
}
],
"llm_usages": [
{
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022",
"input_tokens": 691,
"output_tokens": 33
}
]
}
Using the PromptQL Playground:
Authentication: Secure your Program API
- Add an AuthConfig in the Hasura DDN metadata. Refer to this documentation.
- Define rules for token generation, expiration, and user roles to ensure secure access.
Example use cases for the Program API
Automated summarization with GitHub webhooks:
- Set up a webhook in GitHub to trigger on events like issue creation.
- Configure the webhook to call your PromptQL Program API endpoint.
- Use the API to classify issues by label or generate a summary, providing instant insights to your team.
Customer support workflows:
- Trigger a program to analyze customer queries or generate response drafts.
- Integrate the API with ticketing systems to streamline support operations.
E-commerce analytics:
- Monitor cart activity or generate reports on customer behavior.
- Trigger the API via serverless functions to analyze user trends and send notifications.
Try out the Program API
- Dive into the documentation to learn more.
- Start building your own programs with the PromptQL Console.
Related reading