Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge private Agentic project update #643

Merged
merged 82 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
c763bfa
init
transitive-bullshit May 17, 2024
19706bf
🐇
transitive-bullshit May 17, 2024
0953469
🔢
transitive-bullshit May 21, 2024
0d96cef
📒
transitive-bullshit May 22, 2024
e3f1b56
🌊
transitive-bullshit May 22, 2024
783f375
🐺
transitive-bullshit May 23, 2024
89f8246
feat: core fns
transitive-bullshit May 24, 2024
17f3912
🚝
transitive-bullshit May 26, 2024
4cd1f38
😢
transitive-bullshit May 26, 2024
b57e798
💷
transitive-bullshit May 26, 2024
2ea18ab
👟
transitive-bullshit May 26, 2024
ca31b56
👱
transitive-bullshit May 26, 2024
8eda307
🕥
transitive-bullshit May 26, 2024
b7bd3ce
🗿
transitive-bullshit May 26, 2024
b9d1251
🗳
transitive-bullshit May 26, 2024
4b9e9ae
💐
transitive-bullshit May 27, 2024
fa6796d
🚼
transitive-bullshit May 27, 2024
f4e7861
🎄
transitive-bullshit May 27, 2024
839f460
🏡
transitive-bullshit Jun 2, 2024
8aa53fe
🤙
transitive-bullshit Jun 2, 2024
1d953a0
🎃
transitive-bullshit Jun 2, 2024
e6263fb
feat: add genkit
transitive-bullshit Jun 2, 2024
83cf65f
feat: add langchain
transitive-bullshit Jun 2, 2024
190ef0e
transitive-bullshit Jun 2, 2024
4b4e7e0
feat: add openai example
transitive-bullshit Jun 2, 2024
65e2e73
🐮
transitive-bullshit Jun 2, 2024
a5bf173
feat: remove AIToolSet in favor of just AIFunctionSet
transitive-bullshit Jun 2, 2024
1a90a1e
🌀
transitive-bullshit Jun 3, 2024
8fb9ddf
🤘
transitive-bullshit Jun 3, 2024
526b96d
🕌
transitive-bullshit Jun 3, 2024
5e0017b
🌿
transitive-bullshit Jun 3, 2024
1dc4a66
🐯
transitive-bullshit Jun 3, 2024
d03af97
🥖
transitive-bullshit Jun 3, 2024
ac76b50
transitive-bullshit Jun 3, 2024
419c0a4
😩
transitive-bullshit Jun 3, 2024
b03a38c
💞
transitive-bullshit Jun 3, 2024
b195c6b
transitive-bullshit Jun 3, 2024
760b4d5
🍪
transitive-bullshit Jun 3, 2024
ca9254d
📴
transitive-bullshit Jun 3, 2024
7731ca0
📵
transitive-bullshit Jun 3, 2024
3caa185
🦂
transitive-bullshit Jun 3, 2024
5863f31
😻
transitive-bullshit Jun 3, 2024
94198f3
👜
transitive-bullshit Jun 3, 2024
ed85b70
feat: add sanitizeSearchParams
transitive-bullshit Jun 3, 2024
f5319b4
👿
transitive-bullshit Jun 3, 2024
0f999c4
💂
transitive-bullshit Jun 3, 2024
2717eaa
🏐
transitive-bullshit Jun 3, 2024
ab3d0f9
🚕
transitive-bullshit Jun 3, 2024
52fe2db
transitive-bullshit Jun 4, 2024
7f098d1
💕
transitive-bullshit Jun 4, 2024
3269e9b
🏅
transitive-bullshit Jun 4, 2024
2ae6a2e
🐿
transitive-bullshit Jun 4, 2024
6045e23
🎌
transitive-bullshit Jun 4, 2024
7d11f76
feat: add wolfram alpha client
transitive-bullshit Jun 4, 2024
24857b1
feat: add llamaindex sdk adaptor
transitive-bullshit Jun 5, 2024
9e84229
feat: add twitter client
transitive-bullshit Jun 5, 2024
b3e589c
📎
transitive-bullshit Jun 5, 2024
bf6ee7c
🍴
transitive-bullshit Jun 5, 2024
1c10060
transitive-bullshit Jun 5, 2024
71fa4b2
feat: add SearchAndCrawl
transitive-bullshit Jun 5, 2024
512261f
feat: add e2b
transitive-bullshit Jun 5, 2024
98202e5
🏆
transitive-bullshit Jun 5, 2024
0f296be
feat: add unofficial midjourney client
transitive-bullshit Jun 5, 2024
bc12a88
🍀
transitive-bullshit Jun 6, 2024
9632047
feat: add bing web search
transitive-bullshit Jun 6, 2024
d4aed7b
feat: add novu client
transitive-bullshit Jun 6, 2024
47ac683
feat: documenting services
transitive-bullshit Jun 6, 2024
1c6fd8f
🚱
transitive-bullshit Jun 6, 2024
4cc6469
📢
transitive-bullshit Jun 6, 2024
0499aa1
🔘
transitive-bullshit Jun 6, 2024
63dee06
🥓
transitive-bullshit Jun 6, 2024
f510582
📕
transitive-bullshit Jun 6, 2024
0ebda1e
feat: add slack client
transitive-bullshit Jun 6, 2024
ff54a42
feat: add twilio client
transitive-bullshit Jun 6, 2024
074e2ef
💕
transitive-bullshit Jun 6, 2024
1961a26
🥊
transitive-bullshit Jun 6, 2024
f7d6fae
feat: add tavily client
transitive-bullshit Jun 6, 2024
594c8a0
fix: tavity output bug
transitive-bullshit Jun 6, 2024
efa568f
💳
transitive-bullshit Jun 6, 2024
2ff3065
feat: add browserbase example and update deps
transitive-bullshit Jun 7, 2024
a79b043
feat: update example imports
transitive-bullshit Jun 7, 2024
dc77d0e
Merge branch 'main' of github.com:transitive-bullshit/walter into age…
transitive-bullshit Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ------------------------------------------------------------------------------
# This is an example .env file.
#
# All of these environment vars must be defined either in your environment or in
# a local .env file in order to run this project.
# ------------------------------------------------------------------------------
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"root": true,
"extends": ["@fisch0920/eslint-config/node"],
"rules": {
"unicorn/no-static-only-class": "off",
"@typescript-eslint/naming-convention": "off"
}
}
1 change: 1 addition & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [transitive-bullshit]
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on: [push, pull_request]

jobs:
test:
name: Test Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
node-version:
- 20
- 21
- 22

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 9.1.4
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run test
run: pnpm run test
21 changes: 6 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

*.swp
.idea

# dependencies
/node_modules
node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/
.next/
out/

# production
/build
build/
dist/

# misc
.DS_Store
Expand All @@ -38,13 +36,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

# local env files
.env
.env.local
.env.build
.env.development.local
.env.test.local
.env.production.local

# data dumps
out/
old/
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run precommit
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
enable-pre-post-scripts=true
package-manager-strict=false
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"jsxSingleQuote": true,
"semi": false,
"useTabs": false,
"tabWidth": 2,
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"trailingComma": "none"
}
128 changes: 128 additions & 0 deletions bin/scratch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/usr/bin/env node
import 'dotenv/config'

import restoreCursor from 'restore-cursor'

// import { SearxngClient } from '../src/services/searxng-client.js'
// import { ClearbitClient } from '../src/index.js'
// import { ProxycurlClient } from '../src/services/proxycurl-client.js'
// import { WikipediaClient } from '../src/index.js'
// import { PerigonClient } from '../src/index.js'
// import { FirecrawlClient } from '../src/index.js'
// import { ExaClient } from '../src/index.js'
// import { DiffbotClient } from '../src/index.js'
// import { WolframAlphaClient } from '../src/index.js'
// import {
// createTwitterV2Client,
// TwitterClient
// } from '../src/services/twitter/index.js'
// import { MidjourneyClient } from '../src/index.js'
// import { BingClient } from '../src/index.js'
import { TavilyClient } from '../src/index.js'

/**
* Scratch pad for testing.
*/
async function main() {
restoreCursor()

// const clearbit = new ClearbitClient()
// const res = await clearbit.companyEnrichment({
// domain: 'https://clay.com'
// })
// console.log(JSON.stringify(res, null, 2))

// const proxycurl = new ProxycurlClient()
// const res = await proxycurl.getLinkedInPerson({
// linkedin_profile_url: 'https://linkedin.com/in/fisch2'
// })
// console.log(JSON.stringify(res, null, 2))

// const wikipedia = new WikipediaClient()
// const res = await wikipedia.getPageSummary({
// // title: 'Naruto_(TV_series)'
// title: 'SpaceX'
// })
// console.log(JSON.stringify(res, null, 2))

// const searxng = new SearxngClient()
// const res = await searxng.search({
// query: 'golden gate bridge',
// engines: ['reddit']
// })
// console.log(JSON.stringify(res, null, 2))

// const perigon = new PerigonClient()
// const res = await perigon.searchArticles({
// q: 'AI agents AND startup',
// sourceGroup: 'top50tech'
// })
// console.log(JSON.stringify(res, null, 2))

// const firecrawl = new FirecrawlClient()
// const res = await firecrawl.scrapeUrl({
// url: 'https://www.bbc.com/news/articles/cp4475gwny1o'
// // url: 'https://www.theguardian.com/technology/article/2024/jun/04/openai-google-ai-risks-letter'
// // url: 'https://www.firecrawl.dev'
// })
// console.log(JSON.stringify(res, null, 2))

// const exa = new ExaClient()
// const res = await exa.search({
// query: 'OpenAI',
// contents: { text: true }
// })
// console.log(JSON.stringify(res, null, 2))

// const diffbot = new DiffbotClient()
// // const res = await diffbot.analyzeUrl({
// // url: 'https://www.bbc.com/news/articles/cp4475gwny1o'
// // })
// const res = await diffbot.enhanceEntity({
// type: 'Person',
// name: 'Kevin Raheja'
// })
// console.log(JSON.stringify(res, null, 2))

// const wolfram = new WolframAlphaClient()
// const res = await wolfram.ask({
// input: 'population of new york city'
// })
// console.log(res)

// const client = await createTwitterV2Client({
// scopes: ['tweet.read', 'users.read', 'offline.access']
// })
// const twitter = new TwitterClient({ client })
// // const res = await twitter.findUserByUsername({ username: 'transitive_bs' })
// const res = await twitter.searchRecentTweets({
// query: 'open source AI agents'
// })
// console.log(res)

// const midjourney = new MidjourneyClient()
// const res = await midjourney.imagine(
// 'tiny lil baby kittens playing with an inquisitive AI robot, kawaii, anime'
// )
// console.log(JSON.stringify(res, null, 2))

// const bing = new BingClient()
// const res = await bing.search({
// q: 'world cup 2024 freestyle wrestling news'
// })
// console.log(JSON.stringify(res, null, 2))

const tavily = new TavilyClient()
const res = await tavily.search({
query: 'when do experts predict that OpenAI will release GPT-5?',
include_answer: true
})
console.log(JSON.stringify(res, null, 2))
}

try {
await main()
} catch (err) {
console.error('error', err)
process.exit(1)
}
26 changes: 26 additions & 0 deletions examples/ai-sdk/browserbase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env node
import 'dotenv/config'

import { openai } from '@ai-sdk/openai'
import { Browserbase, BrowserbaseAISDK } from '@browserbasehq/sdk'
import { generateText } from 'ai'

async function main() {
const browserbase = new Browserbase()

const browserTool = BrowserbaseAISDK(browserbase, { textContent: true })
console.log(browserTool.parameters)

const result = await generateText({
model: openai('gpt-4o'),
tools: { browserTool },
toolChoice: 'required',
temperature: 0,
system: 'You are a helpful assistant. Be as concise as possible.',
prompt: 'What is the weather in San Francisco?'
})

console.log(result.toolResults[0])
}

await main()
24 changes: 24 additions & 0 deletions examples/ai-sdk/weather.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node
import 'dotenv/config'

import { WeatherClient } from '@agentic/stdlib'
import { createAISDKTools } from '@agentic/stdlib/ai-sdk'
import { openai } from '@ai-sdk/openai'
import { generateText } from 'ai'

async function main() {
const weather = new WeatherClient()

const result = await generateText({
model: openai('gpt-4o'),
tools: createAISDKTools(weather),
toolChoice: 'required',
temperature: 0,
system: 'You are a helpful assistant. Be as concise as possible.',
prompt: 'What is the weather in San Francisco?'
})

console.log(result.toolResults[0])
}

await main()
28 changes: 28 additions & 0 deletions examples/dexter/analyze.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node
import 'dotenv/config'

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 }
// debug: true
}),
functions: createDexterFunctions(searchAndCrawl),
systemMessage:
'You are a McKinsey analyst who is an expert at writing executive summaries. Always cite your sources and respond using Markdown.'
})

const topic = 'the 2024 olympics'
const result = await runner(`Summarize the latest news on ${topic}`)
console.log(result)
}

await main()
23 changes: 23 additions & 0 deletions examples/dexter/code-interpreter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node
import 'dotenv/config'

import { createDexterFunctions } from '@agentic/stdlib/dexter'
import { e2b } from '@agentic/stdlib/e2b'
import { ChatModel, createAIRunner } from '@dexaai/dexter'

async function main() {
const runner = createAIRunner({
chatModel: new ChatModel({
params: { model: 'gpt-4o', temperature: 0 },
debug: true
}),
functions: createDexterFunctions(e2b)
})

const result = await runner(
'Visualize a distribution of height of men based on the latest data you know. Also print the median value.'
)
console.log(result)
}

await main()
Loading