old-agentic-v1^2
Travis Fischer 2023-05-26 18:15:42 -07:00
rodzic 95bb8c1e70
commit 003ec24a18
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -28,7 +28,7 @@ export async function equationProducer() {
'Carla is downloading a 200 GB file. She can download 2 GB/minute, but 40% of the way through the download, the download fails. Then Carla has to restart the download from the beginning. How long did it take her to download the file in minutes?' 'Carla is downloading a 200 GB file. She can download 2 GB/minute, but 40% of the way through the download, the download fails. Then Carla has to restart the download from the beginning. How long did it take her to download the file in minutes?'
const example = await $.gpt4( const example = await $.gpt4(
`Give me the equation for the following math problem: {{question}}` `You are an expert math teacher. Think step by step, and give me the equation for the following math problem: \n\n{{question}}`
) )
.input(z.object({ question: z.string() })) .input(z.object({ question: z.string() }))
.output({ .output({

Wyświetl plik

@ -6,7 +6,7 @@ import { Agentic } from '../src'
dotenv.config() dotenv.config()
export async function sentimentAgent() { export async function main() {
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! }) const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
const $ = new Agentic({ openai }) const $ = new Agentic({ openai })
@ -14,6 +14,7 @@ export async function sentimentAgent() {
`You are an expert sentiment-labelling assistant. Label the following texts as positive or negative: \n{{#texts}}- {{.}}\n{{/texts}}` `You are an expert sentiment-labelling assistant. Label the following texts as positive or negative: \n{{#texts}}- {{.}}\n{{/texts}}`
) )
.input(z.object({ texts: z.string().array() })) .input(z.object({ texts: z.string().array() }))
// TODO: label should be a union of literals
.output(z.array(z.object({ text: z.string(), label: z.string() }))) .output(z.array(z.object({ text: z.string(), label: z.string() })))
.examples([ .examples([
{ input: 'The food was digusting', output: 'negative' }, { input: 'The food was digusting', output: 'negative' },
@ -37,4 +38,4 @@ export async function sentimentAgent() {
console.log('example', example) console.log('example', example)
} }
sentimentAgent() main()