-
Notifications
You must be signed in to change notification settings - Fork 818
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate weaviate connector to new framework (#3160)
### Description Add weaviate output connector to those supported in the new v2 ingest framework. Some fixes were needed to the upoad stager step as this was the first connector moved over that leverages this part of the pipeline.
- Loading branch information
Showing
13 changed files
with
420 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## 0.14.5-dev6 | ||
## 0.14.5-dev7 | ||
|
||
### Enhancements | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.14.5-dev6" # pragma: no cover | ||
__version__ = "0.14.5-dev7" # pragma: no cover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
from dataclasses import dataclass | ||
|
||
import click | ||
|
||
from unstructured.ingest.v2.cli.base import DestCmd | ||
from unstructured.ingest.v2.cli.interfaces import CliConfig | ||
from unstructured.ingest.v2.cli.utils import DelimitedString | ||
from unstructured.ingest.v2.processes.connectors.weaviate import CONNECTOR_TYPE | ||
|
||
|
||
@dataclass | ||
class WeaviateCliConnectionConfig(CliConfig): | ||
@staticmethod | ||
def get_cli_options() -> list[click.Option]: | ||
options = [ | ||
click.Option( | ||
["--host-url"], | ||
required=True, | ||
help="Weaviate instance url", | ||
), | ||
click.Option( | ||
["--class-name"], | ||
default=None, | ||
type=str, | ||
help="Name of the class to push the records into, e.g: Pdf-elements", | ||
), | ||
click.Option( | ||
["--access-token"], default=None, type=str, help="Used to create the bearer token." | ||
), | ||
click.Option( | ||
["--refresh-token"], | ||
default=None, | ||
type=str, | ||
help="Will tie this value to the bearer token. If not provided, " | ||
"the authentication will expire once the lifetime of the access token is up.", | ||
), | ||
click.Option( | ||
["--api-key"], | ||
default=None, | ||
type=str, | ||
), | ||
click.Option( | ||
["--client-secret"], | ||
default=None, | ||
type=str, | ||
), | ||
click.Option( | ||
["--scope"], | ||
default=None, | ||
type=DelimitedString(), | ||
), | ||
click.Option( | ||
["--username"], | ||
default=None, | ||
type=str, | ||
), | ||
click.Option( | ||
["--password"], | ||
default=None, | ||
type=str, | ||
), | ||
click.Option( | ||
["--anonymous"], | ||
is_flag=True, | ||
default=False, | ||
type=bool, | ||
help="if set, all auth values will be ignored", | ||
), | ||
] | ||
return options | ||
|
||
|
||
@dataclass | ||
class WeaviateCliUploaderConfig(CliConfig): | ||
@staticmethod | ||
def get_cli_options() -> list[click.Option]: | ||
options = [ | ||
click.Option( | ||
["--batch-size"], | ||
default=100, | ||
type=int, | ||
help="Number of records per batch", | ||
) | ||
] | ||
return options | ||
|
||
|
||
@dataclass | ||
class WeaviateCliUploadStagerConfig(CliConfig): | ||
@staticmethod | ||
def get_cli_options() -> list[click.Option]: | ||
return [] | ||
|
||
|
||
weaviate_dest_cmd = DestCmd( | ||
cmd_name=CONNECTOR_TYPE, | ||
connection_config=WeaviateCliConnectionConfig, | ||
uploader_config=WeaviateCliUploaderConfig, | ||
upload_stager_config=WeaviateCliUploadStagerConfig, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.