Skip to content

Commit

Permalink
doc handling config
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEdmondson1234 committed Mar 25, 2024
1 parent 04594d1 commit da8f8a8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

# Define your base version
version = '0.32.5'
version = '0.32.6'

setup(
name='sunholo',
Expand Down
37 changes: 20 additions & 17 deletions sunholo/chunker/doc_handling.py
Expand Up @@ -22,24 +22,27 @@ def send_doc_to_docstore(docs, vector_name):
log.info(f"Docstore config: {docstore_config}")

for docstore in docstore_config:
if docstore.get('type') == 'alloydb':
# upload to alloydb
alloydb_config = load_config_key("alloydb_config", vector_name=vector_name, filename="config/llm_config.yaml")
if alloydb_config:
engine = create_alloydb_engine(alloydb_config, vector_name)
table_name = create_alloydb_table(table_name=vector_name, engine=engine, type = "docstore", alloydb_config=alloydb_config)
saver = AlloyDBDocumentSaver.create_sync(
engine=engine,
table_name=table_name,
metadata_columns=["source"]
)
saver.add_documents(docs)
log.info(f"Saved docs to alloydb docstore: {table_name}")
for key, value in docstore.items():
log.info(f"Found memory {key}")
type = value.get('type')
if type == 'alloydb':
# upload to alloydb
alloydb_config = load_config_key("alloydb_config", vector_name=vector_name, filename="config/llm_config.yaml")
if alloydb_config:
engine = create_alloydb_engine(alloydb_config, vector_name)
table_name = create_alloydb_table(table_name=vector_name, engine=engine, type = "docstore", alloydb_config=alloydb_config)
saver = AlloyDBDocumentSaver.create_sync(
engine=engine,
table_name=table_name,
metadata_columns=["source"]
)
saver.add_documents(docs)
log.info(f"Saved docs to alloydb docstore: {table_name}")
else:
log.error("docstore.type==alloydb but no config.alloydb_config specified")
#elif docstore.get('type') == 'cloudstorage':
else:
log.error("docstore.type==alloydb but no config.alloydb_config specified")
#elif docstore.get('type') == 'cloudstorage':
else:
log.info(f"No docstore type found for {vector_name}: {docstore}")
log.info(f"No docstore type found for {vector_name}: {docstore}")


def summarise_docs(docs, vector_name, summary_threshold_default=10000, model_limit_default=100000):
Expand Down

0 comments on commit da8f8a8

Please sign in to comment.