Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from edgenai/chore/examples-with-default
Browse files Browse the repository at this point in the history
[chore/examples-with-default] changed models to default in examples
  • Loading branch information
toschoo authored Mar 19, 2024
2 parents b29ef33 + 5ef8fa5 commit 04d0d5b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ main();
async function demo() {
const transcription = await client.audio.transcriptions.create({
file: fs.createReadStream("examples/audio/frost.wav"),
model: 'whisper-1',
model: 'default',
});
console.log(transcription);
}
14 changes: 7 additions & 7 deletions examples/chat-params-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function main() {
// ---------------- Explicit non-streaming params ------------

const params: Edgen.Chat.ChatCompletionCreateParams = {
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user', content: 'Say this is a test!' }],
};
const completion = await edgen.chat.completions.create(params);
Expand All @@ -18,7 +18,7 @@ async function main() {
// ---------------- Explicit streaming params ----------------

const streamingParams: Edgen.Chat.ChatCompletionCreateParams = {
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user', content: 'Say this is a test!' }],
stream: true,
};
Expand All @@ -32,12 +32,12 @@ async function main() {
// ---------------- Explicit (non)streaming types ----------------

const params1: Edgen.Chat.ChatCompletionCreateParamsNonStreaming = {
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user', content: 'Say this is a test!' }],
};

const params2: Edgen.Chat.ChatCompletionCreateParamsStreaming = {
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user', content: 'Say this is a test!' }],
stream: true,
};
Expand All @@ -50,7 +50,7 @@ async function main() {
// If you didn't include it then you'd also get an error saying that
// `role: string` is not assignable.
const streamingParams2 = {
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user' as const, content: 'Say this is a test!' }],
stream: true as const,
};
Expand All @@ -64,7 +64,7 @@ async function main() {

// Without the `as const` for `stream`.
const streamingParams3 = {
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user' as const, content: 'Say this is a test!' }],
stream: true,
};
Expand Down Expand Up @@ -102,7 +102,7 @@ export async function createCompletionParams(
stream: boolean,
): Promise<Edgen.Chat.ChatCompletionCreateParams> {
const params = {
model: 'gpt-3.5-turbo',
model: 'default',
messages: [{ role: 'user' as const, content: 'Hello!' }],
stream: stream,
};
Expand Down
4 changes: 2 additions & 2 deletions examples/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ const client = new Edgen();
async function main() {
// Non-streaming:
const completion = await client.chat.completions.create({
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user', content: 'What is the result of 1 + 2?' }],
});
console.log(completion.choices[0]?.message?.content);

// Streaming:
const stream = await client.chat.completions.create({
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user', content: 'Say this is a test' }],
stream: true,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const edgen = new Edgen();
async function main() {
// Explicit streaming params type:
const streaming_params: Edgen.Chat.CompletionCreateParams = {
model: 'gpt-4',
model: 'default',
messages: [{ role: 'user', content: 'Say this is a test!' }],
stream: true,
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edgen",
"version": "0.1.4",
"version": "0.1.5",
"description": "The official TypeScript library for the Edgen API",
"author": "Edgen <[email protected]>",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 04d0d5b

Please sign in to comment.