kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
old-agentic-v1^2
rodzic
ed4ea41c51
commit
7850c96f52
|
@ -11,7 +11,10 @@ async function main() {
|
||||||
const out = await ai
|
const out = await ai
|
||||||
.gpt3(`Give me {{numFacts}} random facts about {{topic}}`)
|
.gpt3(`Give me {{numFacts}} random facts about {{topic}}`)
|
||||||
.input(
|
.input(
|
||||||
z.object({ topic: z.string(), numFacts: z.number().int().default(5) })
|
z.object({
|
||||||
|
topic: z.string(),
|
||||||
|
numFacts: z.number().int().default(5).optional()
|
||||||
|
})
|
||||||
)
|
)
|
||||||
.output(z.object({ facts: z.array(z.string()) }))
|
.output(z.object({ facts: z.array(z.string()) }))
|
||||||
.modelParams({ temperature: 0.9 })
|
.modelParams({ temperature: 0.9 })
|
||||||
|
|
|
@ -3,7 +3,8 @@ import { OpenAIClient } from 'openai-fetch'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { Agentic } from '../src'
|
import { Agentic } from '../src'
|
||||||
import { summaryAgent } from './summary'
|
|
||||||
|
// import { summaryAgent } from './summary'
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
|
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
|
||||||
|
@ -45,17 +46,18 @@ async function main() {
|
||||||
dietaryRestrictions: ['vegan', 'vegetarian', 'gluten-free']
|
dietaryRestrictions: ['vegan', 'vegetarian', 'gluten-free']
|
||||||
})
|
})
|
||||||
|
|
||||||
const article = await $.browse(foodAgent.linkToLearnMore)
|
// TODO
|
||||||
const summary = await summaryAgent.call({ article })
|
// const article = await $.browse(foodAgent.linkToLearnMore)
|
||||||
|
// const summary = await summaryAgent.call({ article })
|
||||||
|
|
||||||
const email = await $.gpt4(
|
// const email = await $.gpt4(
|
||||||
`Here is a summary of an article about food: {{summary}}.
|
// `Here is a summary of an article about food: {{summary}}.
|
||||||
Here is some more information about the food: {{foodInfo}}.
|
// Here is some more information about the food: {{foodInfo}}.
|
||||||
Write a nice email that I can send to myself that includes the summary and the food info.
|
// Write a nice email that I can send to myself that includes the summary and the food info.
|
||||||
Make it fun and interesting.`
|
// Make it fun and interesting.`
|
||||||
)
|
// )
|
||||||
.input(z.object({ summary: z.string(), foodInfo: foodSchema }))
|
// .input(z.object({ summary: z.string(), foodInfo: foodSchema }))
|
||||||
.output(z.string())
|
// .output(z.string())
|
||||||
|
|
||||||
// sendEmail(email)
|
// sendEmail(email)
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue