0
0
Agentic AIml~10 mins

Long-term memory with vector stores in Agentic AI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a vector store from embeddings.

Agentic AI
vector_store = VectorStore.from_texts(texts, [1])
Drag options to blanks, or click blank then click option'
Aembeddings
Btexts
Cdocuments
Dvectors
Attempts:
3 left
💡 Hint
Common Mistakes
Using raw texts instead of embeddings
Passing documents instead of embeddings
2fill in blank
medium

Complete the code to retrieve similar documents from the vector store.

Agentic AI
results = vector_store.similarity_search([1], k=3)
Drag options to blanks, or click blank then click option'
Adocument_list
Bembedding_vector
Cquery_text
Dsearch_index
Attempts:
3 left
💡 Hint
Common Mistakes
Passing embedding vectors directly
Passing the whole document list
3fill in blank
hard

Fix the error in the code to add documents to the vector store.

Agentic AI
vector_store.[1](new_documents)
Drag options to blanks, or click blank then click option'
Aappend
Bextend
Cinsert
Dadd_texts
Attempts:
3 left
💡 Hint
Common Mistakes
Using append which is not defined
Using extend which is for lists
4fill in blank
hard

Fill both blanks to create embeddings and initialize the vector store.

Agentic AI
embeddings = [1]()
vector_store = VectorStore.from_texts(texts, [2])
Drag options to blanks, or click blank then click option'
AOpenAIEmbeddings
Btexts
Cembeddings
DDocumentLoader
Attempts:
3 left
💡 Hint
Common Mistakes
Passing texts instead of embeddings
Using wrong class names
5fill in blank
hard

Fill all three blanks to perform a similarity search and print the top result.

Agentic AI
query = [1]
results = vector_store.similarity_search(query, k=[2])
print(results[[3]].page_content)
Drag options to blanks, or click blank then click option'
A"What is AI?"
B3
C0
D"Explain machine learning"
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong query strings
Incorrect index for top result
Wrong number of results requested