toughyear / generative-agents

A Framework for working with Generative Agents powered by Large Language Models
https://multimode.run/
MIT License
76 stars 12 forks source link

cant resolve Generative agent #1

Open DarokCx opened 1 year ago

DarokCx commented 1 year ago

cloned the repo. in example/phaser npm install

added 1307 packages, and audited 1320 packages in 22s

Failed to compile.

Module not found: Error: Can't resolve 'generative-agents' in '\generative-agents\examples\phaser\src' ERROR in ./src/Game.tsx 7:0-74 Module not found: Error: Can't resolve 'generative-agents' in '\generative-agents\examples\phaser\src'

ERROR in ./src/pages/test.tsx 6:0-55 Module not found: Error: Can't resolve 'generative-agents' in '\generative-agents\examples\phaser\src\pages'

ERROR in ./src/phaserClasses/AgentCharacter.ts 5:0-48 Module not found: Error: Can't resolve 'generative-agents' in '\generative-agents\examples\phaser\src\phaserClasses'

webpack compiled with 3 errors ERROR in src/AgentChat.tsx:2:23 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import React, { useState } from "react";

2 | import { Agent } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 3 | import { XCircle } from "lucide-react"; 4 | 5 | type AgentChatProps = {

ERROR in src/AgentDisplay.tsx:2:23 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | // AgentDisplay.tsx

2 | import { Agent } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 3 | import React, { useEffect, useState } from "react"; 4 | 5 | type AgentDisplayProps = {

ERROR in src/data/world.ts:1:27 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations.

1 | import { Rectangle } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 2 | 3 | export const locations: Rectangle[] = [ 4 | {

ERROR in src/Game.tsx:3:55 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import React, { useRef, useState } from "react"; 2 | import PhaserGame from "./phaserGame";

3 | import { Agent, AgentEngine, buildSpatialWorld } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 4 | 5 | import { agentsData } from "./data/agents"; 6 | import AgentDisplay from "./AgentDisplay";

ERROR in src/pages/test.tsx:2:36 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import React, { useRef } from "react";

2 | import { Agent, AgentEngine } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 3 | 4 | interface Props { 5 | openaiKey: string;

ERROR in src/phaserClasses/AgentCharacter.ts:3:36 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import Phaser from "phaser"; 2 | import BubbleText from "./BubbleText";

3 | import { Agent, AgentEvents } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 4 | import { locations } from "../data/world"; 5 | 6 | class AgentCharacter extends Phaser.GameObjects.Sprite {

ERROR in src/phaserClasses/AgentCharacter.ts:126:13 TS7006: Parameter 'word' implicitly has an 'any' type. 124 | return this.agent.id 125 | .split("_")

126 | .map((word) => word[0]) | ^^^^ 127 | .join("") 128 | .toUpperCase(); 129 | }

ERROR in src/phaserGame.tsx:4:23 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. Failed to compile.

Module not found: Error: Can't resolve 'generative-agents' in 'C:\Users\erikc\source\repos\generative-agents\examples\phaser\src' ERROR in ./src/Game.tsx 7:0-74 Module not found: Error: Can't resolve 'generative-agents' in 'C:\Users\erikc\source\repos\generative-agents\examples\phaser\src'

ERROR in ./src/pages/test.tsx 6:0-55 Module not found: Error: Can't resolve 'generative-agents' in 'C:\Users\erikc\source\repos\generative-agents\examples\phaser\src\pages'

ERROR in ./src/phaserClasses/AgentCharacter.ts 5:0-48 Module not found: Error: Can't resolve 'generative-agents' in 'C:\Users\erikc\source\repos\generative-agents\examples\phaser\src\phaserClasses'

webpack compiled with 3 errors ERROR in src/AgentChat.tsx:2:23 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import React, { useState } from "react";

2 | import { Agent } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 3 | import { XCircle } from "lucide-react"; 4 | 5 | type AgentChatProps = {

ERROR in src/AgentDisplay.tsx:2:23 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | // AgentDisplay.tsx

2 | import { Agent } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 3 | import React, { useEffect, useState } from "react"; 4 | 5 | type AgentDisplayProps = {

ERROR in src/data/world.ts:1:27 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations.

1 | import { Rectangle } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 2 | 3 | export const locations: Rectangle[] = [ 4 | {

ERROR in src/Game.tsx:3:55 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import React, { useRef, useState } from "react"; 2 | import PhaserGame from "./phaserGame";

3 | import { Agent, AgentEngine, buildSpatialWorld } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 4 | 5 | import { agentsData } from "./data/agents"; 6 | import AgentDisplay from "./AgentDisplay";

ERROR in src/pages/test.tsx:2:36 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import React, { useRef } from "react";

2 | import { Agent, AgentEngine } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 3 | 4 | interface Props { 5 | openaiKey: string;

ERROR in src/phaserClasses/AgentCharacter.ts:3:36 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import Phaser from "phaser"; 2 | import BubbleText from "./BubbleText";

3 | import { Agent, AgentEvents } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 4 | import { locations } from "../data/world"; 5 | 6 | class AgentCharacter extends Phaser.GameObjects.Sprite {

ERROR in src/phaserClasses/AgentCharacter.ts:126:13 TS7006: Parameter 'word' implicitly has an 'any' type. 124 | return this.agent.id 125 | .split("_")

126 | .map((word) => word[0]) | ^^^^ 127 | .join("") 128 | .toUpperCase(); 129 | }

ERROR in src/phaserGame.tsx:4:23 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 2 | import Phaser from "phaser"; 3 | import { MainScene } from "./scenes/MainScene";

4 | import { Agent } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 5 | 6 | interface Props { 7 | agents: Agent[];

ERROR in src/scenes/MainScene.ts:2:23 TS2307: Cannot find module 'generative-agents' or its corresponding type declarations. 1 | import Phaser from "phaser";

2 | import { Agent } from "generative-agents"; | ^^^^^^^^^^^^^^^^^^^ 3 | import AgentCharacter from "../phaserClasses/AgentCharacter"; 4 | import { agentsData } from "../data/agents"; 5 | import { locations } from "../data/world";

toughyear commented 1 year ago

@DarokCx that is because the package "generative-agents" is a local package and not available via NPM right now. We plan to publish it soon but till then, you have to clone the whole thing. Once you clone the whole repo -

install and build the core/typescript

yarn install
yarn build

next up create a link to the package

yarn link

After that, go to examples/phaser and link the package

yarn link generative-agents

now do yarn install and yarn start

A bit cumbersome. I will see to add a package.

toughyear commented 1 year ago

ok, we published it as a package here - https://npmjs.com/package/generative-agents will update the docs.