API

the store for data

Unparty Query API with Chat Interface

This repository contains an API that connects to Pinecone and Upstash vector databases for semantic similarity search, along with a chat interface built with Next.js and the AI SDK.

Features

  • Pinecone vector database integration
  • Upstash Redis vector database integration
  • Real-time chat interface
  • Custom AI models that search your knowledge base

Getting Started

  1. Install dependencies:

    bash

    npm install
  2. Create a .env file with your credentials:

    Code

    PINECONE_API_KEY=your_pinecone_api_key
    PINECONE_INDEX_NAME=your_pinecone_index
    UPSTASH_VECTOR_REST_URL=your_upstash_rest_url
    UPSTASH_VECTOR_REST_TOKEN=your_upstash_rest_token
  3. Run the development server:

    bash

    npm run dev
  4. Open http://localhost:3000 to see the chat interface.

API Endpoints

For comprehensive documentation including functionality, dependencies, caching strategies, rate limits, and optimization recommendations, see API Documentation.

Quick Reference

  • /api/pinecone-upsert - Upload content to Pinecone database (Complete Guide)
  • /api/pinecone-query - Query Pinecone vector database for semantic similarity search
  • /api/pinecone-embed - Generate text embeddings using Pinecone's inference API
  • /api/pinecone-delete - Delete records from Pinecone by namespace
  • /api/chat - Chat API endpoint for the UI

Key Features

  • Content Upload: Upload documents (.md, .json, .csv, .png) with automatic processing
  • Vector Similarity Search: Advanced semantic search with caching and rate limiting
  • Text Embeddings: Convert text to 1024-dimensional vectors using llama-text-embed-v2
  • Redis Caching: Optimized response times with Upstash Redis integration
  • Rate Limiting: Graceful handling of API limits with retry logic
  • Error Handling: Comprehensive error handling and fallback strategies

Deployment

This application is ready to deploy on Vercel:

  1. Push to GitHub
  2. Connect to Vercel
  3. Set environment variables
  4. Deploy

UNPARTY Ecosystem

This repository is part of the UNPARTY ecosystem. For comprehensive documentation including architecture, integration points, business value alignment, and relationships to other UNPARTY repositories, see ECOSYSTEM.md.

Quick Links

License

This project is licensed under the terms of the license included in the repository.