-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* base unit tests are added * OpenAI unit tests are added * Backend.submit with OpenaAI backend integration test is added Other changes: * `.env.example` is added as a source of a project configuration * `README.md` now has project configuring and testing small guide * `mypy` is configured in `pyproject.toml` * `Makefile` is improved
- Loading branch information
Dmytro Parfeniuk
committed
Jul 11, 2024
1 parent
4af96de
commit a0c2587
Showing
29 changed files
with
650 additions
and
277 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,4 @@ | ||
# OpenAI compatible server address. | ||
# If you are going to run the | ||
OPENAI_BASE_URL=http://127.0.0.1:8080 | ||
OPENAI_API_KEY=invalid |
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 |
---|---|---|
@@ -1 +1,36 @@ | ||
# guidellm | ||
# guidellm | ||
|
||
# Project configuration | ||
|
||
The project is configured with environment variables. Check the example in `.env.example`. | ||
|
||
```sh | ||
# Create .env file and update the configuration | ||
cp .env.example .env | ||
|
||
# Export all variables | ||
set -o allexport; source .env; set +o allexport | ||
``` | ||
|
||
## Environment Variables | ||
|
||
| Variable | Default Value | Description | | ||
| --------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| OPENAI_BASE_URL | http://127.0.0.1:8080 | The host where the `openai` library will make requests to. For running integration tests it is required to have the external OpenAI compatible server running. | | ||
| OPENAI_API_KEY | invalid | [OpenAI Platform](https://platform.openai.com/api-keys) to create a new API key. This value is not used for tests. | | ||
|
||
## Running Tests | ||
|
||
`pytest` package is used as a testing framework. All the tests are int he `tests/` folder. | ||
`pytest` configuration is in the `pyproject.toml`. | ||
|
||
The `Makefile` includes all the necessary commands that could be run from the project root. | ||
|
||
```sh | ||
# Using Makefile | ||
make test # run all the tests | ||
make test.integration # run only integration tests | ||
make test.unit # run only unit tests | ||
make test.e2e # run only E2E tests | ||
``` | ||
|
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 |
---|---|---|
@@ -1 +0,0 @@ | ||
TODO | ||
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 |
---|---|---|
@@ -1 +1 @@ | ||
TODO | ||
TODO |
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 |
---|---|---|
@@ -1,30 +1,60 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
requires = ['setuptools', 'wheel'] | ||
build-backend = 'setuptools.build_meta' | ||
|
||
|
||
|
||
[tool.black] | ||
line-length = 88 | ||
target-version = ['py38'] | ||
|
||
|
||
|
||
[tool.isort] | ||
profile = "black" | ||
profile = 'black' | ||
|
||
|
||
[tool.mypy] | ||
files = "src/guidellm" | ||
|
||
[tool.ruff] | ||
exclude = ["build", "dist", "env", ".venv"] | ||
exclude = ['build', 'dist', 'env', '.venv'] | ||
lint.select = ["E", "F", "W"] | ||
line-length = 88 | ||
|
||
|
||
[tool.flake8] | ||
max-line-length = 88 | ||
|
||
[tool.pytest.ini_options] | ||
addopts = '-s -vvv --cache-clear' | ||
asyncio_mode = 'auto' | ||
markers = [ | ||
"smoke: quick tests to check basic functionality", | ||
"sanity: detailed tests to ensure major functions work correctly", | ||
"regression: tests to ensure that new changes do not break existing functionality" | ||
'smoke: quick tests to check basic functionality', | ||
'sanity: detailed tests to ensure major functions work correctly', | ||
'regression: tests to ensure that new changes do not break existing functionality' | ||
] | ||
filterwarnings = [ | ||
'ignore::RuntimeWarning', | ||
'ignore::UserWarning', | ||
'ignore::DeprecationWarning', | ||
] | ||
|
||
|
||
|
||
[tool.mypy] | ||
python_version = '3.8' | ||
files = 'src/guidellm' | ||
show_error_codes = true | ||
namespace_packages = false | ||
check_untyped_defs = true | ||
|
||
warn_redundant_casts = true | ||
warn_unused_ignores = true | ||
|
||
# Silint "type import errors" as our 3rd-party libs does not have types | ||
# Check: https://mypy.readthedocs.io/en/latest/config_file.html#import-discovery | ||
follow_imports = 'silent' | ||
|
||
[[tool.mypy.overrides]] | ||
module = ['transformers.*'] | ||
ignore_missing_imports=true | ||
|
||
|
||
|
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
Empty file.
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from .base import Backend, BackendTypes, GenerativeResponse | ||
from .base import Backend, BackendEngine, GenerativeResponse | ||
from .openai import OpenAIBackend | ||
|
||
__all__ = [ | ||
"Backend", | ||
"BackendTypes", | ||
"BackendEngine", | ||
"GenerativeResponse", | ||
"OpenAIBackend", | ||
] |
Oops, something went wrong.