Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme committed Sep 4, 2024
1 parent 58794aa commit 4de99c8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
16 changes: 9 additions & 7 deletions libs/partners/voyageai/langchain_voyageai/embeddings.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import logging
from typing import Iterable, List, Optional
from typing import Any, Iterable, List, Optional

import voyageai # type: ignore
from langchain_core.embeddings import Embeddings
from langchain_core.utils import secret_from_env
from pydantic import (
BaseModel,
ConfigDict,
Field,
PrivateAttr,
SecretStr,
root_validator, PrivateAttr, model_validator,
model_validator,
)
from langchain_core.utils import secret_from_env
from pydantic import ConfigDict
from typing_extensions import Self



logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -44,7 +43,10 @@ class VoyageAIEmbeddings(BaseModel, Embeddings):
),
)

model_config = ConfigDict(extra="forbid",populate_by_name=True,)
model_config = ConfigDict(
extra="forbid",
populate_by_name=True,
)

@model_validator(mode="before")
@classmethod
Expand Down
10 changes: 5 additions & 5 deletions libs/partners/voyageai/langchain_voyageai/rerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

import os
from copy import deepcopy
from typing import Dict, Optional, Sequence, Union
from typing import Any, Dict, Optional, Sequence, Union

import voyageai # type: ignore
from langchain_core.callbacks.manager import Callbacks
from langchain_core.documents import Document
from langchain_core.documents.compressor import BaseDocumentCompressor
from pydantic import SecretStr, root_validator, model_validator
from langchain_core.utils import convert_to_secret_str
from pydantic import ConfigDict, SecretStr, model_validator
from voyageai.object import RerankingObject
from pydantic import ConfigDict
# type: ignore


class VoyageAIRerank(BaseDocumentCompressor):
Expand All @@ -30,7 +28,9 @@ class VoyageAIRerank(BaseDocumentCompressor):
"""Number of documents to return."""
truncation: bool = True

model_config = ConfigDict(arbitrary_types_allowed=True,)
model_config = ConfigDict(
arbitrary_types_allowed=True,
)

@model_validator(mode="before")
@classmethod
Expand Down

0 comments on commit 4de99c8

Please sign in to comment.