GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mathis-lambert/api: FastAPI backend powering mathislambert.fr services, with MongoDB, Qdrant, RAG, and OpenAI-compatible LLM integrations.

BranchesTags
Open more actions menu

Latest commit

 

History

90 Commits
90 Commits

Folders and files

NameName
Last commit message
Last commit date
development
development
 
 
src/api
src/api
 
 
tests
tests
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
docker-compose.yml
docker-compose.yml
 
 
pyproject.toml
pyproject.toml
 
 
uv.lock
uv.lock
 
 

Repository files navigation

API Repository

Welcome to the api repository! This repository hosts the core API infrastructure for my web services, built using Python 3.13 and FastAPI. The API is designed to serve essential utilities and functionalities across all my web services, accessible under the domain api.mathislambert.fr.

Projet structure

Diagram GitDiagram

🌟 Features

  • FastAPI: A modern, fast (high-performance) web framework for building APIs with Python 3.13 based on standard Python type hints.
  • MongoDB: A NoSQL database used for storing application data, offering flexibility and scalability.
  • Qdrant: A vector database used for implementing Retrieval-Augmented Generation (RAG) features, enhancing information retrieval capabilities.
  • LLM Integration: OpenAI-compatible chat completions proxied to OpenRouter.
  • Versioning: A systematic versioning approach with endpoints like /v1, /v2, etc., to manage API changes and ensure backward compatibility.

🚀 Getting Started

Prerequisites

  • Python 3.13
  • MongoDB instance
  • Qdrant instance
  • OpenRouter API key

Installation

  1. Clone the Repository:

    git clone https://github.com/your-username/api.git self_api
    cd self_api
  2. Set Up a Virtual Environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install Dependencies:

    pip install -r requirements.txt
  4. Configure Environment Variables: Create a .env file in the root directory and add the following variables:

    MONGODB_URI=your_mongodb_connection_string
    QDRANT_URI=your_qdrant_connection_string
    OPENROUTER_API_KEY=your_openrouter_api_key
    OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
    OPENROUTER_SITE_URL=https://your-site.example
    OPENROUTER_APP_NAME=your-app-name
    

Running the API

Start the FastAPI server using:

uvicorn main:app --host 0.0.0.0 --port 3001 --reload

The API will be accessible at http://127.0.0.1:3001.

🛣️ API Endpoints

Versioning

  • Base URL: https://api.mathislambert.fr
  • Versioning Structure: /v1, /v2, etc.

Example Endpoints

  • Health Check:

    • GET /v1/health: Check the status of the API.
  • LLM Routes:

    • POST /v1/chat/completions: OpenAI-compatible chat completions proxied to OpenRouter (metadata-only logging to MongoDB).
    • POST /v1/responses: OpenAI-compatible responses proxied to OpenRouter (metadata-only logging to MongoDB).
  • Data Routes:

    • GET /v1/data: Retrieve data from MongoDB.
    • POST /v1/data: Insert data into MongoDB.
  • RAG Features:

    • POST /v1/rag/query: Query the Qdrant database for enhanced information retrieval using RAG.

🤝 Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request. Let's build something amazing together!

📜 License

This project is licensed under the MIT License. Feel free to explore, modify, and share!

📞 Contact

Have questions or want to chat? Feel free to reach out!

  • LinkedIn 🔗

Happy coding! 💻✨

About

FastAPI backend powering mathislambert.fr services, with MongoDB, Qdrant, RAG, and OpenAI-compatible LLM integrations.

api.mathislambert.fr

Topics

dockerfastapillmmongodbopenaipythonqdrantragrest-api

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.