We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d5760f commit b670bcdCopy full SHA for b670bcd
1 file changed
packages/core/src/tracing/langchain/utils.ts
@@ -82,18 +82,15 @@ function asString(v: unknown): string {
82
* // would end up in span attributes, since downstream stripping only works on objects.
83
*/
84
function normalizeContent(v: unknown): string {
85
- try {
86
- if (Array.isArray(v)) {
+ if (Array.isArray(v)) {
+ try {
87
const stripped = v.map(part =>
88
part && typeof part === 'object' && isContentMedia(part) ? stripInlineMediaFromSingleMessage(part) : part,
89
);
90
return JSON.stringify(stripped);
91
+ } catch {
92
+ return String(v);
93
}
- if (v && typeof v === 'object' && isContentMedia(v)) {
- return JSON.stringify(stripInlineMediaFromSingleMessage(v));
94
- }
95
- } catch {
96
- return String(v);
97
98
return asString(v);
99
0 commit comments