Skip to content

Instantly share code, notes, and snippets.

@makispl
Created December 16, 2023 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makispl/fdcc31a701a4108d58ec62e14cfc6346 to your computer and use it in GitHub Desktop.
Save makispl/fdcc31a701a4108d58ec62e14cfc6346 to your computer and use it in GitHub Desktop.
# Create a test library and load it with llmware samples
test_library = Library().create_new_library("Agreements")
samples_path = Setup().load_sample_files()
test_library.add_files(os.path.join(samples_path,"Agreements"))
# Create vector embeddings for the library and store them in Milvus
test_library.install_new_embedding(embedding_model_name="industry-bert-contracts", vector_db="milvus")
# Perform a semantic search in the test library
os.environ["TOKENIZERS_PARALLELISM"] = "false" # HuggingFace tokenizer warning to be avoided
# Construct and perform a test query
test_query = 'Resignation'
query_res = Query(test_library).semantic_query(test_query, result_count=20)
print(query_res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment