Skip to content

Commit 194633b

Browse files
feat(api): add evals api to config
1 parent bccaacc commit 194633b

File tree

10 files changed

+1002
-11
lines changed

10 files changed

+1002
-11
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 35
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-563dc194d092117305e98b4b79965e7b4cafc03b7d610ffa21ea1f4ba5c119e9.yml
1+
configured_endpoints: 41
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-2d787a1d9fe261bee11bff3e707fcb9c957f759e397032b64241ed9703b98cae.yml
33
openapi_spec_hash: 0675cf7a85dee80cbb0818d54af3fe33
4-
config_hash: 2887483246d24a361689cbd1258db7cf
4+
config_hash: e2d1be538fd1fb65bfc566a2a168cc16

MIGRATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ This affects the following methods:
6969

7070
- `client.endpoints.list()`
7171
- `client.hardware.list()`
72+
- `client.evaluations.list()`
7273

7374
### Removed `httpAgent` in favor of `fetchOptions`
7475

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const client = new Together({
2828

2929
const chatCompletion = await client.chat.completions.create({
3030
messages: [{ role: 'user', content: 'Say this is a test!' }],
31-
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
31+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
3232
});
3333

3434
console.log(chatCompletion.choices);
@@ -45,7 +45,7 @@ const client = new Together();
4545

4646
const stream = await client.chat.completions.create({
4747
messages: [{ role: 'user', content: 'Say this is a test' }],
48-
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
48+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
4949
stream: true,
5050
});
5151
for await (const chatCompletionChunk of stream) {
@@ -70,7 +70,7 @@ const client = new Together({
7070

7171
const params: Together.Chat.CompletionCreateParams = {
7272
messages: [{ role: 'user', content: 'Say this is a test' }],
73-
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
73+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
7474
};
7575
const chatCompletion: Together.Chat.ChatCompletion = await client.chat.completions.create(params);
7676
```
@@ -137,7 +137,7 @@ a subclass of `APIError` will be thrown:
137137
const chatCompletion = await client.chat.completions
138138
.create({
139139
messages: [{ role: 'user', content: 'Say this is a test' }],
140-
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
140+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
141141
})
142142
.catch(async (err) => {
143143
if (err instanceof Together.APIError) {
@@ -179,7 +179,7 @@ const client = new Together({
179179
});
180180

181181
// Or, configure per-request:
182-
await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'mistralai/Mixtral-8x7B-Instruct-v0.1' }, {
182+
await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo' }, {
183183
maxRetries: 5,
184184
});
185185
```
@@ -196,7 +196,7 @@ const client = new Together({
196196
});
197197

198198
// Override per-request:
199-
await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'mistralai/Mixtral-8x7B-Instruct-v0.1' }, {
199+
await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo' }, {
200200
timeout: 5 * 1000,
201201
});
202202
```
@@ -222,7 +222,7 @@ const client = new Together();
222222
const response = await client.chat.completions
223223
.create({
224224
messages: [{ role: 'user', content: 'Say this is a test' }],
225-
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
225+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
226226
})
227227
.asResponse();
228228
console.log(response.headers.get('X-My-Header'));
@@ -231,7 +231,7 @@ console.log(response.statusText); // access the underlying Response object
231231
const { data: chatCompletion, response: raw } = await client.chat.completions
232232
.create({
233233
messages: [{ role: 'user', content: 'Say this is a test' }],
234-
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
234+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
235235
})
236236
.withResponse();
237237
console.log(raw.headers.get('X-My-Header'));

api.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,33 @@ Methods:
235235
- <code title="post /batches">client.batches.<a href="./src/resources/batches.ts">create</a>({ ...params }) -> BatchCreateResponse</code>
236236
- <code title="get /batches/{id}">client.batches.<a href="./src/resources/batches.ts">retrieve</a>(id) -> BatchRetrieveResponse</code>
237237
- <code title="get /batches">client.batches.<a href="./src/resources/batches.ts">list</a>() -> BatchListResponse</code>
238+
239+
# Evaluation
240+
241+
Types:
242+
243+
- <code><a href="./src/resources/evaluation.ts">EvaluationJudgeModelConfig</a></code>
244+
- <code><a href="./src/resources/evaluation.ts">EvaluationModelRequest</a></code>
245+
- <code><a href="./src/resources/evaluation.ts">EvaluationCreateResponse</a></code>
246+
- <code><a href="./src/resources/evaluation.ts">EvaluationRetrieveResponse</a></code>
247+
- <code><a href="./src/resources/evaluation.ts">EvaluationGetStatusResponse</a></code>
248+
- <code><a href="./src/resources/evaluation.ts">EvaluationUpdateStatusResponse</a></code>
249+
250+
Methods:
251+
252+
- <code title="post /evaluation">client.evaluation.<a href="./src/resources/evaluation.ts">create</a>({ ...params }) -> EvaluationCreateResponse</code>
253+
- <code title="get /evaluation/{id}">client.evaluation.<a href="./src/resources/evaluation.ts">retrieve</a>(id) -> EvaluationRetrieveResponse</code>
254+
- <code title="get /evaluation/{id}/status">client.evaluation.<a href="./src/resources/evaluation.ts">getStatus</a>(id) -> EvaluationGetStatusResponse</code>
255+
- <code title="post /evaluation/{id}/update">client.evaluation.<a href="./src/resources/evaluation.ts">updateStatus</a>(id, { ...params }) -> EvaluationUpdateStatusResponse</code>
256+
257+
# Evaluations
258+
259+
Types:
260+
261+
- <code><a href="./src/resources/evaluations.ts">EvaluationListResponse</a></code>
262+
- <code><a href="./src/resources/evaluations.ts">EvaluationGetAllowedModelsResponse</a></code>
263+
264+
Methods:
265+
266+
- <code title="get /evaluations">client.evaluations.<a href="./src/resources/evaluations.ts">list</a>({ ...params }) -> EvaluationListResponse</code>
267+
- <code title="get /evaluations/model-list">client.evaluations.<a href="./src/resources/evaluations.ts">getAllowedModels</a>() -> EvaluationGetAllowedModelsResponse</code>

src/client.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ import {
4848
EndpointUpdateResponse,
4949
Endpoints,
5050
} from './resources/endpoints';
51+
import {
52+
Evaluation,
53+
EvaluationCreateParams,
54+
EvaluationCreateResponse,
55+
EvaluationGetStatusResponse,
56+
EvaluationJudgeModelConfig,
57+
EvaluationModelRequest,
58+
EvaluationRetrieveResponse,
59+
EvaluationUpdateStatusParams,
60+
EvaluationUpdateStatusResponse,
61+
} from './resources/evaluation';
62+
import {
63+
EvaluationGetAllowedModelsResponse,
64+
EvaluationListParams,
65+
EvaluationListResponse,
66+
Evaluations,
67+
} from './resources/evaluations';
5168
import {
5269
FileDeleteResponse,
5370
FileListResponse,
@@ -828,6 +845,8 @@ export class Together {
828845
endpoints: API.Endpoints = new API.Endpoints(this);
829846
hardware: API.Hardware = new API.Hardware(this);
830847
batches: API.Batches = new API.Batches(this);
848+
evaluation: API.Evaluation = new API.Evaluation(this);
849+
evaluations: API.Evaluations = new API.Evaluations(this);
831850
}
832851

833852
Together.Chat = Chat;
@@ -843,6 +862,8 @@ Together.Jobs = Jobs;
843862
Together.Endpoints = Endpoints;
844863
Together.Hardware = Hardware;
845864
Together.Batches = Batches;
865+
Together.Evaluation = Evaluation;
866+
Together.Evaluations = Evaluations;
846867

847868
export declare namespace Together {
848869
export type RequestOptions = Opts.RequestOptions;
@@ -963,4 +984,23 @@ export declare namespace Together {
963984
type BatchListResponse as BatchListResponse,
964985
type BatchCreateParams as BatchCreateParams,
965986
};
987+
988+
export {
989+
Evaluation as Evaluation,
990+
type EvaluationJudgeModelConfig as EvaluationJudgeModelConfig,
991+
type EvaluationModelRequest as EvaluationModelRequest,
992+
type EvaluationCreateResponse as EvaluationCreateResponse,
993+
type EvaluationRetrieveResponse as EvaluationRetrieveResponse,
994+
type EvaluationGetStatusResponse as EvaluationGetStatusResponse,
995+
type EvaluationUpdateStatusResponse as EvaluationUpdateStatusResponse,
996+
type EvaluationCreateParams as EvaluationCreateParams,
997+
type EvaluationUpdateStatusParams as EvaluationUpdateStatusParams,
998+
};
999+
1000+
export {
1001+
Evaluations as Evaluations,
1002+
type EvaluationListResponse as EvaluationListResponse,
1003+
type EvaluationGetAllowedModelsResponse as EvaluationGetAllowedModelsResponse,
1004+
type EvaluationListParams as EvaluationListParams,
1005+
};
9661006
}

0 commit comments

Comments
 (0)