Skip to content

Commit

Permalink
improvement: remove unnecessary random delay
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrammel committed May 24, 2024
1 parent 9ac7689 commit 8d48064
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions content/docs/05-ai-sdk-ui/02-chatbot-with-tool-calling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,6 @@ export async function POST(req: Request) {
description: 'show the weather in a given city to the user',
parameters: z.object({ city: z.string() }),
execute: async ({}: { city: string }) => {
// Random delay between 1000ms (1s) and 3000ms (3s):
const delay = Math.floor(Math.random() * (3000 - 1000 + 1)) + 1000;
await new Promise(resolve => setTimeout(resolve, delay));

// Random weather:
const weatherOptions = ['sunny', 'cloudy', 'rainy', 'snowy', 'windy'];
return weatherOptions[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ export async function POST(req: Request) {
description: 'show the weather in a given city to the user',
parameters: z.object({ city: z.string() }),
execute: async ({}: { city: string }) => {
// Random delay between 1000ms (1s) and 3000ms (3s):
const delay = Math.floor(Math.random() * (3000 - 1000 + 1)) + 1000;
await new Promise(resolve => setTimeout(resolve, delay));

// Random weather:
const weatherOptions = ['sunny', 'cloudy', 'rainy', 'snowy', 'windy'];
return weatherOptions[
Expand Down

0 comments on commit 8d48064

Please sign in to comment.