Skip to content

Commit f461501

Browse files
committed
address feedback
1 parent 700083c commit f461501

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/ai-providers/server-ai-langchain/src/ldai_langchain/langchain_helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ def extract_last_message_content(messages: List[Any]) -> str:
172172
Extract the string content of the last message in a list.
173173
174174
:param messages: List of LangChain message objects
175-
:return: String content of the last message, or empty string if none
175+
:return: String content of the last message, or empty string if none or content is not a str
176176
"""
177177
if messages:
178178
last = messages[-1]
179-
if hasattr(last, 'content'):
180-
return str(last.content)
179+
if hasattr(last, 'content') and isinstance(last.content, str):
180+
return last.content
181181
return ''
182182

183183

packages/ai-providers/server-ai-openai/src/ldai_openai/openai_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ def get_ai_metrics_from_response(response: Any) -> LDAIMetrics:
8181
# Tool names that require their own API type in the Chat Completions API.
8282
# LD stores all tools as type="function"; these are converted to their correct type.
8383
_NATIVE_API_TOOL_NAMES = frozenset({
84-
'web_search_tool',
84+
'web_search',
8585
'file_search',
86-
'computer_use_preview',
86+
'tool_search',
8787
})
8888

8989

0 commit comments

Comments
 (0)