Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data fusion #46

Merged
merged 63 commits into from
Jan 28, 2025
Merged

Data fusion #46

merged 63 commits into from
Jan 28, 2025

Conversation

nicky-ru
Copy link
Member

flowchart TD
    UQ[User Query: From agent with context and necessary knowledge]
    
    subgraph QuickSilver
        LLM[LLM: Understand Query]
        DP[Determine Providers to Use]
        FP[Fetch Data from Providers]
        FA[Fuse & Analyze Data]
        EV[Evaluate Output]
        RA[Return Analysis to Agent]

        subgraph QuickSilver Providers
            WQS[Weather Plugin]
            MQS[Maps Plugin]
            SQS[Sensors Plugin]
        end
    end

    %% Workflow Connections
    UQ --> LLM
    LLM --> DP
    DP -->|Selects Relevant Providers| WQS
    DP -->|Selects Relevant Providers| MQS
    DP -->|Selects Relevant Providers| SQS
    WQS --> FP
    MQS --> FP
    SQS --> FP
    FP --> FA
    FA --> EV
    EV --> RA
Loading

- Added unit tests for SentientAI to validate response handling.
- Created mock services for LLM and weather tools to facilitate testing.
- Cleaned up import paths in SentientAI.ts for consistency.
- Removed direct LLM instantiation from Agent, now using LLMService for LLM management.
- Refactored Workflow to utilize LLMService for LLM calls.
- Added unit tests for Agent to validate prompt generation and execution with tools.
- Introduced LLMService to encapsulate LLM initialization logic.
- Updated TogetherLLM to require an API key during instantiation, improving error handling.
- Removed unnecessary console log from OpenAILLM's generate method.
- Added unit tests for DummyLLM, OpenAILLM, and TogetherLLM to validate response generation and error scenarios.
- Refactored the Agent class to implement IAgent and streamline the constructor.
- Removed the previous prompt generation logic from the Agent class.
- Updated SentientAI to initialize the Agent with a name, description, and a comprehensive set of tools.
- Adjusted unit tests for the Agent to reflect the new structure and ensure proper functionality.
- Introduced a new prompt generation template for tool selection.
- Updated the constructor to accept tools and a prompt function.
- Added unit tests for Workflow to validate tool execution and prompt generation with various scenarios.
- Improved error handling in the execute method.
…cessing logic

- Removed unused ActionResult import and streamlined the process method.
- Refactored tool selection logic to utilize a new extraction function for tool names from LLM responses.
- Updated the selectTools method to return an array of selected tools based on user input.
- Added unit tests for process and selectTools methods to validate tool execution and selection scenarios.
- Improved error handling for cases with no tools selected.
…improved tool handling

- Refactored finalResponseTemplate to support multiple tools and outputs, enhancing prompt generation.
- Updated toolSelectionTemplate to return a list of selected tool names instead of a JSON object format.
- Added a new test case for generating prompts with multiple tools in templates.test.ts.
- Improved handling of Twitter accounts for multiple tools in the final response.
…ection more effectively

- Introduced proceedWithoutTools and proceedWithTools methods to streamline processing.
- Updated unit tests to validate new behavior, including a test for processing input without tools.
- Removed outdated test case that checked for "No tools selected" message, aligning with new logic.
…d unit tests

- Modified APITool constructor to accept twitterAccount as an optional parameter, defaulting to an empty string.
- Removed apiKey from the constructor, removing security risk where serialization of the class could include api key.
- Added a new test suite for APITool to validate initialization, execution, and optional twitterAccount handling.
- Ensured proper serialization to JSON without including apiKey.
…ecution logic

- Modified APITool class to accept a generic type parameter for input parsing.
- Implemented parseInput method in TestAPITool to handle specific input format.
- Updated execute method to utilize parsed input, improving execution output.
- Enhanced unit tests to validate new input handling and execution behavior.
- Replaced references to the old weather API tools with the new Nubila API tools in multiple files.
- Deleted the outdated weatherapi.ts file and created a new nubila.ts file to encapsulate the current and forecast weather tools.
- Updated tests to mock the new Nubila API tools and ensure compatibility with the refactored structure.
- Enhanced the CurrentWeatherAPITool to include improved input parsing and error handling.
- Added new types for weather data to support the updated API response structure.
- Updated finalResponseTemplate and toolSelectionTemplate to include an output property for tools.
- Refactored APITool constructor to accept an object for better clarity and maintainability.
- Introduced new unit tests for templates to ensure correct prompt generation with and without Twitter accounts.
- Improved error handling in NewsAPITool and added output descriptions for better context in tool usage.
- Updated finalResponseTemplate to provide a structured response format, including detailed analysis and response sections.
- Improved clarity by replacing raw data outputs with tagged sections for user input, tools used, and tool outputs.
- Enhanced the response generation process with a step-by-step analysis guide to ensure accurate and relevant answers.
- Adjusted unit tests to validate the new response structure and ensure proper handling of tool outputs and Twitter accounts.
…parsing and response handling

- Updated execute and parseInput methods to accept LLMService as a parameter for enhanced functionality.
- Modified the input parsing logic to derive coordinates more effectively from user queries.
- Adjusted unit tests to reflect changes in method signatures and ensure proper LLMService integration.
- Changed response format in coordinate extraction to improve clarity and consistency.
…d response parsing

- Added output property to tools in QueryOrchestrator for better context.
- Changed tool selection logic to extract tool names from the updated response format.
- Modified proceedWithTools method to include LLMService in tool execution and improved output parsing.
- Introduced a TestAPITool for unit testing, ensuring proper integration with the updated workflow.
- Updated unit tests to validate new tool handling and response formats.
…ionality

- Updated execute and parseInput methods in APITool to accept LLMService as a parameter, improving integration with language model services.
- Added output property to Tool interface for better context in tool usage.
- Adjusted related types and imports to ensure consistency across the codebase.
- Added @anthropic-ai/sdk as a dependency in package.json and pnpm-lock.yaml.
- Refactored LLM classes to replace OpenAILLM and TogetherLLM with AnthropicLLM for improved functionality.
- Updated LLMService to initialize with AnthropicLLM, ensuring compatibility with new model configurations.
- Modified tests to reflect the removal of OpenAILLM and TogetherLLM, focusing on AnthropicLLM integration.
@nicky-ru nicky-ru marked this pull request as ready for review January 24, 2025 19:58
- Removed Together AI and EmbedJS related dependencies from package.json
- Deleted TOGETHER_API_KEY environment variable check in LLMService constructor
- Modified AnthropicLLM class to use a more flexible constructor
- Added explicit model parameter to improve configuration control
- Simplified object assignment in constructor initialization
- Integrated OpenAI SDK as a dependency in package.json
- Created OpenAILLM class implementing the LLM interface
- Added support for configurable model, API key, and optional base URL
- Improved type safety and error handling in LLM generation method
…action

- Simplified weather tool field selection to focus on essential weather data
- Extracted coordinate extraction template to a separate module
- Improved coordinate parsing with a more concise LLM prompt template
- Implemented support for multiple LLM providers (Anthropic, OpenAI, Deepseek)
- Added configurable fast and main LLM providers with custom model selection
- Updated LLMService constructor to accept provider parameters
- Expanded test coverage for different LLM provider scenarios
- Introduced DummyLLM as a fallback for unknown providers
…s and LLM configuration

- Replaced DePINTool with DePINScanMetricsTool and DePINScanProjectsTool
- Modified QueryOrchestrator to accept LLMService as a constructor parameter
- Updated SentientAI to configure LLMService with OpenAI and Anthropic providers
- Simplified test mocks for LLMService and weather tools
- Implemented DePINScanMetricsTool to fetch global decentralized physical infrastructure (DePIN) metrics
- Created DePINScanProjectsTool to retrieve and analyze DePIN project information
- Added supporting template for project data extraction
- Included comprehensive test suite for both tools covering API interactions and error handling
- Simplified template text by breaking long lines
- Removed redundant instructions and comments
- Cleaned up example output structure
- Implemented L1DataTool to fetch comprehensive IoTeX L1 chain statistics
- Added support for retrieving metrics like TVL, contracts, staked tokens, nodes, dapps, and cross-chain transactions
- Created comprehensive test suite covering API interactions and error handling
- Integrated L1DataTool into SentientAI's tool collection
…cess

- Optimized Dockerfile to copy project files before running bun install
- Added .dockerignore to exclude node_modules and npm-debug.log from Docker context
- Added Deepseek and Anthropic API keys
- Configured default fast and main LLM models
- Included API V2 key for IoTeX L1 data
- Maintained template structure for easy configuration
- Switched main LLM provider from Anthropic to Deepseek
- Maintained existing configuration structure for LLMService
@guo guo merged commit cedde92 into iotexproject:main Jan 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants