Commit d626fff
authored
Aisdk (#56)
* refactor: Migrate to AI SDK and simplify LLM model handling
- Updated package dependencies to use @AI-SDK libraries
- Replaced Anthropic and OpenAI direct SDK implementations with ModelAdapter
- Simplified LLM service to use a unified model generation approach
- Updated tests to work with new ModelAdapter interface
- Removed direct API key management from LLM classes
* refactor: Simplify workflow and tool handling with AI SDK integration
- Updated QueryOrchestrator to use AI SDK's ToolSet for tool management
- Removed complex tool selection and processing logic
- Simplified workflow to directly generate responses with available tools
- Updated tests to reflect new workflow and LLM generation approach
- Modified Tool interface to include AI SDK Tool schema
* feat: Add Zod validation and AI SDK tool schemas for Nubila weather tools
- Integrated Zod schema for validating latitude and longitude coordinates
- Added AI SDK tool schemas for CurrentWeatherTool and ForecastWeatherTool
- Updated BaseWeatherAPITool to include a schema property
- Implemented tool method from AI SDK for both weather tools
- Enhanced input validation and tool definition for weather-related tools
* refactor: Update tool schema handling in QueryOrchestrator and Tool interface
- Modified QueryOrchestrator's buildToolSet method to support multiple tool schemas
- Updated Tool interface and APITool base class to use an array of tool schemas
- Adjusted workflow and test files to accommodate the new schema structure
- Simplified tool registration and schema management in the workflow process
* refactor: Update BaseWeatherAPITool schema to support multiple tool definitions
- Modified CurrentWeatherAPITool and ForecastWeatherAPITool to use an array of tool schemas
- Updated schema property to include tool name and corresponding tool definition
- Maintained consistency with previous refactoring of tool schema handling
* feat: Add Zod schemas and AI SDK tool definitions for DimoTool
- Integrated Zod schemas for list_vehicles, get_vehicle_signals, and get_latest_signals tools
- Added AI SDK tool schemas with input validation and execution methods
- Refactored DimoTool to support multiple tool definitions and dynamic tool execution
- Exposed public methods for vehicle and signal retrieval
- Simplified tool initialization and JWT management
* feat: Enhance NewsAPI tool with Zod validation and AI SDK integration
- Added Zod schemas for news categories and article validation
- Implemented AI SDK tool schema for get_headlines with input parameters
- Extended NewsAPITool to support category and keyword filtering
- Improved error handling and response validation
- Updated test suite to reflect new tool capabilities
* feat: Enhance L1DataTool with Zod validation and AI SDK tool integration
- Added Zod schemas for L1 chain statistics and GraphQL response validation
- Implemented AI SDK tool schema for get_l1_stats with dynamic data processing
- Added type inference using Zod schemas for improved type safety
- Enhanced error handling and data validation in getRawData methods
- Added descriptive schema descriptions for better tool documentation
* feat: Enhance NuclearOutagesTool with Zod validation and AI SDK tool integration
- Added Zod schemas for date range and nuclear outage data validation
- Implemented AI SDK tool schema for get_nuclear_outages with summary statistics
- Added type inference using Zod schemas for improved type safety
- Enhanced input validation and error handling in date range processing
- Added descriptive schema descriptions for better tool documentation
- Integrated schema validation in getRawData and execute methods
* feat: Enhance DePINScan tools with Zod validation and AI SDK tool integration
- Added Zod schemas for DePIN metrics and projects with comprehensive field validation
- Implemented AI SDK tool schemas for get_depin_metrics and get_depin_projects
- Added type inference and validation for DePINScan data retrieval
- Enhanced input parsing and data processing with Zod schema validation
- Added descriptive schema descriptions for better tool documentation
- Integrated AI SDK tool methods for metrics and projects retrieval
* feat: Add Mapbox Geocoding tool with Zod validation and AI SDK integration
- Implemented MapboxGeocodingTool with comprehensive Zod schemas for geocoding responses
- Added AI SDK tool schema for get_coordinates with location and coordinate retrieval
- Integrated Mapbox Geocoding API for converting location names to geographic coordinates
- Implemented input parsing and error handling for geocoding requests
- Added support for optional country, type, and result limit parameters
- Registered Mapbox Geocoding tool in the ToolRegistry for easy access
* feat: Expand Mapbox tool with directions and enhanced geocoding capabilities
- Added comprehensive Zod schemas for route and directions data
- Implemented new get_directions tool with support for multiple transportation profiles
- Extended MapboxGeocodingTool to MapboxTool with geocoding and routing functionality
- Added methods for geocoding locations and retrieving route details
- Integrated AI-powered text parsing and response formatting for directions
- Updated ToolRegistry to use the new MapboxTool class
- Added logging and error handling for routing and geocoding requests
* refactor: Rename Tool interface to QSTool and update type references
- Renamed `Tool` interface to `QSTool` across multiple files
- Removed unnecessary method signatures from tool interface
- Simplified tool type definitions in various components
- Updated imports and type references in tools, workflow, and core classes
- Removed unused method signatures like `execute` and `parseInput`
* refactor: Simplify Nubila weather tools and remove unnecessary abstractions
- Removed complex formatting and parsing methods from BaseWeatherAPITool
- Simplified CurrentWeatherAPITool and ForecastWeatherAPITool implementations
- Removed Coordinates extraction class and related LLM-based coordinate parsing
- Deleted redundant types file and moved type definitions inline
- Updated tool names to more descriptive and consistent formats
- Removed unnecessary method signatures and simplified tool schemas
- Enhanced test coverage for simplified tool implementations
* refactor: Simplify NewsAPI tool and remove unnecessary abstractions
- Removed commented-out Zod schemas for NewsAPI response
- Simplified NewsAPITool implementation with focused methods
- Removed logger and error handling from execute method
- Streamlined getRawData method to directly fetch and return news data
- Updated test suite to reflect new tool implementation
- Removed unnecessary method signatures and parsing logic
* refactor: Simplify DimoTool and remove complex parsing methods
- Removed execute, parseInput, and cleanData methods
- Simplified getRawData method to handle different data retrieval scenarios
- Updated tool schema initialization with more concise references
- Removed unnecessary logging and LLM-based parsing logic
- Enhanced type safety with DimoParams interface
- Streamlined vehicle and signal retrieval methods
- Updated test suite to reflect simplified tool implementation
* refactor: Extract type definitions for Dimo and Nubila tools
- Created new type definition files `src/tools/types/dimo.ts` and `src/tools/types/nubila.ts`
- Moved existing type interfaces and type definitions from `dimo.ts` and `nubila.ts` to respective type files
- Updated import statements in source files to use new type definition modules
- Improved code organization by separating type definitions from tool implementations
* refactor: Improve L1DataTool with enhanced error handling and tool schema
- Updated L1DataTool to use more precise tool schema and description
- Simplified constructor and schema initialization
- Enhanced error handling in getRawData and sendRestRequest methods
- Removed unnecessary execute and parseInput methods
- Improved test coverage for error scenarios and data retrieval
- Removed logger dependency and simplified error management
* refactor: Simplify NuclearOutagesTool and remove complex parsing methods
- Removed execute, parseInput, formatResponse, and validateDates methods
- Simplified getRawData method to handle date range validation and API requests
- Updated tool schema initialization with more concise references
- Removed LLM-based input parsing and response formatting logic
- Enhanced type safety with Zod schema validation
- Updated test suite to reflect simplified tool implementation
- Removed unnecessary imports and logger dependencies
* refactor: Simplify Nubila tool type definitions and imports
- Moved CoordinatesInput type definition from types file to nubila.ts
- Removed redundant import of CoordinatesInput in nubila.ts
- Cleaned up type definitions in nubila types file
- Simplified type management for Nubila weather tools
* refactor: Simplify DePINScan tools with enhanced error handling and type safety
- Removed complex execute and parseInput methods from DePINScanMetricsTool and DePINScanProjectsTool
- Simplified getRawData methods with direct Zod schema validation
- Updated tool schemas with more concise and descriptive names
- Enhanced error handling for API requests and network errors
- Removed unnecessary LLM-based parsing and response formatting logic
- Improved test coverage for error scenarios and data retrieval
- Cleaned up imports and removed unused dependencies
* feat: Add streaming endpoint for AI responses
- Implemented `/stream` endpoint in server.ts to support streaming AI responses
- Added `stream` method to SentientAI and QueryOrchestrator classes
- Updated ModelAdapter to support text streaming with smooth word-based chunking
- Integrated streaming functionality with existing AI workflow and tool processing
- Added UUID generation for streaming message identification
* refactor: Remove deprecated template files and test suites
- Deleted `src/templates/index.ts` containing response and tool selection templates
- Removed `src/templates/templates.test.ts` with associated test cases
- Deleted `src/tools/templates.ts` containing DePIN scan project template
- Cleaned up unused template and test files related to AI response generation
* refactor: Enhance Mapbox tool with comprehensive geocoding and directions support
- Completely refactored MapboxTool to support multiple geocoding operations
- Added new methods for forward and reverse geocoding
- Implemented robust coordinate parsing and validation
- Enhanced error handling and input type safety
- Added comprehensive test suite for all Mapbox tool methods
- Removed deprecated execute and parsing methods
- Simplified tool schema and initialization
- Improved type definitions for geocoding and directions parameters
* docs: Improve Dimo tool documentation and signal retrieval descriptions
- Added example token ID to vehicle signals tool parameters
- Enhanced description for get_latest_signals tool with usage note
- Clarified that not all vehicles support all signals
- Improved parameter descriptions for better user understanding
* feat: Add ETHDenver events search tool to tool registry
- Implemented ETHDenverTool for searching ETH Denver 2025 events
- Created vector-based retrieval system using Qdrant and OpenAI embeddings
- Added tool to ToolRegistry for dynamic tool loading
- Supports semantic search across event documents with ParentDocumentRetriever
* refactor: Simplify DePINScan and Nuclear Outages tools by removing Zod parsing
- Removed Zod schema parsing from DePINScanMetricsTool and DePINScanProjectsTool
- Simplified getRawData methods to return raw JSON directly
- Updated NuclearOutagesTool to return raw data without Zod validation
- Reduced unnecessary type parsing overhead in API response handling
* refactor: Enhance logging with improved error context and metadata handling
- Updated server.ts to add more descriptive error logging with context
- Modified winston logger to support additional metadata in log messages
- Added console.log for immediate error visibility
- Implemented custom log format to include metadata in log entries
- Improved error logging across different API endpoints (/ask, /stream, /raw)
* feat: Add configurable system prompt for LLM interactions
- Added support for custom system prompt via environment variable
- Implemented fallback system prompt in ModelAdapter for text generation and streaming
- Allows flexible configuration of AI assistant's initial context and behavior
* chore: Update package dependencies for AI and vector search tools
- Added LangChain, Qdrant, and Upstash Redis dependencies
- Integrated OpenAI, Qdrant, and LangChain core libraries
- Included logform for enhanced logging capabilities
* chore: Update docker-compose configuration for ETHDenver deployment
- Modified latest service to use qs:ethdenver image
- Added new port mapping for frontend (33333:3000)
- Commented out test service
- Added new dimo service with qs:ethdenver image and unique port mapping
* feat: Add Luma Events tool for fetching and parsing calendar events
- Implemented LumaEventsTool to fetch and filter events from Luma calendars
- Created custom iCalendar parser to extract event details
- Added Luma tool to ToolRegistry for dynamic tool loading
- Supports filtering events by title or description
- Includes URL extraction and optional knowledge base storage
* chore: Configure server idle timeout for improved connection management
- Updated package.json scripts to include server idle timeout option
- Set idle timeout to 120 seconds in server configuration
- Ensures more robust connection handling and resource management
* feat: Add support for parsing string coordinates in Nubila weather tool
- Enhanced BaseWeatherAPITool to handle string latitude and longitude inputs
- Added type conversion for string coordinates before Zod schema validation
- Updated test suite to cover string coordinate parsing scenarios
- Improved input flexibility for weather data retrieval
* test: Remove redundant Zod validation tests from tools
- Deleted schema validation tests for DePINMetricsTool, DePINProjectsTool, and NuclearOutagesTool
- Simplified test suites by removing unnecessary Zod error checking
- Maintains core functionality while reducing test complexity
* feat: Add Claude 3.7 Sonnet model to supported Anthropic models
- Updated ANTHROPIC_MODELS set in LLMService
- Added latest Claude 3.7 Sonnet model to the supported models list
* refactor: Enhance DePINScan tool with robust type handling and null value support
- Updated DepinScanProjectSchema to handle nullable and optional fields
- Added default values and flexible type parsing for project metrics
- Improved category filtering with case-insensitive matching
- Enhanced test coverage for edge cases with null and empty values
- Implemented more resilient data transformation in project filtering
* feat: Add current timestamp to system prompt for LLM context
- Dynamically append current date and time to system prompt in both text generation and streaming methods
- Ensures LLM has access to real-time temporal context
- Maintains existing system prompt configuration with optional environment variable override
* refactor: Remove optional filter parameter from Luma Events tool
- Simplified Luma Events tool schema by removing unused filter parameter
- Maintains core event fetching functionality
- Reduces unnecessary complexity in tool configuration
* feat: Enhance DePINScan tool with advanced project filtering
- Added support for filtering projects by layer 1 blockchain
- Implemented enum-based category filtering with predefined categories
- Improved filtering logic to apply multiple filters sequentially
- Updated test suite to validate new filtering capabilities
* feat: Improve DePIN metrics data handling and test coverage
- Enhanced DepinScanMetricsSchema to support mixed string/number types
- Added null/undefined handling for metrics fields
- Implemented robust parsing for volume, projects, market cap, and device metrics
- Expanded test suite with scenarios for mixed data types and missing fields
- Added comprehensive test cases for metrics transformation and edge cases
* feat: Improve L1 data parsing and add robust error handling
- Added quote removal for numeric API responses
- Implemented TPS and numeric value parsing with improved precision
- Enhanced error handling for API data retrieval
- Added logging for GraphQL analytics stats
- Exported GetL1StatsToolSchema for testing purposes
- Updated test suite to handle quoted string responses
* feat: Add comprehensive error handling and logging to tools
- Imported logger from winston across multiple tools
- Wrapped tool execution methods in try-catch blocks
- Added error logging for each tool's execution method
- Returned descriptive error messages when tool execution fails
- Improved error resilience and debugging capabilities1 parent 1f24885 commit d626fff
File tree
39 files changed
+3501
-1971
lines changed- src
- __tests__
- llm
- logger
- templates
- tools
- __tests__
- types
- types
39 files changed
+3501
-1971
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
24 | | - | |
| 27 | + | |
25 | 28 | | |
26 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
27 | 38 | | |
28 | 39 | | |
29 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
33 | 55 | | |
34 | 56 | | |
35 | 57 | | |
| |||
57 | 79 | | |
58 | 80 | | |
59 | 81 | | |
60 | | - | |
| 82 | + | |
| 83 | + | |
61 | 84 | | |
62 | 85 | | |
63 | 86 | | |
64 | 87 | | |
65 | 88 | | |
66 | 89 | | |
67 | 90 | | |
| 91 | + | |
68 | 92 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | | - | |
| 42 | + | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
17 | 24 | | |
18 | 25 | | |
19 | 26 | | |
| |||
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
34 | | - | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| |||
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | | - | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | 97 | | |
131 | 98 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | 99 | | |
138 | 100 | | |
139 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 24 | + | |
| 25 | + | |
28 | 26 | | |
29 | | - | |
30 | | - | |
| 27 | + | |
| 28 | + | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 38 | + | |
| 39 | + | |
45 | 40 | | |
46 | 41 | | |
47 | 42 | | |
48 | | - | |
49 | 43 | | |
50 | 44 | | |
51 | 45 | | |
52 | 46 | | |
53 | 47 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
58 | 54 | | |
59 | 55 | | |
60 | 56 | | |
61 | | - | |
62 | 57 | | |
63 | 58 | | |
64 | 59 | | |
65 | 60 | | |
66 | 61 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 62 | + | |
| 63 | + | |
71 | 64 | | |
72 | | - | |
| 65 | + | |
73 | 66 | | |
74 | 67 | | |
75 | 68 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | | - | |
33 | | - | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | | - | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
0 commit comments