MCPcopy
hub / github.com/llmware-ai/llmware / setup_library

Function setup_library

solutions/embeddings/using_milvus_lite.py:24–51  ·  view source on GitHub ↗

Note: this setup_library method is provided to enable a self-contained example to create a test library

(library_name)

Source from the content-addressed store, hash-verified

22
23
24def setup_library(library_name):
25
26 """ Note: this setup_library method is provided to enable a self-contained example to create a test library """
27
28 # Step 1 - Create library which is the main 'organizing construct' in llmware
29 print ("\nupdate: Creating library: {}".format(library_name))
30
31 library = Library().create_new_library(library_name)
32
33 # check the embedding status 'before' installing the embedding
34 embedding_record = library.get_embedding_status()
35 print("embedding record - before embedding ", embedding_record)
36
37 # Step 2 - Pull down the sample files from S3 through the .load_sample_files() command
38 # --note: if you need to refresh the sample files, set 'over_write=True'
39 print ("update: Downloading Sample Files")
40
41 sample_files_path = Setup().load_sample_files(over_write=False)
42
43 # Step 3 - point ".add_files" method to the folder of documents that was just created
44 # this method parses the documents, text chunks, and captures in database
45
46 print("update: Parsing and Text Indexing Files")
47
48 library.add_files(input_folder_path=os.path.join(sample_files_path, "Agreements"),
49 chunk_size=400, max_chunk_size=600, smart_chunking=1)
50
51 return library
52
53
54def install_vector_embeddings(library, embedding_model_name):

Callers 1

Calls 7

LibraryClass · 0.90
SetupClass · 0.90
formatMethod · 0.80
create_new_libraryMethod · 0.80
load_sample_filesMethod · 0.80
add_filesMethod · 0.80
get_embedding_statusMethod · 0.45

Tested by

no test coverage detected