Skip to content
BiTsY2KPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LatticeAI 🧠

Autonomous Workspace Intelligence Platform

LatticeAI is an intelligent multi-agent system that analyzes your Google Workspace (Drive, Gmail, Calendar) to provide actionable insights, extract tasks, and optimize your workflow using advanced AI powered by Google's Gemini and Vertex AI.


✨ Features

  • πŸ€– Multi-Agent Architecture: Specialized agents for Drive analysis, email intelligence, and calendar optimization
  • πŸ” Semantic Search: Vector-based search with metadata filtering for precise queries
  • πŸ“§ Email Intelligence: Extract action items, deadlines, and urgent tasks from emails
  • πŸ“ Drive Analysis: Identify poorly named files, suggest organization improvements
  • πŸ“… Calendar Optimization: Analyze schedules and suggest time management improvements
  • 🎯 Date-Aware Queries: Filter results by specific dates (e.g., "emails from December 11, 2025")
  • πŸ”„ Automatic Ingestion: Periodic workspace data synchronization
  • πŸš€ RESTful API: FastAPI-based backend with async support

πŸ—οΈ Architecture

LatticeAI/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ agents/           # Specialized AI agents
β”‚   β”‚   β”œβ”€β”€ orchestrator.py
β”‚   β”‚   β”œβ”€β”€ drive_analyst.py
β”‚   β”‚   β”œβ”€β”€ email_intelligence.py
β”‚   β”‚   └── calendar_optimizer.py
β”‚   β”œβ”€β”€ core/             # Core intelligence engine
β”‚   β”‚   β”œβ”€β”€ workspace_intelligence.py
β”‚   β”‚   β”œβ”€β”€ vector_store.py
β”‚   β”‚   β”œβ”€β”€ config.py
β”‚   β”‚   └── models.py
β”‚   β”œβ”€β”€ integrations/     # Google Workspace connectors
β”‚   β”‚   └── workspace_connector.py
β”‚   β”œβ”€β”€ api/              # FastAPI application
β”‚   β”‚   └── main_1.py
β”‚   └── credentials/      # Google Cloud credentials
└── README.md

πŸ“‹ Prerequisites

  • Python: 3.10 or higher
  • Google Cloud Project with:
    • Vertex AI API enabled
    • Gmail API enabled
    • Google Drive API enabled
    • Google Calendar API enabled
  • Google Cloud Credentials:
    • Service Account key (for Vertex AI)
    • OAuth 2.0 Client ID (for Workspace APIs)

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/yourusername/Lattice-AI.git
cd Lattice-AI/latticeai/backend

2. Create Virtual Environment

# Windows
python -m venv venv
venv\Scripts\activate

# macOS/Linux
python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Set Up Google Cloud Credentials

Service Account (for Vertex AI)

  1. Go to Google Cloud Console
  2. Create a Service Account with Vertex AI permissions
  3. Download the JSON key file
  4. Save it as credentials/sa-vertex.json

OAuth 2.0 (for Workspace APIs)

  1. Create OAuth 2.0 Client ID in Google Cloud Console
  2. Download the credentials.json file
  3. Save it as api/credential.json

5. Configure Environment Variables

Create a .env file in the backend/ directory:

# Google Cloud Project
GCP_PROJECT_ID=your-project-id
GCP_REGION=us-central1

# Service Account Credentials
GOOGLE_CREDENTIALS_PATH=../credentials/sa-vertex.json

# Models
GEMINI_MODEL=gemini-2.0-flash
EMBEDDING_MODEL=text-embedding-004
AGENT_TEMPERATURE=0.3
AGENT_MAX_TOKENS=2000

# Vector Search
VECTOR_DIMENSIONS=768
SEMANTIC_SEARCH_TOP_K=10
SIMILARITY_THRESHOLD=0.7

# API Configuration
DEBUG=true
API_HOST=0.0.0.0
API_PORT=8000

# Data Ingestion
INGESTION_INTERVAL_SECONDS=1800
INGESTION_LOOKBACK_DAYS=7

# CORS
CORS_ORIGINS=["http://localhost:3000","http://localhost:3001"]

🎯 Usage

Start the Backend Server

cd api
uvicorn main_1:app --reload

The API will be available at http://localhost:8000

API Documentation

Once the server is running, visit:

Example API Requests

Process a Query

POST http://localhost:8000/query
Content-Type: application/json

{
  "query": "Show me emails from December 11, 2025",
  "user_id": "user123"
}

Get Workspace Summary

GET http://localhost:8000/workspace/summary

Trigger Manual Ingestion

POST http://localhost:8000/ingest

πŸ”§ Configuration

Environment Variables

Variable Description Default
GCP_PROJECT_ID Google Cloud Project ID hackathon-481812
GCP_REGION Google Cloud Region us-central1
GEMINI_MODEL Gemini model name gemini-2.0-flash
EMBEDDING_MODEL Text embedding model text-embedding-004
VECTOR_DIMENSIONS Embedding vector size 768
SEMANTIC_SEARCH_TOP_K Number of search results 10
SIMILARITY_THRESHOLD Minimum similarity score 0.7
INGESTION_INTERVAL_SECONDS Auto-ingestion interval 1800 (30 min)

πŸ“¦ Dependencies

Core Framework

  • FastAPI 0.109.0 - Modern web framework
  • Uvicorn 0.27.0 - ASGI server
  • Pydantic 2.5.3 - Data validation

Google Cloud & AI

  • google-cloud-aiplatform 1.40.0 - Vertex AI SDK
  • vertexai 1.43.0 - Vertex AI generative models
  • google-api-python-client 2.115.0 - Workspace APIs

ML & Data Processing

  • numpy 1.26.4 - Numerical computing
  • scikit-learn 1.4.0 - Machine learning utilities

Development

  • pytest 7.4.4 - Testing framework
  • black 24.1.1 - Code formatter
  • flake8 7.0.0 - Linter

πŸ§ͺ Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=. --cov-report=html

# Run specific test file
pytest tests/test_agents.py

πŸ› οΈ Development

Code Formatting

black .

Linting

flake8 .

Project Structure

  • agents/ - AI agent implementations
  • core/ - Core intelligence and vector store
  • integrations/ - External API connectors
  • api/ - FastAPI routes and endpoints
  • tests/ - Unit and integration tests

πŸ” Security Notes

  • Never commit .env files or credential files
  • Store credentials in credentials/ directory (gitignored)
  • Use service accounts with minimal required permissions
  • Rotate API keys regularly
  • Enable 2FA on Google Cloud account

πŸ› Troubleshooting

Quota Exceeded Error

If you see 429 Quota exceeded errors:

  • The system automatically switches to mock mode
  • Request quota increase: Vertex AI Quotas
  • Use a different GCP project with available quota

Authentication Issues

# Verify credentials path
echo $GOOGLE_CREDENTIALS_PATH

# Test service account
gcloud auth activate-service-account --key-file=credentials/sa-vertex.json

Import Errors

# Reinstall dependencies
pip install -r requirements.txt --force-reinstall

πŸ“š Documentation


🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘₯ Authors

  • Your Name - Initial work

πŸ™ Acknowledgments

  • Google Cloud Platform for Vertex AI
  • FastAPI community
  • OpenAI for inspiration

πŸ“ž Support

For issues and questions:


Built with ❀️ using Google Gemini and Vertex AI

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages