Skip to content

Commit

Permalink
feat: WIP closer to completing monorepo transition
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Aug 4, 2024
1 parent 9164ce1 commit ee1bf47
Show file tree
Hide file tree
Showing 29 changed files with 810 additions and 59 deletions.
13 changes: 1 addition & 12 deletions examples/ai-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
{
"name": "agentic-examples-ai-sdk",
"private": true,
"description": "Examples of how to use the Agentic AI SDK.",
"author": "Travis Fischer <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/transitive-bullshit/agentic.git"
},
"type": "module",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "tsc",
"clean": "del dist",
"test": "run-s test:*",
"test:lint": "eslint .",
"test:typecheck": "tsc --noEmit"
Expand All @@ -24,7 +14,6 @@
"@ai-sdk/openai": "^0.0.24",
"@browserbasehq/sdk": "^1.4.2",
"ai": "^3.1.30",
"dotenv": "^16.4.5",
"openai": "^4.49.0",
"zod": "^3.23.8"
},
Expand Down
7 changes: 5 additions & 2 deletions examples/dexter/analyze.ts → examples/dexter/bin/analyze.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env node
import 'dotenv/config'

import { DiffbotClient, SearchAndCrawl, SerpAPIClient } from '@agentic/stdlib'
import { createDexterFunctions } from '@agentic/stdlib/dexter'
import { createDexterFunctions } from '@agentic/dexter'
import { DiffbotClient } from '@agentic/diffbot'
import { SearchAndCrawl } from '@agentic/search-and-crawl'
import { SerpAPIClient } from '@agentic/serpapi'
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({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
4 changes: 2 additions & 2 deletions examples/dexter/weather.ts → examples/dexter/bin/weather.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
26 changes: 26 additions & 0 deletions examples/dexter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"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/diffbot": "workspace:*",
"@agentic/e2b": "workspace:*",
"@agentic/perigon": "workspace:*",
"@agentic/search-and-crawl": "workspace:*",
"@agentic/serpapi": "workspace:*",
"@agentic/serper": "workspace:*",
"@agentic/weather": "workspace:*",
"@dexaai/dexter": "^2.1.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@agentic/tsconfig": "workspace:*"
}
}
5 changes: 5 additions & 0 deletions examples/dexter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@agentic/tsconfig/base.json",
"include": ["bin"],
"exclude": ["node_modules", "dist"]
}
4 changes: 2 additions & 2 deletions examples/genkit/weather.ts → examples/genkit/bin/weather.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node
import 'dotenv/config'

import { WeatherClient } from '@agentic/stdlib'
import { createGenkitTools } from '@agentic/stdlib/genkit'
import { createGenkitTools } from '@agentic/genkit'
import { WeatherClient } from '@agentic/weather'
import { generate } from '@genkit-ai/ai'
import { configureGenkit } from '@genkit-ai/core'
import { gpt4o, openAI } from 'genkitx-openai'
Expand Down
23 changes: 23 additions & 0 deletions examples/genkit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "agentic-examples-genkit",
"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/genkit": "workspace:*",
"@agentic/weather": "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:*"
}
}
5 changes: 5 additions & 0 deletions examples/genkit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@agentic/tsconfig/base.json",
"include": ["bin"],
"exclude": ["node_modules", "dist"]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node
import 'dotenv/config'

import { WeatherClient } from '@agentic/stdlib'
import { createLangChainTools } from '@agentic/stdlib/langchain'
import { createLangChainTools } from '@agentic/langchain'
import { WeatherClient } from '@agentic/weather'
import { ChatPromptTemplate } from '@langchain/core/prompts'
import { ChatOpenAI } from '@langchain/openai'
import { AgentExecutor, createToolCallingAgent } from 'langchain/agents'
Expand Down
22 changes: 22 additions & 0 deletions examples/langchain/package.json
Original file line number Diff line number Diff line change
@@ -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/weather": "workspace:*",
"@langchain/core": "^0.2.20",
"@langchain/openai": "^0.2.5",
"langchain": "^0.2.12",
"zod": "^3.23.8"
},
"devDependencies": {
"@agentic/tsconfig": "workspace:*"
}
}
5 changes: 5 additions & 0 deletions examples/langchain/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@agentic/tsconfig/base.json",
"include": ["bin"],
"exclude": ["node_modules", "dist"]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node
import 'dotenv/config'

import { WeatherClient } from '@agentic/stdlib'
import { createLlamaIndexTools } from '@agentic/stdlib/llamaindex'
import { createLlamaIndexTools } from '@agentic/llamaindex'
import { WeatherClient } from '@agentic/weather'
import { OpenAI, OpenAIAgent } from 'llamaindex'

async function main() {
Expand All @@ -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()
20 changes: 20 additions & 0 deletions examples/llamaindex/package.json
Original file line number Diff line number Diff line change
@@ -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/weather": "workspace:*",
"llamaindex": "^0.5.13",
"zod": "^3.23.8"
},
"devDependencies": {
"@agentic/tsconfig": "workspace:*"
}
}
5 changes: 5 additions & 0 deletions examples/llamaindex/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@agentic/tsconfig/base.json",
"include": ["bin"],
"exclude": ["node_modules", "dist"]
}
5 changes: 3 additions & 2 deletions examples/openai/weather.ts → examples/openai/bin/weather.ts
Original file line number Diff line number Diff line change
@@ -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/weather'
import OpenAI from 'openai'

async function main() {
Expand Down Expand Up @@ -51,7 +52,7 @@ async function main() {
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))
}
}
Expand Down
19 changes: 19 additions & 0 deletions examples/openai/package.json
Original file line number Diff line number Diff line change
@@ -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/weather": "workspace:*",
"openai": "^4.49.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@agentic/tsconfig": "workspace:*"
}
}
5 changes: 5 additions & 0 deletions examples/openai/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@agentic/tsconfig/base.json",
"include": ["bin"],
"exclude": ["node_modules", "dist"]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@total-typescript/ts-reset": "^0.5.1",
"@types/node": "^22.0.0",
"del-cli": "^5.1.0",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"husky": "^9.1.4",
"lint-staged": "^15.2.7",
Expand Down
49 changes: 49 additions & 0 deletions packages/search-and-crawl/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "@agentic/search-and-crawl",
"version": "6.6.1",
"description": "Agentic SDK for Google search and crawling the top results.",
"author": "Travis Fischer <[email protected]>",
"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",
"dev": "tsup --watch",
"clean": "del dist",
"test": "run-s test:*",
"test:lint": "eslint .",
"test:typecheck": "tsc --noEmit"
},
"dependencies": {
"@agentic/diffbot": "workspace:*",
"@agentic/serpapi": "workspace:*",
"p-map": "^7.0.2"
},
"peerDependencies": {
"@agentic/core": "workspace:*",
"zod": "^3.23.3"
},
"devDependencies": {
"@agentic/core": "workspace:*",
"@agentic/tsconfig": "workspace:*"
},
"publishConfig": {
"access": "public"
}
}
1 change: 1 addition & 0 deletions packages/search-and-crawl/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './search-and-crawl'
15 changes: 10 additions & 5 deletions packages/search-and-crawl/src/search-and-crawl.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { aiFunction, AIFunctionsProvider , omit, pick } from '@agentic/core'
import {
aiFunction,
AIFunctionsProvider,
isValidCrawlableUrl,
normalizeUrl,
omit,
pick
} from '@agentic/core'
import { type diffbot, DiffbotClient } from '@agentic/diffbot'
import { SerpAPIClient } from '@agentic/serpapi'
import pMap from 'p-map'
import { z } from 'zod'

import { type diffbot, DiffbotClient } from '../services/diffbot-client'
import { SerpAPIClient } from '../services/serpapi-client'
import { isValidCrawlableUrl, normalizeUrl } from '../url-utils'

// TODO: allow `search` tool to support other search clients
// (e.g. Bing, Exa, Searxng, Serper, Tavily)

Expand Down
5 changes: 5 additions & 0 deletions packages/search-and-crawl/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@agentic/tsconfig/base.json",
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
Loading

0 comments on commit ee1bf47

Please sign in to comment.