This package provides the integration between LangChain and IBM Watson AI through the `ibm-watsonx-ai` SDK.
This package provides the integration between LangChain and IBM watsonx.ai through the `ibm-watsonx-ai` SDK.
## Installation
## Installation
@ -10,10 +10,6 @@ To use the `langchain-ibm` package, follow these installation steps:
pip install langchain-ibm
pip install langchain-ibm
```
```
## Usage
## Usage
### Setting up
### Setting up
@ -44,15 +40,10 @@ In alternative, you can set the environment variable in your terminal.
set WATSONX_APIKEY=your_ibm_api_key
set WATSONX_APIKEY=your_ibm_api_key
```
```
### Loading the model
### Loading the model
You might need to adjust model parameters for different models or tasks. For more details on the parameters, refer to IBM's [documentation](https://ibm.github.io/watsonx-ai-python-sdk/fm_model.html#metanames.GenTextParamsMetaNames).
You might need to adjust model parameters for different models or tasks. For more details on the parameters, refer to IBM's [documentation](https://ibm.github.io/watsonx-ai-python-sdk/fm_model.html#metanames.GenTextParamsMetaNames).
```python
```python
parameters = {
parameters = {
"decoding_method": "sample",
"decoding_method": "sample",
@ -83,7 +74,6 @@ watsonx_llm = WatsonxLLM(
- You need to specify the model you want to use for inferencing through `model_id`. You can find the list of available models [here](https://ibm.github.io/watsonx-ai-python-sdk/fm_model.html#ibm_watsonx_ai.foundation_models.utils.enums.ModelTypes).
- You need to specify the model you want to use for inferencing through `model_id`. You can find the list of available models [here](https://ibm.github.io/watsonx-ai-python-sdk/fm_model.html#ibm_watsonx_ai.foundation_models.utils.enums.ModelTypes).
Alternatively you can use Cloud Pak for Data credentials. For more details, refer to IBM's [documentation](https://ibm.github.io/watsonx-ai-python-sdk/setup_cpd.html).
Alternatively you can use Cloud Pak for Data credentials. For more details, refer to IBM's [documentation](https://ibm.github.io/watsonx-ai-python-sdk/setup_cpd.html).
```python
```python
@ -99,9 +89,6 @@ watsonx_llm = WatsonxLLM(
)
)
```
```
### Create a Chain
### Create a Chain
Create `PromptTemplate` objects which will be responsible for creating a random question.
Create `PromptTemplate` objects which will be responsible for creating a random question.