Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chenxinma/ad-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ad Agent

A Python application that uses AI to analyze sales data and provide insights. It leverages Qwen model through DashScope API, integrates with Kuzu graph database, and provides both API and CLI interfaces for interactive data analysis.

Features

  • Reads sales data from parquet files
  • Uses AI agent to analyze data characteristics and distributions
  • Provides batch data fetching capability for large datasets
  • Generates comprehensive analysis conclusions, trends, and recommendations
  • Implements RAG (Retrieval-Augmented Generation) using Kuzu graph database
  • Supports memory management and context-aware processing
  • Offers both API and CLI interfaces for user interaction

Setup

  1. Create a .env file with the following variables:

    BAILIAN_API_KEY=your_api_key_here
    KUZU_PATH=path_to_kuzu_database
    EMBEDDING_BASE_URL=embedding_model_api_base_url
    
  2. Install dependencies using:

    pip install -e .

Usage

API Mode

Run the application in API mode with:

python -m ad_agent

Or using the provided script:

ad-agent

CLI Mode

Run the application in interactive CLI mode with:

cli-agent

Functionality

The application provides:

  1. Data loading and processing from parquet files
  2. AI-powered analysis using Qwen models via DashScope API
  3. Knowledge graph storage and retrieval using Kuzu database
  4. Context-aware conversation with memory management
  5. Interactive command-line interface for user queries

Dependencies

Key dependencies include:

  • pandas and pyarrow for data processing
  • pydantic-ai for AI model integration
  • agento for agent framework
  • kuzu for graph database functionality
  • logfire for logging and instrumentation
  • sqlite-vec for vector storage

Project Structure

  • src/ad_agent/: Main source code directory
    • __init__.py: Entry point functions
    • cli.py: Command-line interface implementation
    • llm_api.py: LLM API and agent implementation
    • models.py: Qwen model configuration
    • log_config.py: Logging configuration
    • mem/: Memory management components
    • rag_datagov/: RAG implementation with Kuzu graph
    • graph/: Graph-related utilities

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages