Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-ec010a81f2e8cfe74de9842b6fcd84599fd1d3f439ba3eb868fb5bdbfa2fa260.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-101dab0674c0098868baea52c37050f14ce1dffeadecc3978c77e7b8a47c608c.yml
48 changes: 36 additions & 12 deletions src/resources/evaluation-assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export interface EvaluationAssertion {
*/
jsonPath: string | null;

targetValue: string | null;
targetThreshold: number | null;

targetValues: Array<string> | null;

/**
* The name of the tool to match. Only required when type is `TOOL_CALLED` or
Expand All @@ -83,13 +85,19 @@ export interface EvaluationAssertion {
* The type of evaluation matcher to use.
*/
type:
| 'CONTAINS'
| 'CONTAINS_ALL'
| 'CONTAINS_ANY'
| 'COST'
| 'EXACT_MATCH'
| 'JSON_CONTAINS'
| 'JSON_EXACT_MATCH'
| 'LATENCY'
| 'STARTS_WITH'
| 'TOOL_CALLED'
| 'TOOL_CALLED_WITH';

ignoreCase?: boolean;

negate?: boolean;

/**
* How heavily to weigh the assertion within the evaluation.
*/
Expand All @@ -111,7 +119,9 @@ export interface EvaluationAssertionCreateParams {
*/
jsonPath: string | null;

targetValue: string | null;
targetThreshold: number | null;

targetValues: Array<string> | null;

/**
* The name of the tool to match. Only required when type is `TOOL_CALLED` or
Expand All @@ -123,13 +133,19 @@ export interface EvaluationAssertionCreateParams {
* The type of evaluation matcher to use.
*/
type:
| 'CONTAINS'
| 'CONTAINS_ALL'
| 'CONTAINS_ANY'
| 'COST'
| 'EXACT_MATCH'
| 'JSON_CONTAINS'
| 'JSON_EXACT_MATCH'
| 'LATENCY'
| 'STARTS_WITH'
| 'TOOL_CALLED'
| 'TOOL_CALLED_WITH';

ignoreCase?: boolean;

negate?: boolean;

/**
* How heavily to weigh the assertion within the evaluation.
*/
Expand All @@ -145,7 +161,9 @@ export interface EvaluationAssertionUpdateParams {
*/
jsonPath: string | null;

targetValue: string | null;
targetThreshold: number | null;

targetValues: Array<string> | null;

/**
* The name of the tool to match. Only required when type is `TOOL_CALLED` or
Expand All @@ -157,13 +175,19 @@ export interface EvaluationAssertionUpdateParams {
* The type of evaluation matcher to use.
*/
type:
| 'CONTAINS'
| 'CONTAINS_ALL'
| 'CONTAINS_ANY'
| 'COST'
| 'EXACT_MATCH'
| 'JSON_CONTAINS'
| 'JSON_EXACT_MATCH'
| 'LATENCY'
| 'STARTS_WITH'
| 'TOOL_CALLED'
| 'TOOL_CALLED_WITH';

ignoreCase?: boolean;

negate?: boolean;

/**
* How heavily to weigh the assertion within the evaluation.
*/
Expand Down
24 changes: 16 additions & 8 deletions tests/api-resources/evaluation-assertions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ describe('resource evaluationAssertions', () => {
const responsePromise = promptFoundry.evaluationAssertions.create({
evaluationId: 'evaluationId',
jsonPath: 'jsonPath',
targetValue: 'targetValue',
targetThreshold: 0,
targetValues: ['string', 'string', 'string'],
toolName: 'toolName',
type: 'CONTAINS',
type: 'CONTAINS_ALL',
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -30,9 +31,12 @@ describe('resource evaluationAssertions', () => {
const response = await promptFoundry.evaluationAssertions.create({
evaluationId: 'evaluationId',
jsonPath: 'jsonPath',
targetValue: 'targetValue',
targetThreshold: 0,
targetValues: ['string', 'string', 'string'],
toolName: 'toolName',
type: 'CONTAINS',
type: 'CONTAINS_ALL',
ignoreCase: true,
negate: true,
weight: 0,
});
});
Expand All @@ -41,9 +45,10 @@ describe('resource evaluationAssertions', () => {
const responsePromise = promptFoundry.evaluationAssertions.update('1212121', {
evaluationId: 'evaluationId',
jsonPath: 'jsonPath',
targetValue: 'targetValue',
targetThreshold: 0,
targetValues: ['string', 'string', 'string'],
toolName: 'toolName',
type: 'CONTAINS',
type: 'CONTAINS_ALL',
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -58,9 +63,12 @@ describe('resource evaluationAssertions', () => {
const response = await promptFoundry.evaluationAssertions.update('1212121', {
evaluationId: 'evaluationId',
jsonPath: 'jsonPath',
targetValue: 'targetValue',
targetThreshold: 0,
targetValues: ['string', 'string', 'string'],
toolName: 'toolName',
type: 'CONTAINS',
type: 'CONTAINS_ALL',
ignoreCase: true,
negate: true,
weight: 0,
});
});
Expand Down