diff --git a/examples/hf0-demo.ts b/examples/hf0-demo.ts index 7395d3af..73f3807f 100644 --- a/examples/hf0-demo.ts +++ b/examples/hf0-demo.ts @@ -22,7 +22,7 @@ async function main() { messages: [ { role: 'system', - content: `You are a MckInsey analyst who is an expert at writing executive summaries.` + content: `You are a McKinsey analyst who is an expert at writing executive summaries.` }, { role: 'user', @@ -57,7 +57,7 @@ async function main() { messages: [ { role: 'system', - content: `You are a MckInsey analyst who is an expert at writing executive summaries.` + content: `You are a McKinsey analyst who is an expert at writing executive summaries.` }, { role: 'user', diff --git a/examples/search-and-crawl.ts b/examples/search-and-crawl.ts index 6c51f3dd..e33e6070 100644 --- a/examples/search-and-crawl.ts +++ b/examples/search-and-crawl.ts @@ -15,7 +15,7 @@ async function main() { messages: [ { role: 'system', - content: `You are a MckInsey analyst who is an expert at writing executive summaries. Always respond using markdown unless instructed to respond using JSON.` + content: `You are a McKinsey analyst who is an expert at writing executive summaries. Always respond using markdown.` }, { role: 'user', diff --git a/examples/summarize-news.ts b/examples/summarize-news.ts index 2308fcbe..8ba6a895 100644 --- a/examples/summarize-news.ts +++ b/examples/summarize-news.ts @@ -8,6 +8,8 @@ async function main() { const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! }) const agentic = new Agentic({ openai }) + const topic = process.argv[2] || 'HF0 accelerator' + const res = await agentic .gpt4(`Summarize the latest news on {{topic}} using markdown.`) .tools([new SerpAPITool()]) @@ -16,13 +18,8 @@ async function main() { topic: z.string() }) ) - .output( - z.object({ - summary: z.string() - }) - ) .call({ - topic: 'HF0 accelerator' + topic }) console.log('\n\n\n' + res) diff --git a/src/tools/diffbot.ts b/src/tools/diffbot.ts index 941df61d..91622bed 100644 --- a/src/tools/diffbot.ts +++ b/src/tools/diffbot.ts @@ -109,23 +109,26 @@ export class DiffbotTool extends BaseTask { const output = this.outputSchema.parse({ type: res.type, title: res.title, - objects: res.objects.map((obj) => ({ - ...pick( - obj, - 'type', - 'siteName', - 'author', - // 'authorUrl', - 'pageUrl', - 'date', - // 'estimatedDate', - // 'humanLanguage', - 'items', - 'text' - ) - // tags: obj.tags?.map((tag) => tag.label) - // images: obj.images?.map((image) => omit(image, 'diffbotUri')) - })) + objects: res.objects?.map( + (obj) => + ({ + ...pick( + obj, + 'type', + 'siteName', + 'author', + // 'authorUrl', + 'pageUrl', + 'date', + // 'estimatedDate', + // 'humanLanguage', + 'items', + 'text' + ) + // tags: obj.tags?.map((tag) => tag.label) + // images: obj.images?.map((image) => omit(image, 'diffbotUri')) + } || []) + ) }) this._logger.info(output, `Diffbot response for url "${ctx.input!.url}"`) diff --git a/src/tools/serpapi.ts b/src/tools/serpapi.ts index c15cb811..08fa600b 100644 --- a/src/tools/serpapi.ts +++ b/src/tools/serpapi.ts @@ -123,7 +123,6 @@ export class SerpAPITool extends BaseTask { }) this._logger.info(output, `SerpAPI response for query "${query}"`) - return output } }