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
To set up your environment, follow along with the instructions in the [README.md](https://github.com/IBM/watsonx-developer-hub/tree/main/agents/base/langgraph-react-agent) file on Github. This set up requires several commands to be run on your IDE or command line.
67
67
68
+
### Step 3. Set the environment variables
68
69
69
-
### Step 3. Upload your data to IBM Cloud Object Storage
70
+
In the `config.toml` file, you will find the following blank credentials that must be filled in before attempting to deploy your agent. Your `watsonx_apikey` and `watsonx_url` were initialized in step 1 of this tutorial. Next, follow along with the simple form found on the [Developer Access](https://dataplatform.cloud.ibm.com/developer-access) page to select your deployment space or create a new one. There, you can retrieve your `space_id` needed to connect our agent to the watsonx.ai deployment. Lastly, your `model_id` is set to the IBM Granite 3.2 model.
71
+
72
+
```
73
+
[deployment]
74
+
watsonx_apikey = ""
75
+
watsonx_url = "" # should follow the format: `https://{REGION}.ml.cloud.ibm.com`
76
+
space_id = "" # found in the "Manage" tab of your Deployment or in the Developer Access page here: https://dataplatform.cloud.ibm.com/developer-access
77
+
78
+
[deployment.custom]
79
+
# during creation of deployment additional parameters can be provided inside `CUSTOM` object for further referencing
80
+
# please refer to the API docs: https://cloud.ibm.com/apidocs/machine-learning-cp#deployments-create
81
+
model_id = "ibm/granite-3-2-8b-instruct"
82
+
thread_id = "thread-1" # More info here: https://langchain-ai.github.io/langgraph/how-tos/persistence/
83
+
```
84
+
85
+
### Step 4. Upload your data to IBM Cloud Object Storage
70
86
71
87
Our agent requires a data source to provide up-to-date information and add new data. We will store our data file in IBM Cloud® Object Storage.
72
88
73
89
1. First, log in to [IBM Cloud](https://cloud.ibm.com/objectstorage/overview). Then, create a [new project](https://cloud.ibm.com/projects).
74
90
2. In the left-side menu, select [Resource list](https://cloud.ibm.com/resources). Using the Create resource button, create a new Cloud Object Storage instance or simply use [this link](https://cloud.ibm.com/objectstorage/create?catalog_query=aHR0cHM6Ly9jbG91ZC5pYm0uY29tL2NhdGFsb2c%2FY2F0ZWdvcnk9c3RvcmFnZSNhbGxfcHJvZHVjdHM%3D).
75
91
3. Open your newly created IBM Cloud Storage Instance, create a new bucket. For this tutorial, you can select the Smart Tier which is the free tier. When directed, upload your file. For the sample file, refer to the tickets.csv file in the [GitHub repository](https://github.com/IBM/ibmdotcom-tutorials).
76
92
77
-
### Step 4. Establish your data connection
93
+
### Step 5. Establish your data connection
78
94
79
95
To provide the ReAct agent with IT ticket management functionality, we must connect to our data source in IBM Cloud Object Storage. For this step, we can use the [`ibm_boto3` library](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-python).
80
96
@@ -95,7 +111,7 @@ In `tools.py`, the `COS_ENDPOINT`, `COS_INSTANCE_CRN`, `BUCKET_NAME` and `CSV_FI
95
111
)
96
112
```
97
113
98
-
### Step 5. Create your custom tools
114
+
### Step 6. Create your custom tools
99
115
100
116
Our agent will be able to both read and write data in our file. First, let's create the tool to read data using the LangChain `@tool` decorator.
101
117
@@ -175,9 +191,7 @@ One last tool we must add to our `tools.py` file is the `get_todays_date` tool w
175
191
176
192
These tools are imported in the `agent.py` file and passed to the prebuilt LangGraph `create_react_agent` function serving as the agent executor. Other parameters include the large language model initialized by using the `ChatWatsonx` class which allows for tool calling on watsonx.ai, the memory saver and system prompt. Note, some prompts will behave better than others and so, some level of prompt engineering might be required depending on the LLM you choose.
177
193
178
-
Before deploying your agent, remember to complete all the necessary information in the `config.toml` file.
0 commit comments