Closed jalkestrup closed 3 months ago
Hi Jesper, thanks for those kind words about Promptlayer. You might have caught one of our pydantic raw validation exceptions. We will get that sorted out soon.
Anyway the payload you should be using looks like this:
import requests
url = "https://api.promptlayer.com/rest/prompt-templates"
payload = {
"prompt_template": {
"prompt_name": "replace_with_your_existing_prompt_name",
"type": "completion"
},
"prompt_version": {
"commit_message": "Test from API docs",
"metadata": {
"model": {
"name": "gpt-3.5-turbo-0125",
"provider": "openai"
}
},
"prompt_template": {
"type": "completion",
"content": [
{
"text": "New content, removed old!",
"type": "text"
}
]
}
}
}
headers = {
"X-API-KEY": "fill-this-up",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
If you're using Promptlayer you probably want to be in our Discord server for faster replys. Hope to see you there!
Hi,
Thanks for creating a great prompt management platform. There seem to be an issue running publish to the template API endpoint. If i try to run the below bare minimum post request, I get the following error:
{"message":[{"loc":["prompt_version","prompt_template"],"msg":"Unable to extract tag using discriminator 'type'","type":"union_tag_not_found"}],"success":false}
However, I guess the tag is not required? And even if I try to provide the tag as a list of strings, the error message prevails.
Code to replicate, insert your PL API key and name of existing prompt:
I am running latest promptlayer==0.5.0