This repository has been archived by the owner on Nov 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
149 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Run Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.10 | ||
cache: 'pip' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt -r requirements-dev.txt | ||
- name: Run tests | ||
run: | | ||
echo ">> Running all test cases" | ||
python3 -m pytest -s tests | ||
env: | ||
# Set your environment variables here, if they are sensitive, use secrets. | ||
# Example: | ||
# MY_ENV_VAR: ${{ secrets.MY_ENV_VAR }} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from typing import Any, Optional | ||
from pydantic import BaseModel, Field | ||
|
||
################################################# | ||
## ChatGPT | ||
################################################# | ||
class Message(BaseModel): # pylint: disable=too-few-public-methods | ||
"""A message to send to the chatbot.""" | ||
model: Optional[str] = None | ||
messages: Optional[Any] = None | ||
temperature: Optional[float or int] = None | ||
|
||
class Config: # pylint: disable=too-few-public-methods | ||
"""A message to send to the chatbot.""" | ||
json_schema_extra = { | ||
"example": { | ||
"model": "gpt-3.5-turbo", | ||
"temperature": 0.8, | ||
"messages": [ | ||
{"role": "system", "content": "You are a helpful assistant."}, | ||
{"role": "user", "content": 'Who won the 2001 world series?'}, | ||
{"role": "assistant", "content": 'The arizona diamondbacks won the 2001 world series.'}, | ||
{"role": "user", "content": 'Who were the pitchers?'}, | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from typing import Any, Optional, List | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class ResponseStatus(BaseModel): | ||
version: str = Field(example='v0.0.15') | ||
|
||
################################################# | ||
## ChatGPT | ||
################################################# | ||
|
||
class ResponseChat(BaseModel): | ||
# data: ChatCompletion | ||
|
||
class Config: # pylint: disable=too-few-public-methods | ||
"""A message to send to the chatbot.""" | ||
json_schema_extra = { | ||
"example": { | ||
"chat": { | ||
"id": "chatcmpl-7myaL...", | ||
"object": "chat.completion", | ||
"created": 1691906989, | ||
"model": "gpt-3.5-turbo-0613", | ||
"choices": [ | ||
{ | ||
"index": 0, | ||
"message": { | ||
"role": "assistant", | ||
"content": "The Arizona Diamondbacks had Randy Johnson and Curt Schilling as their primary pitchers during the 2001 World Series. Both pitchers had exceptional performances throughout the series." | ||
}, | ||
"finish_reason": "stop" | ||
} | ||
], | ||
"usage": { | ||
"prompt_tokens": 52, | ||
"completion_tokens": 32, | ||
"total_tokens": 84 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from starlette.testclient import TestClient | ||
|
||
from main import app | ||
|
||
client = TestClient(app) | ||
|
||
def test_ping(): | ||
response = client.get("/status") | ||
# print(response.json()) | ||
assert response.status_code == 200 | ||
assert "version" in response.json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""test example module.""" | ||
import unittest | ||
|
||
|
||
class TestExampleCase(unittest.TestCase): | ||
|
||
@unittest.skip("Example Test Case") | ||
def test_retrieve_files(self): | ||
"""Test that the files are retrieved.""" | ||
token = "test" | ||
assert token == "test" |