mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-16 08:06:14 +00:00
Apply patch [skip ci]
This commit is contained in:
parent
2f8756d5bd
commit
72df882ae9
@ -2,6 +2,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import torch
|
||||||
from langchain_core.embeddings import Embeddings
|
from langchain_core.embeddings import Embeddings
|
||||||
from pydantic import BaseModel, ConfigDict, Field
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
|
|
||||||
@ -18,9 +20,9 @@ _MIN_OPTIMUM_VERSION = "1.22"
|
|||||||
|
|
||||||
|
|
||||||
class HuggingFaceEmbeddings(BaseModel, Embeddings):
|
class HuggingFaceEmbeddings(BaseModel, Embeddings):
|
||||||
"""HuggingFace sentence_transformers embedding models.
|
"""HuggingFace transformer embedding models.
|
||||||
|
|
||||||
To use, you should have the ``sentence_transformers`` python package installed.
|
To use, you should have the ``transformers`` python package installed.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
@ -171,3 +173,4 @@ class HuggingFaceEmbeddings(BaseModel, Embeddings):
|
|||||||
else self.encode_kwargs
|
else self.encode_kwargs
|
||||||
)
|
)
|
||||||
return self._embed([text], embed_kwargs)[0]
|
return self._embed([text], embed_kwargs)[0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user