Skip to content

Commit 806dcc0

Browse files
committed
feat(debugging_assistant): add get_ros2_image tool
1 parent c66940f commit 806dcc0

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/rai_core/rai/tools/debugging_assistant.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import rclpy
1516
import streamlit as st
1617
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
1718

1819
from rai.agents.conversational_agent import create_conversational_agent
1920
from rai.agents.integrations.streamlit import get_streamlit_cb, streamlit_invoke
21+
from rai.communication.ros2.connectors import ROS2ARIConnector
2022
from rai.tools.ros.cli import (
2123
ros2_action,
2224
ros2_interface,
@@ -25,15 +27,28 @@
2527
ros2_service,
2628
ros2_topic,
2729
)
30+
from rai.tools.ros2.topics import GetROS2ImageTool
2831
from rai.utils.model_initialization import get_llm_model
2932

3033

3134
@st.cache_resource
3235
def initialize_graph():
36+
rclpy.init()
3337
llm = get_llm_model(model_type="complex_model", streaming=True)
38+
39+
connector = ROS2ARIConnector()
40+
3441
agent = create_conversational_agent(
3542
llm,
36-
[ros2_topic, ros2_interface, ros2_node, ros2_service, ros2_action, ros2_param],
43+
[
44+
ros2_topic,
45+
ros2_interface,
46+
ros2_node,
47+
ros2_service,
48+
ros2_action,
49+
ros2_param,
50+
GetROS2ImageTool(connector=connector),
51+
],
3752
system_prompt="""You are a ROS 2 expert helping a user with their ROS 2 questions. You have access to various tools that allow you to query the ROS 2 system.
3853
Be proactive and use the tools to answer questions. Retrieve as much information from the ROS 2 system as possible.
3954
""",

tests/core/test_tool_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from langchain_core.messages import AIMessage, ToolCall, ToolMessage
1818
from langchain_core.tools import tool
19+
1920
from rai.agents.tool_runner import ToolRunner
2021
from rai.messages import HumanMultimodalMessage, ToolMultimodalMessage
2122
from rai.messages.utils import preprocess_image

0 commit comments

Comments
 (0)