Feat/ai agents#1
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an AI agents system for processing voice commands to automatically create transactions, savings goals, and budgets using OpenAI's Whisper and GPT models.
- Implements a voice command processing system with AI agents for different financial entities
- Adds OpenAI integration for audio transcription and natural language processing
- Creates a multi-agent architecture with specialized services for transactions, goals, budgets, and validation
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/features/ai-agents/infrastructure/controllers/voice-command.controller.ts | Main controller handling voice command API endpoint with authentication |
| src/features/ai-agents/infrastructure/adapters/openai-transcription.adapter.ts | OpenAI Whisper integration for audio transcription |
| src/features/ai-agents/infrastructure/adapters/openai-llm.adapter.ts | OpenAI GPT integration for intent classification and data extraction |
| src/features/ai-agents/domain/ports/transcription.port.ts | Interface definitions for transcription and LLM services |
| src/features/ai-agents/domain/entities/voice-command.entity.ts | Domain entities and types for voice commands and agent responses |
| src/features/ai-agents/application/use-cases/process-voice-command.use-case.ts | Use case orchestrating voice command processing logic |
| src/features/ai-agents/application/services/voice-orchestrator.service.ts | Main orchestrator coordinating all AI agents |
| src/features/ai-agents/application/services/validation-agent.service.ts | Agent responsible for validating extracted data |
| src/features/ai-agents/application/services/transaction-agent.service.ts | Specialized agent for processing transaction data |
| src/features/ai-agents/application/services/goal-agent.service.ts | Specialized agent for processing savings goal data |
| src/features/ai-agents/application/services/budget-agent.service.ts | Specialized agent for processing budget data |
| src/features/ai-agents/README.md | Documentation for the AI agents system |
| src/app.ts | Integration of AI agents controller into main application |
| package.json | Addition of LangChain dependencies |
| docker-compose.yaml | PostgreSQL version upgrade |
| Dockerfile | Build configuration update |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| export class OpenAILLMAdapter implements ILLMService { | ||
| private apiKey: string; | ||
| private apiUrl = 'https://api.openai.com/v1/completions'; |
There was a problem hiding this comment.
The OpenAI completions endpoint is deprecated. Use the chat completions endpoint 'https://api.openai.com/v1/chat/completions' instead for GPT models.
| private apiUrl = 'https://api.openai.com/v1/completions'; | |
| private apiUrl = 'https://api.openai.com/v1/chat/completions'; |
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify({ | ||
| model: 'gpt-3.5-turbo-instruct', |
There was a problem hiding this comment.
The 'gpt-3.5-turbo-instruct' model is for the deprecated completions endpoint. When switching to chat completions, use 'gpt-3.5-turbo' or 'gpt-4' and format the request with a messages array instead of a prompt string.
| "dependencies": { | ||
| "@getbrevo/brevo": "^2.2.0", | ||
| "@hono/zod-openapi": "^0.18.3", | ||
| "@langchain/core": "^0.3.77", |
There was a problem hiding this comment.
LangChain dependencies are added but not used in the codebase. Consider removing these unused dependencies or implement LangChain integration if intended.
| "i": "^0.3.7", | ||
| "jose": "^5.9.6", | ||
| "json2csv": "^6.0.0-alpha.2", | ||
| "langchain": "^0.3.34", |
There was a problem hiding this comment.
LangChain dependencies are added but not used in the codebase. Consider removing these unused dependencies or implement LangChain integration if intended.
| "langchain": "^0.3.34", |
|
|
||
| const app = new Hono(); | ||
|
|
||
| const OPENAI_API_KEY = process.env.OPENAI_API_KEY || ''; |
There was a problem hiding this comment.
Using an empty string as fallback for OPENAI_API_KEY could lead to API calls with invalid credentials. Consider throwing an error or using a more explicit validation when the API key is missing.
| const OPENAI_API_KEY = process.env.OPENAI_API_KEY || ''; | |
| if (!process.env.OPENAI_API_KEY) { | |
| throw new Error("OPENAI_API_KEY environment variable is required but not set."); | |
| } | |
| const OPENAI_API_KEY = process.env.OPENAI_API_KEY; |
No description provided.