Skip to content

Commit

Permalink
Merge branch 'wfh/better_errors_ts' into wfh/experiment_retry_on_conf…
Browse files Browse the repository at this point in the history
…lict
  • Loading branch information
hinthornw committed Aug 21, 2024
2 parents 88317dc + db7359b commit 28a6356
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1579,8 +1579,8 @@ export class Client {
signal: AbortSignal.timeout(this.timeout_ms),
...this.fetchOptions,
});
const result = await response.json();
await raiseForStatus(response, "update project");
const result = await response.json();
return result as TracerSession;
}

Expand Down
11 changes: 6 additions & 5 deletions js/src/tests/wrapped_ai_sdk.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
import { z } from "zod";
import { wrapAISDKModel } from "../wrappers/vercel.js";

const DEBUG = false;
test("AI SDK generateText", async () => {
const modelWithTracing = wrapAISDKModel(openai("gpt-4o-mini"));
const { text } = await generateText({
model: modelWithTracing,
prompt: "Write a vegetarian lasagna recipe for 4 people.",
});
console.log(text);
DEBUG && console.log(text);
});

test("AI SDK generateText with a tool", async () => {
Expand All @@ -36,7 +37,7 @@ test("AI SDK generateText with a tool", async () => {
},
maxToolRoundtrips: 2,
});
console.log(text);
DEBUG && console.log(text);
});

test("AI SDK generateObject", async () => {
Expand All @@ -48,7 +49,7 @@ test("AI SDK generateObject", async () => {
ingredients: z.array(z.string()),
}),
});
console.log(object);
DEBUG && console.log(object);
});

test("AI SDK streamText", async () => {
Expand All @@ -58,7 +59,7 @@ test("AI SDK streamText", async () => {
prompt: "Write a vegetarian lasagna recipe for 4 people.",
});
for await (const chunk of textStream) {
console.log(chunk);
DEBUG && console.log(chunk);
}
});

Expand All @@ -72,6 +73,6 @@ test("AI SDK streamObject", async () => {
}),
});
for await (const chunk of partialObjectStream) {
console.log(chunk);
DEBUG && console.log(chunk);
}
});

0 comments on commit 28a6356

Please sign in to comment.