You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am testing small python with langchain and CPD5.0.3.
It looks like embeddings is not supported langchain_ibm.
Is there any other way to run simple application with watsonx.ai ?
I am using cpd5.0.3 in my private environment.
ApiRequestFailure: Failure during generate. (POST https://cp53...../ml/v1/text/embeddings?version=2024-11-27)
Status code: 400, body: {"errors":[{"code":"model_no_support_for_function","message":"Model 'meta-llama/llama-3-1-8b-instruct' does not support function 'function_embedding'","more_info":"https://cloud.ibm.com/apidocs/watsonx-ai-cp"}],"trace":"0f9f152b-19d7-4165-bcc1-7ad75fa35e4e","status_code":400}
from langchain_core.vectorstores import InMemoryVectorStore
text = "LangChain is the framework for building context-aware reasoning applications"
vectorstore = InMemoryVectorStore(embeddings)
from langchain_core.documents import Document
document_1 = Document(id="1", page_content="foo", metadata={"baz": "bar"})
document_2 = Document(id="2", page_content="thud", metadata={"bar": "baz"})
document_3 = Document(id="3", page_content="i will be deleted :(")
Hello,
I am testing small python with langchain and CPD5.0.3.
It looks like embeddings is not supported langchain_ibm.
Is there any other way to run simple application with watsonx.ai ?
I am using cpd5.0.3 in my private environment.
ApiRequestFailure: Failure during generate. (POST https://cp53...../ml/v1/text/embeddings?version=2024-11-27)
Status code: 400, body: {"errors":[{"code":"model_no_support_for_function","message":"Model 'meta-llama/llama-3-1-8b-instruct' does not support function 'function_embedding'","more_info":"https://cloud.ibm.com/apidocs/watsonx-ai-cp"}],"trace":"0f9f152b-19d7-4165-bcc1-7ad75fa35e4e","status_code":400}
from langchain_core.vectorstores import InMemoryVectorStore
text = "LangChain is the framework for building context-aware reasoning applications"
vectorstore = InMemoryVectorStore(embeddings)
from langchain_core.documents import Document
document_1 = Document(id="1", page_content="foo", metadata={"baz": "bar"})
document_2 = Document(id="2", page_content="thud", metadata={"bar": "baz"})
document_3 = Document(id="3", page_content="i will be deleted :(")
documents = [document_1, document_2, document_3]
vectorstore.add_documents(documents=documents)
#vectorstore = InMemoryVectorStore.from_texts(
[text],
embedding=embeddings,
#)
Use the vectorstore as a retriever
retriever = vectorstore.as_retriever()
Retrieve the most similar text
retrieved_documents = retriever.invoke("What is LangChain?")
show the retrieved document's content
retrieved_documents[0].page_content
The text was updated successfully, but these errors were encountered: