Git Product home page Git Product logo

az2oaiproxy's Introduction

Azure to OpenAI Protocol Proxy

このプロジェクトは、AzureからのリクエストをOpenAIのAPIに転送するPython Flaskアプリケーションです。Azureからのリクエストを受け取り、それをOpenAIのAPIに転送します。これにより、ユーザーはAzureのプロトコルを使用してOpenAIの機能を利用することができます。

機能

  • AzureからのリクエストをOpenAIのAPIに転送
  • OpenAIのAPIからのレスポンスをAzureに返送

セットアップ

  1. 必要なライブラリをインストールします:

    pip install flask
  2. app.pyを実行します:

    python app.py
  3. Nginxのリバースプロキシ設定:

    このプロジェクトはFlaskアプリケーションであり、本番環境で実行する場合は、通常、NginxなどのWebサーバーをリバースプロキシとして使用します。以下に、基本的なNginxの設定を示します:

    server {
        listen 80;
        server_name your_domain_or_IP;
    
        location / {
            proxy_pass http://localhost:5000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

    この設定を適用するには、この設定を含むファイルをNginxの設定ディレクトリ(通常は/etc/nginx/sites-available/)に保存し、その後で/etc/nginx/sites-enabled/ディレクトリにシンボリックリンクを作成します。最後に、Nginxをリロードまたは再起動します。

    なお、your_domain_or_IPは適切なドメイン名またはIPアドレスに置き換えてください。

    もし、HTTPSを使用欲しい場合は、certbotを使用ください。

    sudo certbot --nginx

使用方法

POSTリクエストを/chat/<model_name>エンドポイントに送信します。リクエストヘッダーにはapi-keyを含め、リクエストボディにはmessagemax_tokenstemperaturetop_pを含めます。

注意事項

このプロジェクトはデモンストレーション用であり、本番環境での使用は推奨されません。本番環境で使用する場合は、適切なエラーハンドリングとセキュリティ対策を行ってください。

az2oaiproxy's People

Contributors

uefi-code avatar

Watchers

 avatar  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.