kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
old-agentic-v1^2
rodzic
77ad2b978f
commit
b4e5f405ed
|
@ -0,0 +1,19 @@
|
|||
import dotenv from 'dotenv-safe'
|
||||
import { OpenAIClient } from 'openai-fetch'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { Agentic } from '../src'
|
||||
|
||||
dotenv.config()
|
||||
|
||||
async function main() {
|
||||
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
|
||||
const $ = new Agentic({ openai })
|
||||
|
||||
const ex1 = await $.gpt4(`generate fake data`)
|
||||
// .output(z.object({ foo: z.string(), bar: z.number() }))
|
||||
.call()
|
||||
console.log(ex1)
|
||||
}
|
||||
|
||||
main()
|
|
@ -14,7 +14,6 @@ export async function main() {
|
|||
`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' },
|
||||
|
@ -22,10 +21,6 @@ export async function main() {
|
|||
{ input: 'Recommended', output: 'positive' },
|
||||
{ input: 'The waiter was rude', output: 'negative' }
|
||||
])
|
||||
// .assert((output) => output.filter(({ label }) =>
|
||||
// !['positive', 'negative'].includes(label)
|
||||
// ).length === 0
|
||||
// })
|
||||
.call({
|
||||
texts: [
|
||||
'I went to this place and it was just so awful.',
|
||||
|
|
Ładowanie…
Reference in New Issue