Compare commits

..

14 commits

Author SHA1 Message Date
nsde ce2cd9469e Quicker models endpoint 2023-08-19 17:53:48 +02:00
nsde 474723c6dd Added gpt-4-32k support 2023-08-19 17:47:57 +02:00
Game_Time c0867bb865
Update tests.yml 2023-08-19 19:28:11 +05:00
Game_Time e3f938bb1a
Update users.py to enviorn 2023-08-19 19:26:37 +05:00
Game_Time 8719efd619
Update stats.py to enviorn 2023-08-19 19:26:14 +05:00
Game_Time 6d84c625a2
change .getenv to .enviorn 2023-08-19 19:25:45 +05:00
Game_Time 9be541fc45
Update tests.yml to include uvicorn 2023-08-19 19:22:50 +05:00
Game_Time 299ef72860
no need for sleep 2023-08-19 19:21:26 +05:00
nsde ee0c9e9d96 Docs 2023-08-19 16:20:16 +02:00
Game_Time 162e128366
setting enviornmental variables properly 2023-08-19 19:19:54 +05:00
Game_Time eebf72aea6
letstrythis 2023-08-19 19:16:49 +05:00
Game_Time e7198cc6e3
Update __main__.py 2023-08-19 19:12:26 +05:00
Game_Time 188a6c3b70
Update tests.yml 2023-08-19 19:11:54 +05:00
Game_Time 1d527cf18b
fix python version 2023-08-19 19:06:34 +05:00
10 changed files with 1748 additions and 1367 deletions

View file

@ -5,7 +5,10 @@ on: [pull_request]
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
MONGO_URI: justtotes
NOVA_KEY: ${{ secrets.NOVA_KEY }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -13,22 +16,17 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.10 python-version: 3.x
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
pip install uvicorn
- name: Start API server - name: Start API server
env:
MONGO_URI: ${{ secrets.MONGO_URI }}
TEST_NOVA_KEY: ${{ secrets.NOVA_KEY }}
run: | run: |
python run python run
- name: Wait for API server to start
run: sleep 10 # We can adjust this sleep duration as needed. idk how long the server takes to start
- name: Run tests - name: Run tests
run: python tests run: python tests

View file

@ -12,7 +12,7 @@ Reverse proxy server for "Closed"AI's API.
![Badge showing the number of forks](https://img.shields.io/github/forks/novaoss/nova-api?style=social) ![Badge showing the number of forks](https://img.shields.io/github/forks/novaoss/nova-api?style=social)
![Badge showing the number of watchers](https://img.shields.io/github/watchers/novaoss/nova-api?style=social) ![Badge showing the number of watchers](https://img.shields.io/github/watchers/novaoss/nova-api?style=social)
![Nova-API Conver/Banner Image. A picture of a galaxy with the caption "the core API server"](https://i.ibb.co/ZBhkS56/nova-api.png) ![Nova-API Conver/Banner Image - a picture of a galaxy with the caption "the core API server"](https://i.ibb.co/ZBhkS56/nova-api.png)
> "*OpenAI is very closed*" > "*OpenAI is very closed*"
> >
@ -20,13 +20,29 @@ Reverse proxy server for "Closed"AI's API.
We aim to fix that! We aim to fix that!
## Star History
###### *I founded FoxGPT (called *NovaGPT* back then)
Old, slow, deprecated* FoxGPT vs new NovaAI repository star count:
<a href="https://star-history.com/#NovaOSS/nova-api&FoxGPT/gpt&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date" />
</picture>
</a>
<img alt="'Emotional damage' meme, with a man with a worried face and the yellow caption 'emotional damage'" src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Findianmemetemplates.com%2Fwp-content%2Fuploads%2Femotional-damage-1024x575.jpg&f=1&nofb=1&ipt=b325721ee0a7b9e11603a9bd484c8042b82e1704e639887107c6ce3e0d9b389e&ipo=images" height=100>
## NovaOSS APIs ## NovaOSS APIs
Our infrastructure might seem a bit confusing, but it's actually quite simple. Just the first one really matters for you, if you want to access our AI API. The other ones are just for the team. Our infrastructure might seem a bit confusing, but it's actually quite simple. Just the first one really matters for you, if you want to access our AI API. The other ones are just for the team.
### AI API ### AI API
**Public** (everyone can use it with a valid API key) **Public** (everyone can use it with a valid API key)
Official endpoints: `https://api.nova-oss.com/v1/...` Endpoint: `https://api.nova-oss.com/v1/...`
Documentation & info: [nova-oss.com](https://nova-oss.com) Documentation & info: [nova-oss.com](https://nova-oss.com)
- Access to AI models - Access to AI models
@ -36,16 +52,24 @@ Documentation & info: [nova-oss.com](https://nova-oss.com)
### User/Account management API ### User/Account management API
**Private** (NovaOSS operators only!) **Private** (NovaOSS operators only!)
Official endpoints: `https://api.nova-oss.com/...` Endpoint: `https://api.nova-oss.com/...`
Documentation: [api.nova-oss.com/docs](https://api.nova-oss.com/docs) Documentation: [api.nova-oss.com/docs](https://api.nova-oss.com/docs)
- Access to user accounts - Access to user accounts
- Implemented in [NovaCord](https://nova-oss.com/novacord) - Implemented in [NovaCord](https://nova-oss.com/novacord)
### NovaCord Bot API
**Private** (NovaOSS operators only!)
Endpoint: `http://0.0.0.0:3224/...`
- acess to Discord server member roles (for receiving the Discord level, ...)
- hosted using [NovaCord](https://nova-oss.com/novacord)
### Website API ### Website API
**Private** (NovaOSS operators only!) **Private** (NovaOSS operators only!)
Official endpoints: `https://nova-oss.com/api/...` Endpoint: `https://nova-oss.com/api/...`
This one's code can be found in the following repository: [github.com/novaoss/nova-web](https://github.com/novaoss/nova-web) This one's code can be found in the following repository: [github.com/novaoss/nova-web](https://github.com/novaoss/nova-web)

View file

@ -18,7 +18,7 @@ UA_SIMPLIFY = {
## MONGODB Setup ## MONGODB Setup
conn = AsyncIOMotorClient(os.getenv('MONGO_URI')) conn = AsyncIOMotorClient(os.environ['MONGO_URI'])
async def _get_collection(collection_name: str): async def _get_collection(collection_name: str):
return conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name] return conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name]

View file

@ -23,7 +23,7 @@ class StatsManager:
""" """
def __init__(self): def __init__(self):
self.conn = AsyncIOMotorClient(os.getenv('MONGO_URI')) self.conn = AsyncIOMotorClient(os.environ['MONGO_URI'])
async def _get_collection(self, collection_name: str): async def _get_collection(self, collection_name: str):
return self.conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name] return self.conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name]

View file

@ -35,7 +35,7 @@ class UserManager:
""" """
def __init__(self): def __init__(self):
self.conn = AsyncIOMotorClient(os.getenv('MONGO_URI')) self.conn = AsyncIOMotorClient(os.environ['MONGO_URI'])
async def _get_collection(self, collection_name: str): async def _get_collection(self, collection_name: str):
return self.conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name] return self.conn[os.getenv('MONGO_NAME', 'nova-test')][collection_name]

File diff suppressed because it is too large Load diff

View file

@ -28,6 +28,9 @@ async def handle(incoming_request):
users = UserManager() users = UserManager()
path = incoming_request.url.path.replace('v1/v1/', 'v1/') path = incoming_request.url.path.replace('v1/v1/', 'v1/')
if '/models' in path:
return fastapi.responses.JSONResponse(content=models_list)
try: try:
payload = await incoming_request.json() payload = await incoming_request.json()
except json.decoder.JSONDecodeError: except json.decoder.JSONDecodeError:
@ -52,10 +55,6 @@ async def handle(incoming_request):
if ban_reason: if ban_reason:
return await errors.error(403, f'Your NovaAI account has been banned. Reason: "{ban_reason}".', 'Contact the staff for an appeal.') return await errors.error(403, f'Your NovaAI account has been banned. Reason: "{ban_reason}".', 'Contact the staff for an appeal.')
path_contains_models = '/models' in path
if path_contains_models:
return fastapi.responses.JSONResponse(content=models_list)
costs = config['costs'] costs = config['costs']
cost = costs['other'] cost = costs['other']

BIN
image-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 KiB

BIN
image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 KiB

View file

@ -109,7 +109,7 @@ def test_all():
if __name__ == '__main__': if __name__ == '__main__':
closedai.api_base = api_endpoint closedai.api_base = api_endpoint
closedai.api_key = os.getenv('TEST_NOVA_KEY') closedai.api_key = os.environ['NOVA_KEY']
HEADERS = { HEADERS = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',