-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding basic test suite and ci github actions.
- Loading branch information
1 parent
2f5d6da
commit bd4f9ae
Showing
13 changed files
with
941 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Run Tests on PR | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] # Adjust based on your target branch | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | ||
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build for integration tests | ||
run: npm run build:test | ||
|
||
- name: Run integration tests | ||
run: npm run test:integration | ||
|
||
- name: Build production version | ||
run: npm run build | ||
|
||
- name: Run e2e tests | ||
run: npm run test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,19 @@ | |
"module": "dist/bundle.esm.js", | ||
"unpkg": "dist/bundle.umd.js", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"build:test": "TEST_ENV=mocked-llm-apis rollup -c", | ||
"dev": "NODE_ENV=development rollup -c -w", | ||
"test": "npm run build:test && jest", | ||
"test:watch": "jest --watch", | ||
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --verbose", | ||
"test:prod": "npm run build && jest", | ||
"play-react": "cd playground/react && npm run dev", | ||
"play-node": "cd playground/nodejs && node index.js" | ||
"build": "rollup -c", | ||
"build:test": "TEST_ENV=mocked-llm-apis rollup -c", | ||
"dev": "NODE_ENV=development rollup -c -w", | ||
"test": "npm run build:test && test:integration", | ||
"test:watch": "TEST_ENV=mocked-llm-apis jest --testPathPattern='tests/e2e' --watch", | ||
"test:debug": "TEST_ENV=mocked-llm-apis node --inspect-brk node_modules/.bin/jest --runInBand --verbose", | ||
"test:prod": "npm run build && jest", | ||
"test:integration": "TEST_ENV=mocked-llm-apis jest --testPathPattern='tests/e2e'", | ||
"test:e2e": "TEST_ENV=real-llm-apis jest --testPathPattern='tests/e2e'", | ||
"play-react": "cd playground/react && npm run dev", | ||
"play-node": "cd playground/nodejs && node index.js" | ||
}, | ||
|
||
"packageManager": "[email protected]", | ||
"repository": { | ||
"type": "git", | ||
|
@@ -59,8 +62,6 @@ | |
"@rollup/plugin-replace": "^5.0.7", | ||
"dotenv": "^16.4.5", | ||
"eslint": "^7.32.0", | ||
"fetch-mock": "^10.0.7", | ||
"fetch-mock-jest": "^1.5.1", | ||
"jest": "^29.7.0", | ||
"prettier": "^2.3.2", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
const { Agent, Task, Team } = require('agenticjs'); | ||
|
||
// Define agents | ||
const requirementsAnalyst = new Agent({ | ||
name: 'Emma', | ||
role: 'Requirements Analyst', | ||
goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', | ||
background: 'Business Analysis', | ||
tools: [], | ||
llmConfig: { | ||
provider: "anthropic", // or "openai" | ||
model: "claude-3-5-sonnet-20240620", | ||
temperature: 0.9, | ||
maxTokens: 1024, | ||
anthropicApiUrl: "https://www.agenticjs.com/proxy/anthropic", | ||
} | ||
|
||
}); | ||
|
||
const technicalWriter = new Agent({ | ||
name: 'Lucas', | ||
role: 'Technical Writer', | ||
goal: 'Convert functional outlines into detailed technical specifications.', | ||
background: 'Technical Writing', | ||
tools: [], | ||
llmConfig: { | ||
provider: "anthropic", // or "openai" | ||
model: "claude-3-5-sonnet-20240620", | ||
temperature: 0.9, | ||
maxTokens: 1024, | ||
anthropicApiUrl: "https://www.agenticjs.com/proxy/anthropic", | ||
} | ||
}); | ||
|
||
const validator = new Agent({ | ||
name: 'Mia', | ||
role: 'Validator', | ||
goal: 'Ensure the specifications are accurate and complete.', | ||
background: 'Quality Assurance', | ||
tools: [], | ||
llmConfig: { | ||
provider: "anthropic", // or "openai" | ||
model: "claude-3-5-sonnet-20240620", | ||
temperature: 0.9, | ||
maxTokens: 1024, | ||
anthropicApiUrl: "https://www.agenticjs.com/proxy/anthropic", | ||
} | ||
}); | ||
|
||
// Define tasks | ||
const analysisTask = new Task({ | ||
description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, | ||
expectedOutput: 'A functional outline of the Founder Idea', | ||
agent: requirementsAnalyst | ||
}); | ||
|
||
const writingTask = new Task({ | ||
description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, | ||
expectedOutput: 'A detailed technical specifications document.', | ||
isDeliverable: true, | ||
agent: technicalWriter | ||
}); | ||
|
||
const validationTask = new Task({ | ||
description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, | ||
expectedOutput: 'A validated technical specifications document ready for development. Must be in Markdown format.', | ||
agent: validator | ||
}); | ||
|
||
// Create a team | ||
const team = new Team({ | ||
name: 'Product Specs Team', | ||
agents: [requirementsAnalyst, technicalWriter, validator], | ||
tasks: [analysisTask, writingTask, validationTask], | ||
inputs: { founderIdea: 'I want to add a Referral program to our SAAS platform.' }, // Initial input for the first task | ||
}); | ||
|
||
module.exports = team; |
115 changes: 115 additions & 0 deletions
115
tests/e2e/examples/teams/anthropic/productSpecsTeam.requests.js
Large diffs are not rendered by default.
Oops, something went wrong.
140 changes: 140 additions & 0 deletions
140
tests/e2e/examples/teams/anthropic/productSpecsTeamWithAPIErrors.requests.js
Large diffs are not rendered by default.
Oops, something went wrong.
192 changes: 192 additions & 0 deletions
192
tests/e2e/examples/teams/google/productSpecsTeam.requests.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
const { Agent, Task, Team } = require('agenticjs'); | ||
|
||
// Define agents | ||
const requirementsAnalyst = new Agent({ | ||
name: 'Emma', | ||
role: 'Requirements Analyst', | ||
goal: 'Outline core functionalities and objectives for new features based on the founder’s input.', | ||
background: 'Business Analysis', | ||
tools: [], | ||
llmConfig: { | ||
provider: "mistral", | ||
model: "mistral-small", | ||
} | ||
|
||
}); | ||
|
||
const technicalWriter = new Agent({ | ||
name: 'Lucas', | ||
role: 'Technical Writer', | ||
goal: 'Convert functional outlines into detailed technical specifications.', | ||
background: 'Technical Writing', | ||
tools: [], | ||
llmConfig: { | ||
provider: "mistral", | ||
model: "mistral-small", | ||
} | ||
}); | ||
|
||
const validator = new Agent({ | ||
name: 'Mia', | ||
role: 'Validator', | ||
goal: 'Ensure the specifications are accurate and complete.', | ||
background: 'Quality Assurance', | ||
tools: [], | ||
llmConfig: { | ||
provider: "mistral", | ||
model: "mistral-small", | ||
} | ||
}); | ||
|
||
// Define tasks | ||
const analysisTask = new Task({ | ||
description: `Analyze the founder's idea: {founderIdea} and outline the necessary functionalities to implement it.`, | ||
expectedOutput: 'A functional outline of the Founder Idea', | ||
agent: requirementsAnalyst | ||
}); | ||
|
||
const writingTask = new Task({ | ||
description: `Create detailed technical specifications based on the functional outline provided. Include user stories, system requirements, and acceptance criteria.`, | ||
expectedOutput: 'A detailed technical specifications document.', | ||
isDeliverable: true, | ||
agent: technicalWriter | ||
}); | ||
|
||
const validationTask = new Task({ | ||
description: `Review the technical specifications to ensure they match the founder's vision and that are technically feasible.`, | ||
expectedOutput: 'A validated technical specifications document ready for development. Must be in Markdown format.', | ||
agent: validator | ||
}); | ||
|
||
// Create a team | ||
const team = new Team({ | ||
name: 'Product Specs Team', | ||
agents: [requirementsAnalyst, technicalWriter, validator], | ||
tasks: [analysisTask, writingTask, validationTask], | ||
inputs: { founderIdea: 'I want to add a Referral program to our SAAS platform.' }, // Initial input for the first task | ||
}); | ||
|
||
module.exports = team; |
Oops, something went wrong.