Skip to content

Commit 1e37d0e

Browse files
committed
format code
1 parent 3a4882a commit 1e37d0e

File tree

9 files changed

+59
-22
lines changed

9 files changed

+59
-22
lines changed

.flake8

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
max-line-length = 99
3+
select = C,E,F,W,B,B950
4+
extend-ignore = E203,E402,E501,F541,W503,F401
5+
extend-exclude =
6+
.vscode/,
7+
archive/,
8+
build/,
9+
configs/,
10+
dependencies/,
11+
venv/

.prettierignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.egg-info
6+
.pytest_cache
7+
.ipynb_checkpoints
8+
venv/
9+
10+
# Frontend
11+
scripts/
12+
13+
# Internal references, dependencies, temporary folders & files
14+
archive/
15+
/dependencies/
16+
logs/
17+
*.log
18+
19+
# pytest-cov
20+
**/.coverage*
21+
/junit
22+
/htmlcov
23+
/coverage.xml
24+
25+
# pip
26+
**/build/
27+
28+
# Docs
29+
/docs/source/generated/
30+
/docs/source/api/generated/
31+
/docs/source/specs/
32+
33+
# OS
34+
thumbs.db
35+
.DS_Store

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"printWidth": 150,
3+
"proseWrap": "never"
4+
}

requirements-lint.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
yapf==0.32.0
33
toml==0.10.2
44
tomli==2.0.1
5-
ruff==0.1.5
65
codespell==2.3.0
76
isort==5.13.2
87
clang-format==18.1.5
9-
black
8+
black~=24.4.2
9+
flake8~=7.0.0
1010

1111
# type checking
1212
mypy==1.9.0

scripts/python/httpx_client_vision.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import httpx
2+
import os
3+
import base64
4+
import mimetypes
25

36
from embeddedllm.protocol import (
47
CustomChatCompletionMessageParam,
@@ -17,9 +20,6 @@ def chat_completion(url: str, payload: dict):
1720

1821
# Example usage
1922
if __name__ == "__main__":
20-
import os
21-
import base64
22-
import mimetypes
2323

2424
current_file_path = os.path.abspath(__file__)
2525
IMAGE_PATH = os.path.join(os.path.dirname(current_file_path), "..", "images", "catdog.png")

scripts/python/httpx_client_vision_stream.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import asyncio
2-
2+
import os
3+
import base64
4+
import mimetypes
35
import httpx
46

57

@@ -18,12 +20,9 @@ async def stream_chat_completion(url: str, payload: dict):
1820

1921
# Example usage
2022
if __name__ == "__main__":
21-
import os
2223

2324
current_file_path = os.path.abspath(__file__)
2425
IMAGE_PATH = os.path.join(os.path.dirname(current_file_path), "..", "images", "catdog.png")
25-
import base64
26-
import mimetypes
2726

2827
# Function to encode the image and infer its MIME type
2928
def encode_image(image_path):

scripts/python/litellm_vision_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import litellm
22
import base64
33
import mimetypes
4-
54
import os
65

76
current_file_path = os.path.abspath(__file__)

src/embeddedllm/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, model_path: str, vision: bool):
4141
self.model_path = model_path
4242
self.model_config = AutoConfig.from_pretrained(self.model_path, trust_remote_code=True)
4343

44-
## model_config is to find out the max length of the model
44+
# model_config is to find out the max length of the model
4545
self.max_model_len = _get_and_verify_max_len(
4646
hf_config=self.model_config,
4747
max_model_len=None,

src/embeddedllm/entrypoints/chat_server.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,6 @@ def create_error_response(
120120
) -> ErrorResponse:
121121
return ErrorResponse(message=message, type=err_type, code=status_code.value)
122122

123-
async def _check_model(
124-
self, request: Union[CompletionRequest, ChatCompletionRequest]
125-
) -> Optional[ErrorResponse]:
126-
if request.model in [self.served_model_name]:
127-
return None
128-
return self.create_error_response(
129-
message=f"The model `{request.model}` does not exist.",
130-
err_type="NotFoundError",
131-
status_code=HTTPStatus.NOT_FOUND,
132-
)
133-
134123
def _parse_chat_message_content_parts(
135124
self,
136125
role: str,

0 commit comments

Comments
 (0)