apply ruff linter
This commit is contained in:
@@ -5,5 +5,6 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
# Run the linter.
|
# Run the linter.
|
||||||
- id: ruff
|
- id: ruff
|
||||||
|
types_or: [python, pyi]
|
||||||
# Run the formatter.
|
# Run the formatter.
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
|
|||||||
@@ -9,13 +9,11 @@ exclude = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[lint]
|
[lint]
|
||||||
select = ["E", "F"]
|
select = ["E", "F", "I"]
|
||||||
ignore = [
|
ignore = [
|
||||||
"E501",
|
"E501",
|
||||||
"B008",
|
|
||||||
"C901",
|
"C901",
|
||||||
"F401",
|
"F401",
|
||||||
"W191",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[format]
|
[format]
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ from fastapi.middleware.cors import CORSMiddleware
|
|||||||
from fastapi.responses import PlainTextResponse
|
from fastapi.responses import PlainTextResponse
|
||||||
from mangum import Mangum
|
from mangum import Mangum
|
||||||
|
|
||||||
from api.routers import model, chat, embeddings
|
from api.routers import chat, embeddings, model
|
||||||
from api.setting import API_ROUTE_PREFIX, TITLE, DESCRIPTION, SUMMARY, VERSION
|
from api.setting import API_ROUTE_PREFIX, DESCRIPTION, SUMMARY, TITLE, VERSION
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"title": TITLE,
|
"title": TITLE,
|
||||||
@@ -31,6 +31,7 @@ app.add_middleware(
|
|||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
app.include_router(model.router, prefix=API_ROUTE_PREFIX)
|
app.include_router(model.router, prefix=API_ROUTE_PREFIX)
|
||||||
app.include_router(chat.router, prefix=API_ROUTE_PREFIX)
|
app.include_router(chat.router, prefix=API_ROUTE_PREFIX)
|
||||||
app.include_router(embeddings.router, prefix=API_ROUTE_PREFIX)
|
app.include_router(embeddings.router, prefix=API_ROUTE_PREFIX)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ from typing import AsyncIterable
|
|||||||
|
|
||||||
from api.schema import (
|
from api.schema import (
|
||||||
# Chat
|
# Chat
|
||||||
ChatResponse,
|
|
||||||
ChatRequest,
|
ChatRequest,
|
||||||
|
ChatResponse,
|
||||||
ChatStreamResponse,
|
ChatStreamResponse,
|
||||||
# Embeddings
|
# Embeddings
|
||||||
EmbeddingsRequest,
|
EmbeddingsRequest,
|
||||||
|
|||||||
@@ -15,29 +15,27 @@ from fastapi import HTTPException
|
|||||||
|
|
||||||
from api.models.base import BaseChatModel, BaseEmbeddingsModel
|
from api.models.base import BaseChatModel, BaseEmbeddingsModel
|
||||||
from api.schema import (
|
from api.schema import (
|
||||||
# Chat
|
|
||||||
ChatResponse,
|
|
||||||
ChatRequest,
|
|
||||||
Choice,
|
|
||||||
ChatResponseMessage,
|
|
||||||
Usage,
|
|
||||||
ChatStreamResponse,
|
|
||||||
ImageContent,
|
|
||||||
TextContent,
|
|
||||||
ToolCall,
|
|
||||||
ChoiceDelta,
|
|
||||||
UserMessage,
|
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
ToolMessage,
|
ChatRequest,
|
||||||
Function,
|
ChatResponse,
|
||||||
ResponseFunction,
|
ChatResponseMessage,
|
||||||
# Embeddings
|
ChatStreamResponse,
|
||||||
|
Choice,
|
||||||
|
ChoiceDelta,
|
||||||
|
Embedding,
|
||||||
EmbeddingsRequest,
|
EmbeddingsRequest,
|
||||||
EmbeddingsResponse,
|
EmbeddingsResponse,
|
||||||
EmbeddingsUsage,
|
EmbeddingsUsage,
|
||||||
Embedding,
|
Function,
|
||||||
|
ImageContent,
|
||||||
|
ResponseFunction,
|
||||||
|
TextContent,
|
||||||
|
ToolCall,
|
||||||
|
ToolMessage,
|
||||||
|
Usage,
|
||||||
|
UserMessage,
|
||||||
)
|
)
|
||||||
from api.setting import DEBUG, AWS_REGION, ENABLE_CROSS_REGION_INFERENCE, DEFAULT_MODEL
|
from api.setting import AWS_REGION, DEBUG, DEFAULT_MODEL, ENABLE_CROSS_REGION_INFERENCE
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Body
|
from fastapi import APIRouter, Body, Depends
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse
|
||||||
|
|
||||||
from api.auth import api_key_auth
|
from api.auth import api_key_auth
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Body
|
from fastapi import APIRouter, Body, Depends
|
||||||
|
|
||||||
from api.auth import api_key_auth
|
from api.auth import api_key_auth
|
||||||
from api.models.bedrock import get_embeddings_model
|
from api.models.bedrock import get_embeddings_model
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from fastapi import APIRouter, Depends, HTTPException, Path
|
|||||||
|
|
||||||
from api.auth import api_key_auth
|
from api.auth import api_key_auth
|
||||||
from api.models.bedrock import BedrockModel
|
from api.models.bedrock import BedrockModel
|
||||||
from api.schema import Models, Model
|
from api.schema import Model, Models
|
||||||
|
|
||||||
router = APIRouter(
|
router = APIRouter(
|
||||||
prefix="/models",
|
prefix="/models",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import time
|
import time
|
||||||
from typing import Literal, Iterable
|
from typing import Iterable, Literal
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user