WatsonxEmbeddings is a wrapper for IBM watsonx.ai foundation models.This example shows how to communicate with
watsonx.ai
models using LangChain
.
langchain-ibm
integration package.
langchain-ibm
package:
parameters
for different models.
WatsonxEmbeddings
class with previously set parameters.
Note:
project_id
or space_id
. For more information see documentation.project_id
and Dallas url.
You need to specify model_id
that will be used for inferencing.
APIClient
object into the WatsonxEmbeddings
class.
embeddings
object we initialized above. In this example, we will index and retrieve a sample document in the InMemoryVectorStore
.
embeddings.embed_documents(...)
and embeddings.embed_query(...)
to create embeddings for the text(s) used in from_texts
and retrieval invoke
operations, respectively.
You can directly call these methods to get embeddings for your own use cases.
embed_query
:
embed_documents
:
WatsonxEmbeddings
features and configurations head to the API reference.