-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow list of texts as input to pure free text
- Loading branch information
1 parent
bae7e09
commit e8cd09b
Showing
4 changed files
with
48 additions
and
6 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
# Package metadata | ||
name = "suql" | ||
version = "1.1.7a6" | ||
version = "1.1.7a7" | ||
description = "Structured and Unstructured Query Language (SUQL) Python API" | ||
author = "Shicheng Liu" | ||
author_email = "[email protected]" | ||
|
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,23 @@ | ||
import json | ||
|
||
def chunk_store_documents(data, output_file): | ||
from llama_index.core.schema import Document | ||
data = [Document(text=data)] # llama index expects a list | ||
|
||
from llama_index.embeddings.fastembed import FastEmbedEmbedding | ||
embed_model = FastEmbedEmbedding(model_name="BAAI/bge-large-en-v1.5") | ||
|
||
from llama_index.core.node_parser import SemanticSplitterNodeParser | ||
splitter = SemanticSplitterNodeParser( | ||
embed_model=embed_model | ||
) | ||
nodes = splitter.get_nodes_from_documents(data) | ||
|
||
chunked_documents = [node.text for node in nodes] | ||
|
||
with open(output_file, "w") as fd: | ||
json.dump( | ||
chunked_documents, | ||
fd, | ||
indent=2 | ||
) |
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