Giter Site home page Giter Site logo

circuitstream's Introduction

CircuitStream ๐ŸŒโšก

A universal Language Model relay system, making it seamless to integrate with various models across different platforms! Designed to help developers achieve interoperability without hassles.

This type of relay is also useful if you're an organization with a single account distributed accross multiple teams or developers as rate limit can be configured at a per model level.

If you're running tests against multiple LLMs this is also a great way to generate centralized analytics.

License: MIT Python FastAPI


Features ๐ŸŒŸ

  • Unified Interface: One API to rule them all! Easily call different models through a standardized interface.
  • Configurable: Add or modify endpoints without touching the core logic.
  • Rate Limiting: Safeguard against excessive requests with built-in rate limiting. Rate Limit
  • Analytics: Dive deep into request analytics with logging and insights. Analytics
  • Cross-Origin Resource Sharing (CORS): Built-in CORS support, making it browser friendly.
  • Automated instrumentation of all models: Automated observability and analytics for all models with Langfuse. Langfuse

Getting Started ๐Ÿš€

Prerequisites

  • Python 3.8+
  • Virtual Environment (recommended)

Setup & Installation

  1. Clone the repository:
git clone https://github.com/balgan/CircuitStream.git
cd CircuitStream
  1. Create and activate a virtual environment (Optional but recommended):
python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  1. Install the dependencies:
pip install -r requirements.txt
  1. Modify the config.json file to match your desired configuration for various language models and platforms.

  2. Create create a secrets.json with your langfuse configuration with the following format:

{
    "ENV_PUBLIC_KEY": "pk-XXX",
    "ENV_SECRET_KEY": "sk-XXX",
    "ENV_HOST": "http://xxx.xxx.xxx.xxx"
}
  1. Run the relay:
python llm_relay.py
  1. Run a webserver to view the index:
python -m http.server 8081

Now, your CircuitStream relay is up and running on http://localhost:8000/ and you can also browse http://localhost:8081 to view analytics.


Usage ๐Ÿ–ฅ๏ธ

Here's how to send a request:

curl -X POST http://localhost:8000/callmodel \
  -H "Content-Type: application/json" \
  -d '{
    "project_name": "openai",
    "model_name": "gpt-4",
    "prompt": "Hello World!",
    "api_token": "your-api-key-here"
  }'

curl -X POST http://localhost:8000/callmodel \
  -H "Content-Type: application/json" \
  -d '{
    "project_name": "anthropic",
    "model_name": "claude-2",
    "prompt": "H\nHuman: Hello, world!\n\nAssistant:",
    "api_token": "your-api-key-here"
  }'

For additional routes and functionalities, refer to the API documentation generated with FastAPI.


Contributing ๐Ÿค

We love contributions! If you have any improvements or feature suggestions, please:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/FeatureName)
  3. Commit your Changes (git commit -m 'Add some FeatureName')
  4. Push to the Branch (git push origin feature/FeatureName)
  5. Open a Pull Request

License ๐Ÿ“œ

Distributed under the MIT License. See LICENSE for more information.


Acknowledgements ๐ŸŽ‰


Support ๐ŸŒ

Having issues? Open an issue and let's debug it together!

circuitstream's People

Contributors

balgan avatar invisiblethreat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.