old-agentic-v1^2
Travis Fischer 2023-05-26 18:15:42 -07:00
rodzic 1e597a882f
commit e330647e9f
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?'
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() }))
.output({

Wyświetl plik

@ -6,7 +6,7 @@ import { Agentic } from '../src'
dotenv.config()
export async function sentimentAgent() {
export async function main() {
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
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}}`
)
.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() })))
.examples([
{ input: 'The food was digusting', output: 'negative' },
@ -37,4 +38,4 @@ export async function sentimentAgent() {
console.log('example', example)
}
sentimentAgent()
main()