Skip to content

Commit

Permalink
Merge pull request #35 from statelyai/davidkpiano/id
Browse files Browse the repository at this point in the history
Use built-in ID function
  • Loading branch information
davidkpiano committed Jun 19, 2024
2 parents 19e9381 + 9b4a91b commit 5fecdec
Show file tree
Hide file tree
Showing 9 changed files with 3,459 additions and 2,543 deletions.
1 change: 0 additions & 1 deletion examples/ticTacToe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { assign, setup, assertEvent, createActor } from 'xstate';
import { z } from 'zod';
import { createAgent, fromDecision, fromTextStream } from '../src';
import { openai } from '@ai-sdk/openai';
import { defaultToolCallTemplate } from '../src/templates/defaultToolCall';

const agent = createAgent({
name: 'tic-tac-toe-bot',
Expand Down
7 changes: 5 additions & 2 deletions examples/word.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const context = {

const agent = createAgent({
name: 'word',
model: openai('gpt-4-1106-preview'),
model: openai('gpt-4o'),
events: {
'agent.guessLetter': z.object({
letter: z.string().min(1).max(1).describe('The letter guessed'),
Expand Down Expand Up @@ -42,12 +42,15 @@ const wordGuesserMachine = setup({
agent: fromDecision(agent),
getFromTerminal,
},
actions: {
resetContext: assign(context),
},
}).createMachine({
initial: 'providingWord',
context,
states: {
providingWord: {
entry: assign(context),
entry: 'resetContext',
invoke: {
src: 'getFromTerminal',
input: 'Enter a word, and an agent will try to guess it.',
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build": "tsup src/index.ts --format cjs,esm --dts",
"lint": "tsc --noEmit",
"test": "vitest",
"test:ci": "vitest --run",
"example": "ts-node examples/helpers/runner.ts",
"prepublishOnly": "tsup src/index.ts --format cjs,esm --dts",
"changeset": "changeset",
Expand All @@ -30,7 +31,7 @@
"@langchain/community": "^0.0.53",
"@langchain/core": "^0.1.63",
"@langchain/openai": "^0.0.28",
"@types/node": "^20.14.2",
"@types/node": "^20.14.6",
"dotenv": "^16.4.5",
"json-schema-to-ts": "^3.1.0",
"ts-node": "^10.9.2",
Expand All @@ -44,10 +45,9 @@
"access": "public"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.13",
"@ai-sdk/openai": "^0.0.31",
"@xstate/graph": "^2.0.0",
"ai": "^3.1.32",
"nanoid": "^5.0.7",
"ai": "^3.2.1",
"xstate": "^5.13.2"
},
"packageManager": "pnpm@8.11.0"
Expand Down
Loading

0 comments on commit 5fecdec

Please sign in to comment.