kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
rodzic
c932ae50d1
commit
c13a43e41b
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -109,23 +109,26 @@ export class DiffbotTool extends BaseTask<DiffbotInput, DiffbotOutput> {
|
|||
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}"`)
|
||||
|
|
|
@ -123,7 +123,6 @@ export class SerpAPITool extends BaseTask<SerpAPIInput, SerpAPIOutput> {
|
|||
})
|
||||
|
||||
this._logger.info(output, `SerpAPI response for query "${query}"`)
|
||||
|
||||
return output
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue