-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: refactor a bit the examples
- moved the common storage code to vdk-storage library - refactored confluence-reader to directly use it instead of using file
- Loading branch information
1 parent
c168fc8
commit 19a752f
Showing
24 changed files
with
254 additions
and
276 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2021-2024 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import os | ||
Check notice on line 3 in examples/pgvector-embedder/01_local_properties.py
|
||
|
||
from vdk.api.job_input import IJobInput | ||
|
||
|
||
def set_property(job_input: IJobInput, key, value): | ||
props = job_input.get_all_properties() | ||
props[key] = value | ||
job_input.set_all_properties(props) | ||
|
||
|
||
def run(job_input: IJobInput): | ||
set_property( | ||
job_input, | ||
"storage_connection_string", | ||
"postgresql://pgadmin:[email protected]:5432/spulov-test", | ||
) | ||
|
||
props = job_input.get_all_properties() | ||
props.update( | ||
dict( | ||
destination_metadata_table="vdk_confluence_sc_metadata", | ||
destination_embeddings_table="vdk_confluence_sc_embeddings", | ||
storage_name="supercollider_chunked", | ||
) | ||
) | ||
job_input.set_all_properties(props) |
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,14 @@ | ||
# Copyright 2021-2024 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import os.path | ||
import pathlib | ||
Check notice on line 4 in examples/pgvector-embedder/01_setup_huggingface.py
|
||
|
||
from vdk.api.job_input import IJobInput | ||
|
||
|
||
def run(job_input: IJobInput): | ||
# HF uses temporary directories in the process of its work | ||
# So make sure to use only allowed ones | ||
hf_home = job_input.get_temporary_write_directory() / "hf" | ||
hf_home.mkdir(parents=True, exist_ok=True) | ||
os.environ["HF_HOME"] = str(hf_home) |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.