kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
commit
9afc9a9b15
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
|
||||
"changelog": "@changesets/cli/changelog",
|
||||
"commit": false,
|
||||
"fixed": [],
|
||||
"linked": [],
|
||||
"access": "restricted",
|
||||
"baseBranch": "main",
|
||||
"privatePackages": false,
|
||||
"updateInternalDependencies": "patch",
|
||||
"ignore": []
|
||||
}
|
|
@ -10,7 +10,6 @@ node_modules
|
|||
|
||||
# next.js
|
||||
.next/
|
||||
out/
|
||||
|
||||
# production
|
||||
build/
|
||||
|
@ -29,6 +28,9 @@ yarn-error.log*
|
|||
# local env files
|
||||
.env*.local
|
||||
|
||||
# turbo
|
||||
.turbo
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ async function main() {
|
|||
console.log(browserTool.parameters)
|
||||
|
||||
const result = await generateText({
|
||||
model: openai('gpt-4o'),
|
||||
model: openai('gpt-4o-mini'),
|
||||
tools: { browserTool },
|
||||
toolChoice: 'required',
|
||||
temperature: 0,
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { WeatherClient } from '@agentic/stdlib'
|
||||
import { createAISDKTools } from '@agentic/stdlib/ai-sdk'
|
||||
import { createAISDKTools } from '@agentic/ai-sdk'
|
||||
import { WeatherClient } from '@agentic/weather'
|
||||
import { openai } from '@ai-sdk/openai'
|
||||
import { generateText } from 'ai'
|
||||
|
||||
|
@ -10,7 +10,7 @@ async function main() {
|
|||
const weather = new WeatherClient()
|
||||
|
||||
const result = await generateText({
|
||||
model: openai('gpt-4o'),
|
||||
model: openai('gpt-4o-mini'),
|
||||
tools: createAISDKTools(weather),
|
||||
toolChoice: 'required',
|
||||
temperature: 0,
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "agentic-examples-ai-sdk",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/ai-sdk": "workspace:*",
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/weather": "workspace:*",
|
||||
"@ai-sdk/openai": "^0.0.24",
|
||||
"@browserbasehq/sdk": "^1.4.2",
|
||||
"ai": "^3.1.30",
|
||||
"openai": "^4.49.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["bin"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1,18 +1,19 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { createDexterFunctions } from '@agentic/dexter'
|
||||
import { DiffbotClient, SearchAndCrawl, SerpAPIClient } from '@agentic/stdlib'
|
||||
import { createDexterFunctions } from '@agentic/stdlib/dexter'
|
||||
import { ChatModel, createAIRunner } from '@dexaai/dexter'
|
||||
|
||||
async function main() {
|
||||
const serpapi = new SerpAPIClient()
|
||||
const diffbot = new DiffbotClient()
|
||||
|
||||
const searchAndCrawl = new SearchAndCrawl({ serpapi, diffbot })
|
||||
|
||||
const runner = createAIRunner({
|
||||
chatModel: new ChatModel({
|
||||
params: { model: 'gpt-4o', temperature: 0 }
|
||||
params: { model: 'gpt-4o-mini', temperature: 0 }
|
||||
// debug: true
|
||||
}),
|
||||
functions: createDexterFunctions(searchAndCrawl),
|
|
@ -1,14 +1,14 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { createDexterFunctions } from '@agentic/stdlib/dexter'
|
||||
import { e2b } from '@agentic/stdlib/e2b'
|
||||
import { createDexterFunctions } from '@agentic/dexter'
|
||||
import { e2b } from '@agentic/e2b'
|
||||
import { ChatModel, createAIRunner } from '@dexaai/dexter'
|
||||
|
||||
async function main() {
|
||||
const runner = createAIRunner({
|
||||
chatModel: new ChatModel({
|
||||
params: { model: 'gpt-4o', temperature: 0 },
|
||||
params: { model: 'gpt-4o-mini', temperature: 0 },
|
||||
debug: true
|
||||
}),
|
||||
functions: createDexterFunctions(e2b)
|
|
@ -1,12 +1,9 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import {
|
||||
createAIChain,
|
||||
Msg,
|
||||
PerigonClient,
|
||||
SerperClient
|
||||
} from '@agentic/stdlib'
|
||||
import { createAIChain, Msg } from '@agentic/core'
|
||||
import { PerigonClient } from '@agentic/perigon'
|
||||
import { SerperClient } from '@agentic/serper'
|
||||
import { ChatModel } from '@dexaai/dexter'
|
||||
|
||||
async function main() {
|
||||
|
@ -14,7 +11,7 @@ async function main() {
|
|||
const serper = new SerperClient()
|
||||
|
||||
const chatModel = new ChatModel({
|
||||
params: { model: 'gpt-4o', temperature: 0 },
|
||||
params: { model: 'gpt-4o-mini', temperature: 0 },
|
||||
debug: true
|
||||
})
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { PerigonClient, SerperClient } from '@agentic/stdlib'
|
||||
import { createDexterFunctions } from '@agentic/stdlib/dexter'
|
||||
import { createDexterFunctions } from '@agentic/dexter'
|
||||
import { PerigonClient } from '@agentic/perigon'
|
||||
import { SerperClient } from '@agentic/serper'
|
||||
import { ChatModel, createAIRunner } from '@dexaai/dexter'
|
||||
|
||||
async function main() {
|
||||
|
@ -11,7 +12,7 @@ async function main() {
|
|||
|
||||
const runner = createAIRunner({
|
||||
chatModel: new ChatModel({
|
||||
params: { model: 'gpt-4o', temperature: 0 }
|
||||
params: { model: 'gpt-4o-mini', temperature: 0 }
|
||||
// debug: true
|
||||
}),
|
||||
functions: createDexterFunctions(
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { extractObject, Msg } from '@agentic/stdlib'
|
||||
import { extractObject, Msg } from '@agentic/core'
|
||||
import { ChatModel } from '@dexaai/dexter'
|
||||
import { z } from 'zod'
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { WeatherClient } from '@agentic/stdlib'
|
||||
import { createDexterFunctions } from '@agentic/stdlib/dexter'
|
||||
import { createDexterFunctions } from '@agentic/dexter'
|
||||
import { WeatherClient } from '@agentic/weather'
|
||||
import { ChatModel, createAIRunner } from '@dexaai/dexter'
|
||||
|
||||
async function main() {
|
||||
|
@ -10,7 +10,7 @@ async function main() {
|
|||
|
||||
const runner = createAIRunner({
|
||||
chatModel: new ChatModel({
|
||||
params: { model: 'gpt-4o', temperature: 0 }
|
||||
params: { model: 'gpt-4o-mini', temperature: 0 }
|
||||
// debug: true
|
||||
}),
|
||||
functions: createDexterFunctions(weather),
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "agentic-examples-dexter",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/dexter": "workspace:*",
|
||||
"@agentic/e2b": "workspace:*",
|
||||
"@agentic/perigon": "workspace:*",
|
||||
"@agentic/serper": "workspace:*",
|
||||
"@agentic/stdlib": "workspace:*",
|
||||
"@agentic/weather": "workspace:*",
|
||||
"@dexaai/dexter": "^2.1.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["bin"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { createGenkitTools } from '@agentic/genkit'
|
||||
import { WeatherClient } from '@agentic/stdlib'
|
||||
import { createGenkitTools } from '@agentic/stdlib/genkit'
|
||||
import { generate } from '@genkit-ai/ai'
|
||||
import { configureGenkit } from '@genkit-ai/core'
|
||||
import { gpt4o, openAI } from 'genkitx-openai'
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "agentic-examples-genkit",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/genkit": "workspace:*",
|
||||
"@agentic/stdlib": "workspace:*",
|
||||
"@genkit-ai/ai": "^0.5.9",
|
||||
"@genkit-ai/core": "^0.5.9",
|
||||
"genkitx-openai": "^0.10.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["bin"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { createLangChainTools } from '@agentic/langchain'
|
||||
import { WeatherClient } from '@agentic/stdlib'
|
||||
import { createLangChainTools } from '@agentic/stdlib/langchain'
|
||||
import { ChatPromptTemplate } from '@langchain/core/prompts'
|
||||
import { ChatOpenAI } from '@langchain/openai'
|
||||
import { AgentExecutor, createToolCallingAgent } from 'langchain/agents'
|
||||
|
@ -12,7 +12,7 @@ async function main() {
|
|||
|
||||
const tools = createLangChainTools(weather)
|
||||
const agent = createToolCallingAgent({
|
||||
llm: new ChatOpenAI({ model: 'gpt-4o', temperature: 0 }),
|
||||
llm: new ChatOpenAI({ model: 'gpt-4o-mini', temperature: 0 }),
|
||||
tools,
|
||||
prompt: ChatPromptTemplate.fromMessages([
|
||||
['system', 'You are a helpful assistant. Be as concise as possible.'],
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "agentic-examples-langchain",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/langchain": "workspace:*",
|
||||
"@agentic/stdlib": "workspace:*",
|
||||
"@langchain/core": "^0.2.20",
|
||||
"@langchain/openai": "^0.2.5",
|
||||
"langchain": "^0.2.12",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["bin"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { createLlamaIndexTools } from '@agentic/llamaindex'
|
||||
import { WeatherClient } from '@agentic/stdlib'
|
||||
import { createLlamaIndexTools } from '@agentic/stdlib/llamaindex'
|
||||
import { OpenAI, OpenAIAgent } from 'llamaindex'
|
||||
|
||||
async function main() {
|
||||
|
@ -10,7 +10,7 @@ async function main() {
|
|||
|
||||
const tools = createLlamaIndexTools(weather)
|
||||
const agent = new OpenAIAgent({
|
||||
llm: new OpenAI({ model: 'gpt-4o', temperature: 0 }),
|
||||
llm: new OpenAI({ model: 'gpt-4o-mini', temperature: 0 }),
|
||||
systemPrompt: 'You are a helpful assistant. Be as concise as possible.',
|
||||
tools
|
||||
})
|
||||
|
@ -19,7 +19,7 @@ async function main() {
|
|||
message: 'What is the weather in San Francisco?'
|
||||
})
|
||||
|
||||
console.log(response.response.message.content)
|
||||
console.log(response.message.content)
|
||||
}
|
||||
|
||||
await main()
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "agentic-examples-llamaindex",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/llamaindex": "workspace:*",
|
||||
"@agentic/stdlib": "workspace:*",
|
||||
"llamaindex": "^0.5.13",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["bin"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { assert, WeatherClient } from '@agentic/stdlib'
|
||||
import { assert } from '@agentic/core'
|
||||
import { WeatherClient } from '@agentic/stdlib'
|
||||
import OpenAI from 'openai'
|
||||
|
||||
async function main() {
|
||||
|
@ -20,7 +21,7 @@ async function main() {
|
|||
// First call to OpenAI to invoke the weather tool
|
||||
const res = await openai.chat.completions.create({
|
||||
messages,
|
||||
model: 'gpt-4o',
|
||||
model: 'gpt-4o-mini',
|
||||
temperature: 0,
|
||||
tools: weather.functions.toolSpecs,
|
||||
tool_choice: 'required'
|
||||
|
@ -47,11 +48,11 @@ async function main() {
|
|||
// Second call to OpenAI to generate a text response
|
||||
const res = await openai.chat.completions.create({
|
||||
messages,
|
||||
model: 'gpt-4o',
|
||||
model: 'gpt-4o-mini',
|
||||
temperature: 0,
|
||||
tools: weather.functions.toolSpecs
|
||||
})
|
||||
const message = res.choices[0].message
|
||||
const message = res.choices?.[0]?.message
|
||||
console.log(JSON.stringify(message, null, 2))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "agentic-examples-openai",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/stdlib": "workspace:*",
|
||||
"openai": "^4.49.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["bin"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"name": "agentic-examples",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"description": "Examples of how to use the Agentic AI SDK.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"packageManager": "pnpm@9.2.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"build": "tsc",
|
||||
"clean": "del dist",
|
||||
"prebuild": "run-s clean",
|
||||
"pretest": "run-s build",
|
||||
"test": "run-s test:*",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/stdlib": "workspace:*",
|
||||
"@ai-sdk/openai": "^0.0.24",
|
||||
"@dexaai/dexter": "^2.1.0",
|
||||
"@genkit-ai/ai": "^0.5.2",
|
||||
"@genkit-ai/core": "^0.5.2",
|
||||
"@langchain/core": "^0.2.6",
|
||||
"@langchain/openai": "^0.1.2",
|
||||
"ai": "^3.1.30",
|
||||
"dotenv": "^16.4.5",
|
||||
"genkitx-openai": "^0.10.0",
|
||||
"langchain": "^0.2.5",
|
||||
"llamaindex": "^0.3.16",
|
||||
"openai": "^4.49.0",
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
#!/usr/bin/env node
|
||||
import 'dotenv/config'
|
||||
|
||||
import { SerperClient } from '@agentic/stdlib'
|
||||
import restoreCursor from 'restore-cursor'
|
||||
|
||||
import { SerperClient } from '../src'
|
||||
|
||||
/**
|
||||
* Scratch pad for testing.
|
||||
*/
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "agentic-examples-playground",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/stdlib": "workspace:*",
|
||||
"restore-cursor": "^5.1.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["bin"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["ai-sdk", "dexter", "genkit", "langchain", "llamaindex", "openai"]
|
||||
}
|
200
package.json
200
package.json
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "@agentic/stdlib",
|
||||
"version": "6.6.1",
|
||||
"description": "AI function stdlib that works with any LLM and TypeScript AI SDK.",
|
||||
"name": "agentic",
|
||||
"private": true,
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
@ -13,189 +12,52 @@
|
|||
"node": ">=18"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./ai-sdk": {
|
||||
"types": "./dist/sdks/ai-sdk.d.ts",
|
||||
"import": "./dist/sdks/ai-sdk.js",
|
||||
"default": "./dist/sdks/ai-sdk.js"
|
||||
},
|
||||
"./dexter": {
|
||||
"types": "./dist/sdks/dexter.d.ts",
|
||||
"import": "./dist/sdks/dexter.js",
|
||||
"default": "./dist/sdks/dexter.js"
|
||||
},
|
||||
"./genkit": {
|
||||
"types": "./dist/sdks/genkit.d.ts",
|
||||
"import": "./dist/sdks/genkit.js",
|
||||
"default": "./dist/sdks/genkit.js"
|
||||
},
|
||||
"./langchain": {
|
||||
"types": "./dist/sdks/langchain.d.ts",
|
||||
"import": "./dist/sdks/langchain.js",
|
||||
"default": "./dist/sdks/langchain.js"
|
||||
},
|
||||
"./llamaindex": {
|
||||
"types": "./dist/sdks/llamaindex.d.ts",
|
||||
"import": "./dist/sdks/llamaindex.js",
|
||||
"default": "./dist/sdks/llamaindex.js"
|
||||
},
|
||||
"./calculator": {
|
||||
"types": "./dist/tools/calculator.d.ts",
|
||||
"import": "./dist/tools/calculator.js",
|
||||
"default": "./dist/tools/calculator.js"
|
||||
},
|
||||
"./e2b": {
|
||||
"types": "./dist/tools/e2b.d.ts",
|
||||
"import": "./dist/tools/e2b.js",
|
||||
"default": "./dist/tools/e2b.js"
|
||||
},
|
||||
"./twitter": {
|
||||
"types": "./dist/services/twitter/index.d.ts",
|
||||
"import": "./dist/services/twitter/index.js",
|
||||
"default": "./dist/services/twitter/index.js"
|
||||
},
|
||||
"./github": {
|
||||
"types": "./dist/services/github-client.d.ts",
|
||||
"import": "./dist/services/github-client.js",
|
||||
"default": "./dist/services/github-client.js"
|
||||
},
|
||||
"./wikidata": {
|
||||
"types": "./dist/services/wikidata-client.d.ts",
|
||||
"import": "./dist/services/wikidata-client.js",
|
||||
"default": "./dist/services/wikidata-client.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"build": "tsup",
|
||||
"dev": "tsup --watch",
|
||||
"clean": "del dist",
|
||||
"prebuild": "run-s clean",
|
||||
"predev": "run-s clean",
|
||||
"pretest": "run-s build",
|
||||
"prepare": "husky",
|
||||
"precommit": "lint-staged",
|
||||
"test": "run-s test:*",
|
||||
"build": "turbo build",
|
||||
"clean": "turbo clean",
|
||||
"test": "turbo test",
|
||||
"test:format": "prettier --check \"**/*.{js,ts,tsx}\"",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit",
|
||||
"test:unit": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"dedent": "^1.5.3",
|
||||
"delay": "^6.0.0",
|
||||
"hash-object": "^5.0.1",
|
||||
"is-relative-url": "^4.0.0",
|
||||
"jsonrepair": "^3.6.1",
|
||||
"ky": "^1.5.0",
|
||||
"normalize-url": "^8.0.1",
|
||||
"p-map": "^7.0.2",
|
||||
"p-throttle": "^6.1.0",
|
||||
"quick-lru": "^7.0.0",
|
||||
"type-fest": "^4.21.0",
|
||||
"zod": "^3.23.3",
|
||||
"zod-to-json-schema": "^3.23.2",
|
||||
"zod-validation-error": "^3.3.0"
|
||||
"test:lint": "turbo test:lint",
|
||||
"test:typecheck": "turbo test:typecheck",
|
||||
"test:unit": "turbo test:unit",
|
||||
"changeset": "changeset",
|
||||
"release": "run-s release:*",
|
||||
"release:build": "run-s build",
|
||||
"release:version": "changeset version",
|
||||
"release:publish": "changeset publish",
|
||||
"precommit": "lint-staged",
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aws-sdk/client-sso-oidc": "^3.620.1",
|
||||
"@browserbasehq/sdk": "^1.4.2",
|
||||
"@dexaai/dexter": "^2.1.0",
|
||||
"@e2b/code-interpreter": "^0.0.8",
|
||||
"@changesets/cli": "^2.27.7",
|
||||
"@fisch0920/eslint-config": "^1.4.0",
|
||||
"@genkit-ai/ai": "^0.5.8",
|
||||
"@langchain/core": "^0.2.18",
|
||||
"@nangohq/node": "^0.42.2",
|
||||
"@total-typescript/ts-reset": "^0.5.1",
|
||||
"@types/node": "^22.0.0",
|
||||
"ai": "^3.2.39",
|
||||
"@types/node": "^22.1.0",
|
||||
"del-cli": "^5.1.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"eslint": "^8.57.0",
|
||||
"husky": "^9.1.4",
|
||||
"lint-staged": "^15.2.7",
|
||||
"llamaindex": "^0.5.11",
|
||||
"mathjs": "^13.0.3",
|
||||
"np": "^10.0.7",
|
||||
"lint-staged": "^15.2.8",
|
||||
"npm-run-all2": "^6.2.2",
|
||||
"octokit": "^4.0.2",
|
||||
"only-allow": "^1.2.1",
|
||||
"openai-fetch": "^2.0.4",
|
||||
"prettier": "^3.3.3",
|
||||
"restore-cursor": "^5.1.0",
|
||||
"tsup": "^8.2.3",
|
||||
"tsx": "^4.16.2",
|
||||
"twitter-api-sdk": "^1.2.1",
|
||||
"tsup": "^8.2.4",
|
||||
"tsx": "^4.16.5",
|
||||
"turbo": "^2.0.11",
|
||||
"typescript": "^5.5.4",
|
||||
"vitest": "2.0.4",
|
||||
"wikibase-sdk": "^10.0.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@dexaai/dexter": "^2.0.3",
|
||||
"@e2b/code-interpreter": "^0.0.7",
|
||||
"@genkit-ai/ai": "^0.5.2",
|
||||
"@langchain/core": "^0.2.6",
|
||||
"@nangohq/node": "^0.39.33",
|
||||
"ai": "^3.1.30",
|
||||
"llamaindex": "^0.3.16",
|
||||
"mathjs": "^13.0.0",
|
||||
"octokit": "^4.0.2",
|
||||
"twitter-api-sdk": "^1.2.1",
|
||||
"wikibase-sdk": "^10.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@dexaai/dexter": {
|
||||
"optional": true
|
||||
},
|
||||
"@e2b/code-interpreter": {
|
||||
"optional": true
|
||||
},
|
||||
"@genkit-ai/ai": {
|
||||
"optional": true
|
||||
},
|
||||
"@langchain/core": {
|
||||
"optional": true
|
||||
},
|
||||
"@nangohq/node": {
|
||||
"optional": true
|
||||
},
|
||||
"ai": {
|
||||
"optional": true
|
||||
},
|
||||
"llamaindex": {
|
||||
"optional": true
|
||||
},
|
||||
"mathjs": {
|
||||
"optional": true
|
||||
},
|
||||
"octokit": {
|
||||
"optional": true
|
||||
},
|
||||
"twitter-api-sdk": {
|
||||
"optional": true
|
||||
},
|
||||
"wikibase-sdk": {
|
||||
"optional": true
|
||||
}
|
||||
"vitest": "2.0.5",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": [
|
||||
"eslint --fix",
|
||||
"prettier --ignore-unknown --write"
|
||||
"prettier --ignore-unknown --write",
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"esbuild": "^0.23.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# @agentic/ai-sdk
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- cba1cc7: Move to monorepo and multiple packages
|
||||
|
||||
See https://github.com/transitive-bullshit/agentic/issues/654 and https://github.com/transitive-bullshit/agentic/pull/657 for more info.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cba1cc7]
|
||||
- @agentic/core@7.0.0
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "@agentic/ai-sdk",
|
||||
"version": "7.0.0",
|
||||
"description": "Agentic adapter for the Vercel AI SDK.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup --config ../../tsup.config.ts",
|
||||
"dev": "tsup --config ../../tsup.config.ts --watch",
|
||||
"clean": "del dist",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit",
|
||||
"test:unit": "vitest run"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"ai": "^3.1.30"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/tsconfig": "workspace:*",
|
||||
"ai": "^3.1.30"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
import { EchoAITool } from '@agentic/core'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
|
||||
import { createAISDKTools } from './ai-sdk'
|
||||
|
||||
describe('ai-sdk', () => {
|
||||
test('createAISDKTools', () => {
|
||||
expect(createAISDKTools(new EchoAITool())).toHaveProperty('echo')
|
||||
})
|
||||
})
|
|
@ -1,8 +1,6 @@
|
|||
import { type AIFunctionLike, AIFunctionSet } from '@agentic/core'
|
||||
import { tool } from 'ai'
|
||||
|
||||
import type { AIFunctionLike } from '../types'
|
||||
import { AIFunctionSet } from '../ai-function-set'
|
||||
|
||||
/**
|
||||
* Converts a set of Agentic stdlib AI functions to an object compatible with
|
||||
* the Vercel AI SDK's `tools` parameter.
|
|
@ -0,0 +1 @@
|
|||
export * from './ai-sdk'
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# @agentic/bing
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- cba1cc7: Move to monorepo and multiple packages
|
||||
|
||||
See https://github.com/transitive-bullshit/agentic/issues/654 and https://github.com/transitive-bullshit/agentic/pull/657 for more info.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cba1cc7]
|
||||
- @agentic/core@7.0.0
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "@agentic/bing",
|
||||
"version": "7.0.0",
|
||||
"description": "Agentic SDK for Bing search.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup --config ../../tsup.config.ts",
|
||||
"dev": "tsup --config ../../tsup.config.ts --watch",
|
||||
"clean": "del dist",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"ky": "^1.5.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -1,9 +1,13 @@
|
|||
import {
|
||||
aiFunction,
|
||||
AIFunctionsProvider,
|
||||
assert,
|
||||
getEnv,
|
||||
omit
|
||||
} from '@agentic/core'
|
||||
import defaultKy, { type KyInstance } from 'ky'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { aiFunction, AIFunctionsProvider } from '../fns'
|
||||
import { assert, getEnv, omit } from '../utils'
|
||||
|
||||
export namespace bing {
|
||||
export const API_BASE_URL = 'https://api.bing.microsoft.com'
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from './bing-client'
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# @agentic/calculator
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- cba1cc7: Move to monorepo and multiple packages
|
||||
|
||||
See https://github.com/transitive-bullshit/agentic/issues/654 and https://github.com/transitive-bullshit/agentic/pull/657 for more info.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cba1cc7]
|
||||
- @agentic/core@7.0.0
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "@agentic/calculator",
|
||||
"version": "7.0.0",
|
||||
"description": "Agentic calculator tool wrapping mathjs.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup --config ../../tsup.config.ts",
|
||||
"dev": "tsup --config ../../tsup.config.ts --watch",
|
||||
"clean": "del dist",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"ky": "^1.5.0",
|
||||
"mathjs": "^13.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
import { createAIFunction } from '@agentic/core'
|
||||
import { evaluate } from 'mathjs'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { createAIFunction } from '../create-ai-function'
|
||||
|
||||
// TODO: ensure `expr` is sanitized to not run arbitrary code
|
||||
|
||||
export const CalculatorInputSchema = z.object({
|
|
@ -0,0 +1 @@
|
|||
export * from './calculator'
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# @agentic/clearbit
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- cba1cc7: Move to monorepo and multiple packages
|
||||
|
||||
See https://github.com/transitive-bullshit/agentic/issues/654 and https://github.com/transitive-bullshit/agentic/pull/657 for more info.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cba1cc7]
|
||||
- @agentic/core@7.0.0
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "@agentic/clearbit",
|
||||
"version": "7.0.0",
|
||||
"description": "Agentic SDK for Clearbit.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup --config ../../tsup.config.ts",
|
||||
"dev": "tsup --config ../../tsup.config.ts --watch",
|
||||
"clean": "del dist",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"ky": "^1.5.0",
|
||||
"p-throttle": "^6.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -1,7 +1,3 @@
|
|||
import defaultKy from 'ky'
|
||||
import pThrottle from 'p-throttle'
|
||||
|
||||
import type { KyInstance } from '../types'
|
||||
import {
|
||||
assert,
|
||||
delay,
|
||||
|
@ -9,7 +5,9 @@ import {
|
|||
pruneNullOrUndefinedDeep,
|
||||
sanitizeSearchParams,
|
||||
throttleKy
|
||||
} from '../utils'
|
||||
} from '@agentic/core'
|
||||
import defaultKy, { type KyInstance } from 'ky'
|
||||
import pThrottle from 'p-throttle'
|
||||
|
||||
export namespace clearbit {
|
||||
// Allow up to 600 requests per minute by default.
|
|
@ -0,0 +1 @@
|
|||
export * from './clearbit-client'
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
# @agentic/core
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- cba1cc7: Move to monorepo and multiple packages
|
||||
|
||||
See https://github.com/transitive-bullshit/agentic/issues/654 and https://github.com/transitive-bullshit/agentic/pull/657 for more info.
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "@agentic/core",
|
||||
"version": "7.0.0",
|
||||
"description": "Agentic AI utils which work with any LLM and TypeScript AI SDK.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup --config ../../tsup.config.ts",
|
||||
"dev": "tsup --config ../../tsup.config.ts --watch",
|
||||
"clean": "del dist",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit",
|
||||
"test:unit": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^7.0.0",
|
||||
"dedent": "^1.5.3",
|
||||
"delay": "^6.0.0",
|
||||
"hash-object": "^5.0.1",
|
||||
"is-relative-url": "^4.0.0",
|
||||
"jsonrepair": "^3.6.1",
|
||||
"ky": "^1.5.0",
|
||||
"normalize-url": "^8.0.1",
|
||||
"p-map": "^7.0.2",
|
||||
"p-throttle": "^6.1.0",
|
||||
"quick-lru": "^7.0.0",
|
||||
"type-fest": "^4.21.0",
|
||||
"zod-to-json-schema": "^3.23.2",
|
||||
"zod-validation-error": "^3.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/tsconfig": "workspace:*",
|
||||
"openai-fetch": "^2.0.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
import 'dotenv/config'
|
||||
|
||||
import defaultKy, {
|
||||
type AfterResponseHook,
|
||||
type BeforeRequestHook,
|
|
@ -0,0 +1,50 @@
|
|||
import { expect, test } from 'vitest'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { AIFunctionSet } from './ai-function-set'
|
||||
import { createAIFunction } from './create-ai-function'
|
||||
import { EchoAITool } from './echo'
|
||||
|
||||
export const CalculatorInputSchema = z.object({
|
||||
expr: z.string().describe('mathematical expression to evaluate')
|
||||
})
|
||||
export type CalculatorInput = z.infer<typeof CalculatorInputSchema>
|
||||
|
||||
const mockCalculator = createAIFunction(
|
||||
{
|
||||
name: 'calculator',
|
||||
description:
|
||||
'Computes the result of simple mathematical expressions. Handles basic arithmetic operations like addition, subtraction, multiplication, and division. Example expressions: "1 + 2", "3.4 * 5 / 9", "4 - 2"',
|
||||
inputSchema: CalculatorInputSchema
|
||||
},
|
||||
async (input: CalculatorInput) => {
|
||||
// eslint-disable-next-line no-eval, security/detect-eval-with-expression
|
||||
const result: number = eval(input.expr)
|
||||
return result
|
||||
}
|
||||
)
|
||||
|
||||
test('AIFunctionSet constructor', () => {
|
||||
const mockAITool = new EchoAITool()
|
||||
const s0 = new AIFunctionSet([mockAITool, mockCalculator])
|
||||
|
||||
expect(s0.size).toEqual(2)
|
||||
expect(s0.get('echo')).toBeDefined()
|
||||
expect(s0.get('calculator')).toBeDefined()
|
||||
expect([...s0].length).toEqual(2)
|
||||
|
||||
const s1 = new AIFunctionSet([s0, mockAITool, mockCalculator, mockCalculator])
|
||||
expect(s0.size).toEqual(2)
|
||||
expect(s1.size).toEqual(2)
|
||||
expect(s1.get('echo')).toBeDefined()
|
||||
expect(s1.get('calculator')).toBeDefined()
|
||||
expect([...s1].length).toEqual(2)
|
||||
})
|
||||
|
||||
test('AIFunctionSet constructor invalid function', () => {
|
||||
const mockAITool = new EchoAITool()
|
||||
|
||||
expect(
|
||||
() => new AIFunctionSet([mockAITool, mockCalculator, { spec: {} } as any])
|
||||
).toThrowError('Invalid AIFunctionLike: [object Object]')
|
||||
})
|
|
@ -0,0 +1,30 @@
|
|||
import { isError } from '@sindresorhus/is'
|
||||
|
||||
function assertImpl(value: unknown, message?: string | Error): asserts value {
|
||||
if (value) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!message) {
|
||||
throw new Error('Assertion failed')
|
||||
}
|
||||
|
||||
throw isError(message) ? message : new Error(message)
|
||||
}
|
||||
|
||||
/**
|
||||
* Assertion function that defaults to Node.js's `assert` module if it's
|
||||
* available, with a basic backup if not.
|
||||
*/
|
||||
let assert: (value: unknown, message?: string | Error) => asserts value =
|
||||
assertImpl
|
||||
|
||||
try {
|
||||
// Default to the Node.js assert module if it's available
|
||||
const assertImport = await import('node:assert')
|
||||
if (assertImport?.default) {
|
||||
assert = assertImport.default
|
||||
}
|
||||
} catch {}
|
||||
|
||||
export { assert }
|
|
@ -0,0 +1,36 @@
|
|||
import { z } from 'zod'
|
||||
|
||||
import { createAIFunction } from './create-ai-function'
|
||||
import { aiFunction, AIFunctionsProvider } from './fns'
|
||||
|
||||
/**
|
||||
* Test AI tool with one function `echo`, which echoes the input.
|
||||
*/
|
||||
export class EchoAITool extends AIFunctionsProvider {
|
||||
@aiFunction({
|
||||
name: 'echo',
|
||||
description: 'Echoes the input.',
|
||||
inputSchema: z.object({
|
||||
query: z.string().describe('input query to echo')
|
||||
})
|
||||
})
|
||||
async echo({ query }: { query: string }) {
|
||||
return query
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test AI function `echo`, which echoes the input.
|
||||
*/
|
||||
export const echoAIFunction = createAIFunction(
|
||||
{
|
||||
name: 'echo',
|
||||
description: 'Echoes the input.',
|
||||
inputSchema: z.object({
|
||||
query: z.string().describe('input query to echo')
|
||||
})
|
||||
},
|
||||
({ query }: { query: string }) => {
|
||||
return query
|
||||
}
|
||||
)
|
|
@ -1,14 +1,13 @@
|
|||
export * from './ai-function-set'
|
||||
export * from './create-ai-chain'
|
||||
export * from './create-ai-function'
|
||||
export * from './echo'
|
||||
export * from './errors'
|
||||
export * from './extract-object'
|
||||
export * from './fns'
|
||||
export * from './message'
|
||||
export * from './parse-structured-output'
|
||||
export * from './schema'
|
||||
export * from './services'
|
||||
export * from './tools/search-and-crawl'
|
||||
export type * from './types'
|
||||
export * from './url-utils'
|
||||
export * from './utils'
|
|
@ -8,7 +8,7 @@ import { zodToJsonSchema } from './zod-to-json-schema'
|
|||
/**
|
||||
* Used to mark schemas so we can support both Zod and custom schemas.
|
||||
*/
|
||||
export const schemaSymbol = Symbol('agentic..schema')
|
||||
export const schemaSymbol = Symbol('agentic.schema')
|
||||
export const validatorSymbol = Symbol('agentic.validator')
|
||||
|
||||
export type Schema<TData = unknown> = {
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# @agentic/dexa
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- cba1cc7: Move to monorepo and multiple packages
|
||||
|
||||
See https://github.com/transitive-bullshit/agentic/issues/654 and https://github.com/transitive-bullshit/agentic/pull/657 for more info.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cba1cc7]
|
||||
- @agentic/core@7.0.0
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "@agentic/dexa",
|
||||
"version": "7.0.0",
|
||||
"description": "Agentic SDK for Dexa's API (currently closed beta).",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup --config ../../tsup.config.ts",
|
||||
"dev": "tsup --config ../../tsup.config.ts --watch",
|
||||
"clean": "del dist",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"ky": "^1.5.0",
|
||||
"p-throttle": "^6.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
import {
|
||||
aiFunction,
|
||||
AIFunctionsProvider,
|
||||
assert,
|
||||
getEnv,
|
||||
Msg
|
||||
} from '@agentic/core'
|
||||
import defaultKy, { type KyInstance } from 'ky'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { aiFunction, AIFunctionsProvider } from '../fns'
|
||||
import { Msg } from '../message'
|
||||
import { assert, getEnv } from '../utils'
|
||||
|
||||
export namespace dexa {
|
||||
export const AskDexaOptionsSchema = z.object({
|
||||
question: z.string().describe('The question to ask Dexa.')
|
|
@ -0,0 +1,2 @@
|
|||
export * from './dexa-client'
|
||||
export * from './scraper-client'
|
|
@ -1,10 +1,15 @@
|
|||
import {
|
||||
aiFunction,
|
||||
AIFunctionsProvider,
|
||||
assert,
|
||||
getEnv,
|
||||
omit,
|
||||
throttleKy
|
||||
} from '@agentic/core'
|
||||
import defaultKy, { type KyInstance } from 'ky'
|
||||
import pThrottle from 'p-throttle'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { aiFunction, AIFunctionsProvider } from '../fns'
|
||||
import { assert, getEnv, omit, throttleKy } from '../utils'
|
||||
|
||||
export namespace scraper {
|
||||
// Allow up to 1 request per second by default.
|
||||
export const throttle = pThrottle({
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# @agentic/dexter
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- cba1cc7: Move to monorepo and multiple packages
|
||||
|
||||
See https://github.com/transitive-bullshit/agentic/issues/654 and https://github.com/transitive-bullshit/agentic/pull/657 for more info.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cba1cc7]
|
||||
- @agentic/core@7.0.0
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "@agentic/dexter",
|
||||
"version": "7.0.0",
|
||||
"description": "Agentic adapter for the Dexter AI SDK by Dexa.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup --config ../../tsup.config.ts",
|
||||
"dev": "tsup --config ../../tsup.config.ts --watch",
|
||||
"clean": "del dist",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit",
|
||||
"test:unit": "vitest run"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@dexaai/dexter": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/tsconfig": "workspace:*",
|
||||
"@dexaai/dexter": "^2.1.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
import { EchoAITool } from '@agentic/core'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
|
||||
import { createDexterFunctions } from './dexter'
|
||||
|
||||
describe('dexter', () => {
|
||||
test('createDexterFunctions', () => {
|
||||
expect(createDexterFunctions(new EchoAITool())).toHaveLength(1)
|
||||
})
|
||||
})
|
|
@ -1,8 +1,6 @@
|
|||
import { type AIFunctionLike, AIFunctionSet } from '@agentic/core'
|
||||
import { createAIFunction } from '@dexaai/dexter'
|
||||
|
||||
import type { AIFunctionLike } from '../types'
|
||||
import { AIFunctionSet } from '../ai-function-set'
|
||||
|
||||
/**
|
||||
* Converts a set of Agentic stdlib AI functions to an array of Dexter-
|
||||
* compatible AI functions.
|
|
@ -0,0 +1 @@
|
|||
export * from './dexter'
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# @agentic/diffbot
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- cba1cc7: Move to monorepo and multiple packages
|
||||
|
||||
See https://github.com/transitive-bullshit/agentic/issues/654 and https://github.com/transitive-bullshit/agentic/pull/657 for more info.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cba1cc7]
|
||||
- @agentic/core@7.0.0
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "@agentic/diffbot",
|
||||
"version": "7.0.0",
|
||||
"description": "Agentic SDK for Diffbot.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/transitive-bullshit/agentic.git"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup --config ../../tsup.config.ts",
|
||||
"dev": "tsup --config ../../tsup.config.ts --watch",
|
||||
"clean": "del dist",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"ky": "^1.5.0",
|
||||
"p-throttle": "^6.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/tsconfig": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -1,10 +1,15 @@
|
|||
import {
|
||||
aiFunction,
|
||||
AIFunctionsProvider,
|
||||
assert,
|
||||
getEnv,
|
||||
sanitizeSearchParams,
|
||||
throttleKy
|
||||
} from '@agentic/core'
|
||||
import defaultKy, { type KyInstance } from 'ky'
|
||||
import pThrottle from 'p-throttle'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { aiFunction, AIFunctionsProvider } from '../fns'
|
||||
import { assert, getEnv, sanitizeSearchParams, throttleKy } from '../utils'
|
||||
|
||||
export namespace diffbot {
|
||||
export const API_BASE_URL = 'https://api.diffbot.com'
|
||||
export const KNOWLEDGE_GRAPH_API_BASE_URL = 'https://kg.diffbot.com'
|
|
@ -0,0 +1 @@
|
|||
export * from './diffbot-client'
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "@agentic/tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue