Update CohereEmbeddings import and add new configuration options
This commit is contained in:
parent
737b29e891
commit
32be1ccbc1
1 changed files with 9 additions and 9 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from langchain.embeddings import CohereEmbeddings
|
from langchain_community.embeddings.cohere import CohereEmbeddings
|
||||||
from typing import Optional, Any
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
class CohereEmbeddingsComponent(CustomComponent):
|
class CohereEmbeddingsComponent(CustomComponent):
|
||||||
|
|
@ -10,24 +10,24 @@ class CohereEmbeddingsComponent(CustomComponent):
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
return {
|
return {
|
||||||
"async_client": {"display_name": "Async Client", "advanced": True},
|
"cohere_api_key": {"display_name": "Cohere API Key","password":True},
|
||||||
"client": {"display_name": "Client", "advanced": True},
|
|
||||||
"cohere_api_key": {"display_name": "Cohere API Key"},
|
|
||||||
"model": {"display_name": "Model", "default": "embed-english-v2.0", "advanced": True},
|
"model": {"display_name": "Model", "default": "embed-english-v2.0", "advanced": True},
|
||||||
"truncate": {"display_name": "Truncate", "advanced": True},
|
"truncate": {"display_name": "Truncate", "advanced": True},
|
||||||
|
"max_retries": {"display_name": "Max Retries", "advanced": True},
|
||||||
|
"user_agent": {"display_name": "User Agent", "advanced": True},
|
||||||
}
|
}
|
||||||
|
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
async_client: Optional[Any] = None,
|
request_timeout: Optional[float] = None,
|
||||||
client: Optional[Any] = None,
|
|
||||||
cohere_api_key: Optional[str] = None,
|
cohere_api_key: Optional[str] = None,
|
||||||
model: str = "embed-english-v2.0",
|
model: str = "embed-english-v2.0",
|
||||||
truncate: Optional[str] = None,
|
truncate: Optional[str] = None,
|
||||||
|
user_agent: Optional[str] = "langchain",
|
||||||
) -> CohereEmbeddings:
|
) -> CohereEmbeddings:
|
||||||
return CohereEmbeddings(
|
return CohereEmbeddings(
|
||||||
async_client=async_client,
|
user_agent=user_agent,
|
||||||
client=client,
|
request_timeout=request_timeout,
|
||||||
cohere_api_key=cohere_api_key,
|
cohere_api_key=cohere_api_key,
|
||||||
model=model,
|
model=model,
|
||||||
truncate=truncate,
|
truncate=truncate,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue