diff --git a/examples/agents/business-requirements-and-summarization-agent/.env.baseai.example b/examples/agents/business-requirements-and-summarization-agent/.env.baseai.example new file mode 100644 index 00000000..8c643651 --- /dev/null +++ b/examples/agents/business-requirements-and-summarization-agent/.env.baseai.example @@ -0,0 +1,21 @@ +# !! SERVER SIDE ONLY !! +# Keep all your API keys secret — use only on the server side. + +# TODO: ADD: Both in your production and local env files. +# Langbase API key for your User or Org account. +# How to get this API key https://langbase.com/docs/api-reference/api-keys +LANGBASE_API_KEY= + +# TODO: ADD: LOCAL ONLY. Add only to local env files. +# Following keys are needed for local pipe runs. For providers you are using. +# For Langbase, please add the key to your LLM keysets. +# Read more: Langbase LLM Keysets https://langbase.com/docs/features/keysets +OPENAI_API_KEY= +ANTHROPIC_API_KEY= +COHERE_API_KEY= +FIREWORKS_API_KEY= +GOOGLE_API_KEY= +GROQ_API_KEY= +MISTRAL_API_KEY= +PERPLEXITY_API_KEY= +TOGETHER_API_KEY= diff --git a/examples/agents/business-requirements-and-summarization-agent/.gitignore b/examples/agents/business-requirements-and-summarization-agent/.gitignore new file mode 100644 index 00000000..7270a2e7 --- /dev/null +++ b/examples/agents/business-requirements-and-summarization-agent/.gitignore @@ -0,0 +1,10 @@ +# baseai +**/.baseai/ +node_modules +.env +package-lock.json +pnpm-lock.yaml +# env file +.env +# env file +.env diff --git a/examples/agents/business-requirements-and-summarization-agent/README.md b/examples/agents/business-requirements-and-summarization-agent/README.md new file mode 100644 index 00000000..0ffbaaa5 --- /dev/null +++ b/examples/agents/business-requirements-and-summarization-agent/README.md @@ -0,0 +1,53 @@ +![Business Requirements and Summarization Agent by ⌘ BaseAI][cover] + +![License: MIT][mit] [![Fork on ⌘ Langbase][fork]][pipe] + +## Build a Business Requirements and Summarization Agent with BaseAI framework — ⌘ Langbase + +This AI Agent is built using the BaseAI framework. It leverages an agentic pipe that integrates over 30+ LLMs (including OpenAI, Gemini, Mistral, Llama, Gemma, etc.) and can handle any data, with context sizes of up to 10M+ tokens, supported by memory. The framework is compatible with any front-end framework (such as React, Remix, Astro, Next.js), giving you, as a developer, the freedom to tailor your AI application exactly as you envision. + +## Features + +- Business Requirements and Summarization Agent — Built with [BaseAI framework and agentic Pipe ⌘ ][qs]. +- Composable Agents — build and compose agents with BaseAI. +- Add and Sync deployed pipe on Langbase locally npx baseai@latest add ([see the Code button][pipe]). + +## Learn more + +1. Check the [Learning path to build an agentic AI pipe with ⌘ BaseAI][learn] +2. Read the [source code on GitHub][gh] for this agent example +3. Go through Documentaion: [Pipe Quick Start][qs] +4. Learn more about [Memory features in ⌘ BaseAI][memory] +5. Learn more about [Tool calls support in ⌘ BaseAI][toolcalls] + + +> NOTE: +> This is a BaseAI project, you can deploy BaseAI pipes, memory and tool calls on Langbase. + +--- + +## Authors + +This project is created by [Langbase][lb] team members, with contributions from: + +- Muhammad-Ali Danish - Software Engineer, [Langbase][lb]
+**_Built by ⌘ [Langbase.com][lb] — Ship hyper-personalized AI assistants with memory!_** + + +[lb]: https://langbase.com +[pipe]: https://langbase.com/examples/business-requirements-and-summarization-agent +[gh]: https://github.com/LangbaseInc/baseai/tree/main/examples/agents/business-requirements-and-summarization-agent +[cover]:https://raw.githubusercontent.com/LangbaseInc/docs-images/main/baseai/baseai-cover.png +[download]:https://download-directory.github.io/?url=https://github.com/LangbaseInc/baseai/tree/main/examples/agents/business-requirements-and-summarization-agent +[learn]:https://baseai.dev/learn +[memory]:https://baseai.dev/docs/memory/quickstart +[toolcalls]:https://baseai.dev/docs/tools/quickstart +[deploy]:https://baseai.dev/docs/deployment/authentication +[signup]: https://langbase.fyi/io +[qs]:https://baseai.dev/docs/pipe/quickstart +[docs]:https://baseai.dev/docs +[xaa]:https://x.com/MrAhmadAwais +[xab]:https://x.com/AhmadBilalDev +[local]:http://localhost:9000 +[mit]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge&color=%23000000 +[fork]: https://img.shields.io/badge/FORK%20ON-%E2%8C%98%20Langbase-000000.svg?style=for-the-badge&logo=%E2%8C%98%20Langbase&logoColor=000000 \ No newline at end of file diff --git a/examples/agents/business-requirements-and-summarization-agent/baseai/baseai.config.ts b/examples/agents/business-requirements-and-summarization-agent/baseai/baseai.config.ts new file mode 100644 index 00000000..3c0328bc --- /dev/null +++ b/examples/agents/business-requirements-and-summarization-agent/baseai/baseai.config.ts @@ -0,0 +1,18 @@ +import type { BaseAIConfig } from 'baseai'; + +export const config: BaseAIConfig = { + log: { + isEnabled: false, + logSensitiveData: false, + pipe: true, + 'pipe.completion': true, + 'pipe.request': true, + 'pipe.response': true, + tool: true, + memory: true + }, + memory: { + useLocalEmbeddings: false + }, + envFilePath: '.env' +}; diff --git a/examples/agents/business-requirements-and-summarization-agent/baseai/pipes/business-requirements-and-summarization-agent.ts b/examples/agents/business-requirements-and-summarization-agent/baseai/pipes/business-requirements-and-summarization-agent.ts new file mode 100644 index 00000000..5043a986 --- /dev/null +++ b/examples/agents/business-requirements-and-summarization-agent/baseai/pipes/business-requirements-and-summarization-agent.ts @@ -0,0 +1,42 @@ +import { PipeI } from '@baseai/core'; + +const pipeBusinessRequirementsAndSummarizationAgent = (): PipeI => ({ + // Replace with your API key https://langbase.com/docs/api-reference/api-keys + apiKey: process.env.LANGBASE_API_KEY!, + name: `business-requirements-and-summarization-agent`, + description: ``, + status: `private`, + model: `groq:llama-3.1-70b-versatile`, + stream: true, + json: false, + store: true, + moderate: true, + top_p: 1, + max_tokens: 1000, + temperature: 0.4, + presence_penalty: 0, + frequency_penalty: 0, + stop: [], + tool_choice: 'auto', + parallel_tool_calls: true, + messages: [ + { + role: 'system', + content: + 'You are a specialized AI assistant and an agent, designed to summarize business requirements efficiently and accurately. Your task is to analyze input text containing business requirements and produce clear, concise summaries that capture the essential information.\n\n## Input Processing:\n- Carefully read and analyze the provided business requirements text.\n- Identify key points, objectives, constraints, and stakeholder needs.\n- Recognize industry-specific terminology and concepts.\n\n## Summarization Guidelines:\n1. Maintain the original intent and meaning of the requirements.\n2. Prioritize clarity and conciseness in your summaries.\n3. Use bullet points for easy readability.\n4. Group related requirements together.\n5. Highlight any dependencies or critical constraints.\n6. Include any specified timelines or deadlines.\n7. Mention key stakeholders or departments involved.\n\n## Output Format:\nProvide the summary in the following structure:\n- Project Overview: A brief 1-2 sentence description of the overall project or initiative.\n- Key Objectives: List the main goals or outcomes expected from the project.\n- Functional Requirements: Summarize the core functionalities or features required.\n- Non-Functional Requirements: Include performance, security, scalability, etc., if mentioned.\n- Constraints: List any limitations, restrictions, or dependencies.\n- Timeline: Mention any specified deadlines or project phases.\n- Stakeholders: List key individuals or departments involved.\n\n## Additional Instructions:\n- If any requirement is ambiguous or lacks detail, note it as "Requires Clarification" in your summary.\n- If you encounter highly technical or industry-specific terms you\'re unsure about, include them as-is and mark them for review.\n- Maintain a neutral, professional tone throughout the summary.\n\nWhen you\'re ready to summarize, respond with "Ready to summarize business requirements. Please provide the input text."' + }, + { name: 'json', role: 'system', content: '' }, + { name: 'safety', role: 'system', content: '' }, + { + name: 'opening', + role: 'system', + content: 'Welcome to Langbase. Prompt away!' + }, + { name: 'rag', role: 'system', content: '' } + ], + variables: [], + tools: [], + memory: [] +}); + +export default pipeBusinessRequirementsAndSummarizationAgent; diff --git a/examples/agents/business-requirements-and-summarization-agent/index.ts b/examples/agents/business-requirements-and-summarization-agent/index.ts new file mode 100644 index 00000000..a86c2542 --- /dev/null +++ b/examples/agents/business-requirements-and-summarization-agent/index.ts @@ -0,0 +1,57 @@ +import 'dotenv/config'; +import { Pipe } from '@baseai/core'; +import inquirer from 'inquirer'; +import ora from 'ora'; +import chalk from 'chalk'; +import pipeBusinessRequirementsAndSummarizationAgent from './baseai/pipes/business-requirements-and-summarization-agent'; + + +const pipe = new Pipe(pipeBusinessRequirementsAndSummarizationAgent()); + +async function main() { + + const initialSpinner = ora('Starting conversation with BusinessRequirementsAndSummarizationAgent...').start(); + try { + const { completion: initialRequirementsAgentResponse } = await pipe.run({ + messages: [{ role: 'user', content: 'Tell me how to interact with you?' }], + }); + initialSpinner.stop(); + console.log(chalk.cyan('Agent response...')); + console.log(initialRequirementsAgentResponse); + } catch (error) { + initialSpinner.stop(); + console.error(chalk.red('Error processing initial request:'), error); + } + + while (true) { + const { userMsg } = await inquirer.prompt([ + { + type: 'input', + name: 'userMsg', + message: chalk.blue('Enter your query (or type "exit" to quit):'), + }, + ]); + + if (userMsg.toLowerCase() === 'exit') { + console.log(chalk.green('Goodbye!')); + break; + } + + const spinner = ora('Processing your request...').start(); + + try { + const { completion: businessRequirementsAgentResponse } = await pipe.run({ + messages: [{ role: 'user', content: userMsg }], + }); + + spinner.stop(); + console.log(chalk.cyan('Agent:')); + console.log(businessRequirementsAgentResponse); + } catch (error) { + spinner.stop(); + console.error(chalk.red('Error processing your request:'), error); + } + } +} + +main(); \ No newline at end of file diff --git a/examples/agents/business-requirements-and-summarization-agent/package.json b/examples/agents/business-requirements-and-summarization-agent/package.json new file mode 100644 index 00000000..7616c91e --- /dev/null +++ b/examples/agents/business-requirements-and-summarization-agent/package.json @@ -0,0 +1,22 @@ +{ + "name": "business-requirements-and-summarization-agent", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "baseai": "baseai" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "@baseai/core": "^0.9.4", + "dotenv": "^16.4.5", + "inquirer": "^12.0.0", + "ora": "^8.1.0" + }, + "devDependencies": { + "baseai": "^0.9.4" + } +}