-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlmunit.ts
55 lines (48 loc) · 1.65 KB
/
lmunit.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import * as Core from '../core';
export class LMUnit extends APIResource {
/**
* Given a `query`, `response`, and a `unit_test`, return the response's `score` on
* the unit test on a 5-point continuous scale. The total input cannot exceed 7000
* tokens.
*
* See a code example in [our blog post](https://contextual.ai/news/lmunit/). Email
* [[email protected]](mailto:[email protected]) with any
* feedback or questions.
*
* > 🚀 Obtain an LMUnit API key by completing
* > [this form](https://contextual.ai/request-lmunit-api/)
*/
create(body: LMUnitCreateParams, options?: Core.RequestOptions): Core.APIPromise<LMUnitCreateResponse> {
return this._client.post('/lmunit', { body, ...options });
}
}
/**
* LMUnit result object.
*/
export interface LMUnitCreateResponse {
/**
* The response is scored on a continuous scale from 1 to 5 on the unit test. The
* discrete scores 1, 2, 3, 4, and 5 roughly correspond to "Strongly fails,"
* "Fails," "Neutral," "Passes," and "Strongly passes," respectively.
*/
score: number;
}
export interface LMUnitCreateParams {
/**
* The prompt to which the model responds
*/
query: string;
/**
* The model response to evaluate
*/
response: string;
/**
* A natural language statement or question against which to evaluate the response
*/
unit_test: string;
}
export declare namespace LMUnit {
export { type LMUnitCreateResponse as LMUnitCreateResponse, type LMUnitCreateParams as LMUnitCreateParams };
}