fixes and refactory
This commit is contained in:
parent
c8fc1e6dee
commit
8f31291d97
6 changed files with 29 additions and 50 deletions
|
|
@ -11,6 +11,18 @@ Used to load embedding models from [Amazon Bedrock](https://aws.amazon.com/bedro
|
||||||
| `endpoint_url` | `str` | URL to set a specific service endpoint other than the default AWS endpoint. | |
|
| `endpoint_url` | `str` | URL to set a specific service endpoint other than the default AWS endpoint. | |
|
||||||
| `region_name` | `str` | AWS region to use, e.g., `us-west-2`. Falls back to `AWS_DEFAULT_REGION` environment variable or region specified in ~/.aws/config if not provided. | |
|
| `region_name` | `str` | AWS region to use, e.g., `us-west-2`. Falls back to `AWS_DEFAULT_REGION` environment variable or region specified in ~/.aws/config if not provided. | |
|
||||||
|
|
||||||
|
## Astra vectorize
|
||||||
|
|
||||||
|
Used to generate server-side embeddings using [DataStax Astra](https://docs.datastax.com/en/astra-db-serverless/databases/embedding-generation.html).
|
||||||
|
|
||||||
|
| **Parameter** | **Type** | **Description** | **Default** |
|
||||||
|
|--------------------|----------|-----------------------------------------------------------------------------------------------------------------------|-------------|
|
||||||
|
| `provider` | `str` | The embedding provider to use. | |
|
||||||
|
| `model_name` | `str` | The embedding model to use. | |
|
||||||
|
| `authentication` | `dict` | Authentication parameters. Use the Astra Portal to add the embedding provider integration to your Astra organization. | |
|
||||||
|
| `provider_api_key` | `str` | An alternative to the Astra Authentication that let you use directly the API key of the provider. | |
|
||||||
|
| `model_parameters` | `dict` | Additional model parameters. | |
|
||||||
|
|
||||||
## Cohere Embeddings
|
## Cohere Embeddings
|
||||||
|
|
||||||
Used to load embedding models from [Cohere](https://cohere.com/).
|
Used to load embedding models from [Cohere](https://cohere.com/).
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ The `Astra DB` initializes a vector store using Astra DB from Data. It creates A
|
||||||
**Parameters:**
|
**Parameters:**
|
||||||
|
|
||||||
- **Input:** Documents or Data for input.
|
- **Input:** Documents or Data for input.
|
||||||
- **Embedding:** Embedding model Astra DB uses.
|
- **Embedding or Astra vectorize:** External or server-side model Astra DB uses.
|
||||||
- **Collection Name:** Name of the Astra DB collection.
|
- **Collection Name:** Name of the Astra DB collection.
|
||||||
- **Token:** Authentication token for Astra DB.
|
- **Token:** Authentication token for Astra DB.
|
||||||
- **API Endpoint:** API endpoint for Astra DB.
|
- **API Endpoint:** API endpoint for Astra DB.
|
||||||
|
|
@ -40,7 +40,7 @@ The `Astra DB` initializes a vector store using Astra DB from Data. It creates A
|
||||||
|
|
||||||
- **Search Type:** Type of search, such as Similarity or MMR.
|
- **Search Type:** Type of search, such as Similarity or MMR.
|
||||||
- **Input Value:** Value to search for.
|
- **Input Value:** Value to search for.
|
||||||
- **Embedding:** Embedding model Astra DB uses.
|
- **Embedding or Astra vectorize:** External or server-side model Astra DB uses.
|
||||||
- **Collection Name:** Name of the Astra DB collection.
|
- **Collection Name:** Name of the Astra DB collection.
|
||||||
- **Token:** Authentication token for Astra DB.
|
- **Token:** Authentication token for Astra DB.
|
||||||
- **API Endpoint:** API endpoint for Astra DB.
|
- **API Endpoint:** API endpoint for Astra DB.
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,7 @@
|
||||||
from typing import Optional, Dict, Any
|
from typing import Any
|
||||||
|
|
||||||
from langflow.custom import CustomComponent
|
|
||||||
|
|
||||||
from langflow.custom import Component
|
from langflow.custom import Component
|
||||||
from base.langflow.inputs import TextInput
|
from langflow.inputs.inputs import DictInput, SecretStrInput, StrInput
|
||||||
from base.langflow.template.field.base import Output
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# class AstraVectorize(Component):
|
|
||||||
# display_name = "Astra Vectorize"
|
|
||||||
# description = "Configuration options for Astra Vectorize server-side embeddings."
|
|
||||||
# documentation = "..."
|
|
||||||
# icon = "AstraDB" # TODO: New icon?
|
|
||||||
#
|
|
||||||
# inputs = [
|
|
||||||
# TextInput(
|
|
||||||
# name="provider",
|
|
||||||
# display_name="Provider",
|
|
||||||
# )
|
|
||||||
# ]
|
|
||||||
# outputs = [
|
|
||||||
# Output(display_name="Vectorize_configuration", name="embeddings", method="build"),
|
|
||||||
# ]
|
|
||||||
#
|
|
||||||
# def build(
|
|
||||||
# self,
|
|
||||||
# ) -> Dict[str, Any]:
|
|
||||||
# return {
|
|
||||||
# "provider": self.provider
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
from langflow.custom import Component
|
|
||||||
from langflow.inputs.inputs import DataInput, IntInput, TextInput, DictInput, SecretStrInput
|
|
||||||
from langflow.schema import Data
|
|
||||||
from langflow.template.field.base import Output
|
from langflow.template.field.base import Output
|
||||||
from langflow.utils.util import build_loader_repr_from_data, unescape_string
|
|
||||||
|
|
||||||
|
|
||||||
class AstraVectorize(Component):
|
class AstraVectorize(Component):
|
||||||
|
|
@ -45,15 +11,15 @@ class AstraVectorize(Component):
|
||||||
icon = "AstraDB"
|
icon = "AstraDB"
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
TextInput(
|
StrInput(
|
||||||
name="provider",
|
name="provider",
|
||||||
display_name="Provider name",
|
display_name="Provider name",
|
||||||
info='The provider to use.',
|
info='The embedding provider to use.',
|
||||||
),
|
),
|
||||||
TextInput(
|
StrInput(
|
||||||
name="model_name",
|
name="model_name",
|
||||||
display_name="Model name",
|
display_name="Model name",
|
||||||
info='The model to use.',
|
info='The embedding model to use.',
|
||||||
),
|
),
|
||||||
DictInput(
|
DictInput(
|
||||||
name="authentication",
|
name="authentication",
|
||||||
|
|
@ -63,20 +29,20 @@ class AstraVectorize(Component):
|
||||||
),
|
),
|
||||||
SecretStrInput(
|
SecretStrInput(
|
||||||
name="provider_api_key",
|
name="provider_api_key",
|
||||||
display_name="Provider API Key to authenticate to the external service",
|
display_name="Provider API Key",
|
||||||
info='An alternative to the Astra Authentication that let you use directly the API key of the provider.',
|
info='An alternative to the Astra Authentication that let you use directly the API key of the provider.',
|
||||||
advanced=True
|
advanced=True
|
||||||
),
|
),
|
||||||
DictInput(
|
DictInput(
|
||||||
name="parameters",
|
name="parameters",
|
||||||
display_name="Additional model parameters",
|
display_name="Model parameters",
|
||||||
info='Additional model parameters.',
|
info='Additional model parameters.',
|
||||||
advanced=True,
|
advanced=True,
|
||||||
is_list=True
|
is_list=True
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
Output(display_name="Configuration", name="config", method="build", types=["dict"]),
|
Output(display_name="Vectorize", name="config", method="build", types=["dict"]),
|
||||||
]
|
]
|
||||||
|
|
||||||
def build(self) -> dict[str, Any]:
|
def build(self) -> dict[str, Any]:
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ class AstraVectorStoreComponent(LCVectorStoreComponent):
|
||||||
),
|
),
|
||||||
HandleInput(
|
HandleInput(
|
||||||
name="embedding",
|
name="embedding",
|
||||||
display_name="Embedding",
|
display_name="Embedding or Astra Vectorize",
|
||||||
input_types=["Embeddings", "dict"],
|
input_types=["Embeddings", "dict"],
|
||||||
),
|
),
|
||||||
StrInput(
|
StrInput(
|
||||||
|
|
|
||||||
1
src/frontend/package-lock.json
generated
1
src/frontend/package-lock.json
generated
|
|
@ -787,6 +787,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
|
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
|
"extraneous": true,
|
||||||
"inBundle": true,
|
"inBundle": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
||||||
|
|
@ -632,7 +632,7 @@ export default function ParameterComponent({
|
||||||
editNode={false}
|
editNode={false}
|
||||||
value={
|
value={
|
||||||
!data.node!.template[name]?.value ||
|
!data.node!.template[name]?.value ||
|
||||||
data.node!.template[name]?.value?.toString() === "{}"
|
!Object.keys(data.node!.template[name]?.value || {}).length
|
||||||
? {}
|
? {}
|
||||||
: data.node!.template[name]?.value
|
: data.node!.template[name]?.value
|
||||||
}
|
}
|
||||||
|
|
@ -648,9 +648,9 @@ export default function ParameterComponent({
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
editNode={false}
|
editNode={false}
|
||||||
value={
|
value={
|
||||||
data.node!.template[name]?.value?.length === 0 ||
|
!data.node!.template[name]?.value ||
|
||||||
!data.node!.template[name]?.value
|
!Object.keys(data.node!.template[name]?.value || {}).length
|
||||||
? [{ "": "" }]
|
? [{"":""}]
|
||||||
: convertObjToArray(data.node!.template[name]?.value, type!)
|
: convertObjToArray(data.node!.template[name]?.value, type!)
|
||||||
}
|
}
|
||||||
duplicateKey={errorDuplicateKey}
|
duplicateKey={errorDuplicateKey}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue