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.
Merge pull request #2 from promptengineers-ai/development
FROM development TO master
- Loading branch information
Showing
8 changed files
with
174 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] | ||
|
||
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.9 | ||
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 }} |
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,25 @@ | ||
on: | ||
push: | ||
branches: | ||
- master # or the name of your default branch | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' # or your preferred Node.js version | ||
|
||
- name: Install Vercel CLI | ||
run: npm install -g vercel | ||
|
||
- name: Deploy to Vercel | ||
run: vercel . --token ${{ secrets.VERCEL_TOKEN }} --confirm # You might need the --confirm flag if you haven't set up the project yet | ||
env: | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} |
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 ConfigDict: # 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(default='v0.0.15') | ||
|
||
################################################# | ||
## ChatGPT | ||
################################################# | ||
|
||
class ResponseChat(BaseModel): | ||
# data: ChatCompletion | ||
|
||
class ConfigDict: # 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 server.api 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" |