Skip to main content
`Ctrl`+`K`

# Zilliz

This notebook shows how to use functionality related to the Zilliz Cloud managed vector database.

To run, you should have a Zilliz Cloud instance up and running: https://zilliz.com/cloud

    from langchain.embeddings.openai import OpenAIEmbeddings
    from langchain.text_splitter import CharacterTextSplitter
    from langchain.vectorstores import Milvus
    from langchain.document_loaders import TextLoader

    # replace
    ZILLIZ_CLOUD_HOSTNAME = "" # example: "in01-17f69c292d4a50a.aws-us-west-2.vectordb.zillizcloud.com"
    ZILLIZ_CLOUD_PORT = "" #example: "19532"

    from langchain.document_loaders import TextLoader
    loader = TextLoader('../../../state_of_the_union.txt')
    documents = loader.load()
    text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
    docs = text_splitter.split_documents(documents)

    embeddings = OpenAIEmbeddings()

    vector_db = Milvus.from_documents(
        docs,
        embeddings,
        connection_args={"host": ZILLIZ_CLOUD_HOSTNAME, "port": ZILLIZ_CLOUD_PORT},
    )

    docs = vector_db.similarity_search(query)

    docs[0]