kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
rodzic
3d87b15d14
commit
6e823e7d97
|
@ -2,7 +2,7 @@ import { OpenAIClient } from '@agentic/openai-fetch'
|
||||||
import 'dotenv/config'
|
import 'dotenv/config'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { Agentic, DiffbotTool, SerpAPITool } from '@/index'
|
import { Agentic, SerpAPITool } from '@/index'
|
||||||
|
|
||||||
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! })
|
||||||
|
@ -10,7 +10,7 @@ async function main() {
|
||||||
|
|
||||||
const res = await agentic
|
const res = await agentic
|
||||||
.gpt4(`Summarize the latest news on {{topic}} using markdown.`)
|
.gpt4(`Summarize the latest news on {{topic}} using markdown.`)
|
||||||
.tools([new SerpAPITool(), new DiffbotTool()])
|
.tools([new SerpAPITool()])
|
||||||
.input(
|
.input(
|
||||||
z.object({
|
z.object({
|
||||||
topic: z.string()
|
topic: z.string()
|
||||||
|
@ -25,7 +25,7 @@ async function main() {
|
||||||
topic: 'HF0 accelerator'
|
topic: 'HF0 accelerator'
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(res)
|
console.log('\n\n\n' + res)
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import defaultKy from 'ky'
|
import defaultKy from 'ky'
|
||||||
import { AbortError } from 'p-retry'
|
import { AbortError } from 'p-retry'
|
||||||
import pThrottle from 'p-throttle'
|
import pThrottle from 'p-throttle'
|
||||||
import { P } from 'pino'
|
|
||||||
|
|
||||||
import { throttleKy } from '@/utils'
|
import { throttleKy } from '@/utils'
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { z } from 'zod'
|
||||||
import * as types from '@/types'
|
import * as types from '@/types'
|
||||||
import { DiffbotClient } from '@/services/diffbot'
|
import { DiffbotClient } from '@/services/diffbot'
|
||||||
import { BaseTask } from '@/task'
|
import { BaseTask } from '@/task'
|
||||||
import { omit, pick } from '@/utils'
|
import { pick } from '@/utils'
|
||||||
|
|
||||||
export const DiffbotInputSchema = z.object({
|
export const DiffbotInputSchema = z.object({
|
||||||
url: z.string().describe('URL of page to scrape')
|
url: z.string().describe('URL of page to scrape')
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default defineConfig([
|
||||||
minify: false,
|
minify: false,
|
||||||
shims: true,
|
shims: true,
|
||||||
dts: true,
|
dts: true,
|
||||||
esbuildOptions(options, context) {
|
esbuildOptions(options) {
|
||||||
options.target = 'es2020'
|
options.target = 'es2020'
|
||||||
options.jsx = 'preserve'
|
options.jsx = 'preserve'
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue