Skip to content

Commit

Permalink
chore(backend): format code
Browse files Browse the repository at this point in the history
  • Loading branch information
wd0517 committed Aug 21, 2024
1 parent 7a26bed commit dcfc037
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
13 changes: 5 additions & 8 deletions backend/app/alembic/versions/10f36e8a25c4_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
Create Date: 2024-08-20 09:10:50.130219
"""

from alembic import op
import sqlalchemy as sa
import sqlmodel.sql.sqltypes
from tidb_vector.sqlalchemy import VectorType
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '10f36e8a25c4'
down_revision = '041fbef26e3a'
revision = "10f36e8a25c4"
down_revision = "041fbef26e3a"
branch_labels = None
depends_on = None

Expand All @@ -23,9 +24,7 @@ def upgrade():
op.alter_column(
"reranker_models",
"provider",
existing_type=mysql.ENUM(
"JINA", "COHERE", "BAISHENG"
),
existing_type=mysql.ENUM("JINA", "COHERE", "BAISHENG"),
nullable=False,
)
# ### end Alembic commands ###
Expand All @@ -36,9 +35,7 @@ def downgrade():
op.alter_column(
"reranker_models",
"provider",
existing_type=mysql.ENUM(
"JINA", "COHERE"
),
existing_type=mysql.ENUM("JINA", "COHERE"),
nullable=False,
)
# ### end Alembic commands ###
9 changes: 5 additions & 4 deletions backend/app/rag/node_postprocessor/baisheng_reranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

class BaishengRerank(BaseNodePostprocessor):
api_key: str = Field(default="", description="API key.")
api_url: str = Field(default="http://api.chat.prd.yumc.local/chat/v1/reranker", description="API url.")
api_url: str = Field(
default="http://api.chat.prd.yumc.local/chat/v1/reranker",
description="API url.",
)
model: str = Field(
default="bge-reranker-v2-m3",
description="The model to use when calling API",
Expand All @@ -38,9 +41,7 @@ def __init__(
self.api_url = api_url
self.model = model
self._session = requests.Session()
self._session.headers.update(
{"Authorization": f"Bearer {self.api_key}"}
)
self._session.headers.update({"Authorization": f"Bearer {self.api_key}"})

@classmethod
def class_name(cls) -> str:
Expand Down

0 comments on commit dcfc037

Please sign in to comment.