mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 22:23:56 +01:00
Compare commits
No commits in common. "0e10b961a4a35f5fe2bad7cca9865163f4c47c3e" and "08776459818e4c7c26079d9fdb0054721f486fa4" have entirely different histories.
0e10b961a4
...
0877645981
12
.github/workflows/tests.yml
vendored
12
.github/workflows/tests.yml
vendored
|
@ -1,14 +1,12 @@
|
|||
name: Python Tests
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [review_requested]
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
MONGO_URI: ${{ secrets.MONGO_URI }}
|
||||
MONGO_URI: justtotes
|
||||
NOVA_KEY: ${{ secrets.NOVA_KEY }}
|
||||
|
||||
steps:
|
||||
|
@ -18,7 +16,7 @@ jobs:
|
|||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
python-version: 3.10
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
@ -26,7 +24,9 @@ jobs:
|
|||
pip install -r requirements.txt
|
||||
pip install uvicorn
|
||||
|
||||
- name: Start API server & run tests!
|
||||
- name: Start API server
|
||||
run: |
|
||||
python run
|
||||
|
||||
- name: Run tests
|
||||
run: python tests
|
||||
|
|
10
README.md
10
README.md
|
@ -1,5 +1,5 @@
|
|||
# ☄️ NovaAI - Core API Server
|
||||
API server for accessing AI models.
|
||||
# ☄️ NovaOSS API Server
|
||||
Reverse proxy server for "Closed"AI's API.
|
||||
|
||||
![Badge showing the most used language](https://img.shields.io/github/languages/top/novaoss/nova-api)
|
||||
![Badge showing the code size](https://img.shields.io/github/languages/code-size/novaoss/nova-api)
|
||||
|
@ -14,7 +14,11 @@ API server for accessing AI models.
|
|||
|
||||
![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)
|
||||
|
||||
We aim to fix that! NovaAI provides several AI models for you to use for free.
|
||||
> "*OpenAI is very closed*"
|
||||
>
|
||||
> — [ArsTechnica (July 2023)](https://arstechnica.com/information-technology/2023/07/is-chatgpt-getting-worse-over-time-study-claims-yes-but-others-arent-sure/)
|
||||
|
||||
We aim to fix that!
|
||||
|
||||
## Star History
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class UserManager:
|
|||
async def create(self, discord_id: str = '') -> dict:
|
||||
chars = string.ascii_letters + string.digits
|
||||
|
||||
infix = os.getenv('KEYGEN_INFIX', 'S3LFH0ST')
|
||||
infix = os.getenv('KEYGEN_INFIX')
|
||||
suffix = ''.join(random.choices(chars, k=20))
|
||||
prefix = ''.join(random.choices(chars, k=20))
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ app.include_router(core.router)
|
|||
async def startup_event():
|
||||
# DATABASE FIX https://stackoverflow.com/questions/65970988/python-mongodb-motor-objectid-object-is-not-iterable-error-while-trying-to-f
|
||||
import pydantic, bson
|
||||
# pydantic.json.ENCODERS_BY_TYPE[bson.objectid.ObjectId]=str
|
||||
pydantic.json.ENCODERS_BY_TYPE[bson.objectid.ObjectId]=str
|
||||
|
||||
@app.get('/')
|
||||
async def root():
|
||||
|
|
|
@ -14,7 +14,6 @@ Runs for production on the speicified port.
|
|||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
port = sys.argv[1] if len(sys.argv) > 1 else 2332
|
||||
dev = True
|
||||
|
@ -23,4 +22,4 @@ if 'prod' in sys.argv:
|
|||
port = 2333
|
||||
dev = False
|
||||
|
||||
os.system(f'cd api && uvicorn main:app{" --reload" if dev else ""} --host 0.0.0.0 --port {port} & python tests')
|
||||
os.system(f'cd api && uvicorn main:app{" --reload" if dev else ""} --host 0.0.0.0 --port {port}')
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import os
|
||||
import openai as closedai
|
||||
import httpx
|
||||
import time
|
||||
|
||||
from rich import print
|
||||
from typing import List
|
||||
|
@ -92,15 +91,12 @@ def test_api_moderation() -> dict:
|
|||
|
||||
def test_all():
|
||||
"""Runs all tests."""
|
||||
try:
|
||||
print("Waiting until API Server is started up...")
|
||||
time.sleep(6)
|
||||
|
||||
print('[lightblue]Running test on API server to check if its running...')
|
||||
print(test_server())
|
||||
|
||||
print('[lightblue]Running a api endpoint to see if requests can go through...')
|
||||
print(test_api('gpt-3.5-trubo'))
|
||||
print(test_api())
|
||||
|
||||
print('[lightblue]Checking if the API works with the python library...')
|
||||
print(test_library())
|
||||
|
@ -110,10 +106,6 @@ def test_all():
|
|||
|
||||
print('[lightblue]Checking the /v1/models endpoint...')
|
||||
print(test_models())
|
||||
except Exception as e:
|
||||
print('[red]Error: ')
|
||||
print(e)
|
||||
exit(500)
|
||||
|
||||
if __name__ == '__main__':
|
||||
closedai.api_base = api_endpoint
|
||||
|
|
Loading…
Reference in a new issue