mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-13 14:50:00 +00:00
Improvement[Community]Improve Embeddings API (#28038)
- Fix `BaichuanTextEmbeddings` api url - Remove unused params in api doc - Fix word spelling
This commit is contained in:
parent
e290736696
commit
ca7375ac20
@ -15,7 +15,7 @@ from pydantic import (
|
|||||||
from requests import RequestException
|
from requests import RequestException
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
BAICHUAN_API_URL: str = "http://api.baichuan-ai.com/v1/embeddings"
|
BAICHUAN_API_URL: str = "https://api.baichuan-ai.com/v1/embeddings"
|
||||||
|
|
||||||
# BaichuanTextEmbeddings is an embedding model provided by Baichuan Inc. (https://www.baichuan-ai.com/home).
|
# BaichuanTextEmbeddings is an embedding model provided by Baichuan Inc. (https://www.baichuan-ai.com/home).
|
||||||
# As of today (Jan 25th, 2024) BaichuanTextEmbeddings ranks #1 in C-MTEB
|
# As of today (Jan 25th, 2024) BaichuanTextEmbeddings ranks #1 in C-MTEB
|
||||||
@ -25,7 +25,7 @@ BAICHUAN_API_URL: str = "http://api.baichuan-ai.com/v1/embeddings"
|
|||||||
# Official Website: https://platform.baichuan-ai.com/docs/text-Embedding
|
# Official Website: https://platform.baichuan-ai.com/docs/text-Embedding
|
||||||
# An API-key is required to use this embedding model. You can get one by registering
|
# An API-key is required to use this embedding model. You can get one by registering
|
||||||
# at https://platform.baichuan-ai.com/docs/text-Embedding.
|
# at https://platform.baichuan-ai.com/docs/text-Embedding.
|
||||||
# BaichuanTextEmbeddings support 512 token window and preduces vectors with
|
# BaichuanTextEmbeddings support 512 token window and produces vectors with
|
||||||
# 1024 dimensions.
|
# 1024 dimensions.
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,8 +143,6 @@ class DashScopeEmbeddings(BaseModel, Embeddings):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
texts: The list of texts to embed.
|
texts: The list of texts to embed.
|
||||||
chunk_size: The chunk size of embeddings. If None, will use the chunk size
|
|
||||||
specified by the class.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List of embeddings, one for each text.
|
List of embeddings, one for each text.
|
||||||
|
@ -36,7 +36,8 @@ class DeterministicFakeEmbedding(Embeddings, BaseModel):
|
|||||||
np.random.seed(seed)
|
np.random.seed(seed)
|
||||||
return list(np.random.normal(size=self.size))
|
return list(np.random.normal(size=self.size))
|
||||||
|
|
||||||
def _get_seed(self, text: str) -> int:
|
@staticmethod
|
||||||
|
def _get_seed(text: str) -> int:
|
||||||
"""
|
"""
|
||||||
Get a seed for the random generator, using the hash of the text.
|
Get a seed for the random generator, using the hash of the text.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user