import PromptFoundry from '@prompt-foundry/typescript-sdk';
const client = new PromptFoundry({
apiKey: process.env['PROMPT_FOUNDRY_API_KEY'], // This is the default and can be omitted
});
async function main() {
const evaluation = await client.evaluations.create({
appendedMessages: [
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
],
promptId: 'promptId',
variables: { foo: 'string' },
});
console.log(evaluation.id);
}
main();
{
"id": "<string>",
"promptId": "<string>",
"appendedMessages": [
{
"content": [
{
"type": "TEXT",
"text": "<string>"
}
],
"role": "assistant"
}
],
"variables": {},
"weight": 1,
"threshold": 1
}
Create a new evaluation.
import PromptFoundry from '@prompt-foundry/typescript-sdk';
const client = new PromptFoundry({
apiKey: process.env['PROMPT_FOUNDRY_API_KEY'], // This is the default and can be omitted
});
async function main() {
const evaluation = await client.evaluations.create({
appendedMessages: [
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
],
promptId: 'promptId',
variables: { foo: 'string' },
});
console.log(evaluation.id);
}
main();
{
"id": "<string>",
"promptId": "<string>",
"appendedMessages": [
{
"content": [
{
"type": "TEXT",
"text": "<string>"
}
],
"role": "assistant"
}
],
"variables": {},
"weight": 1,
"threshold": 1
}
Successful operation
The response is of type object
.
Was this page helpful?