Vercel AI: `gen_ai.system_instructions` is missing when the system prompt is a message object
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 73/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js, typescript
- Lĩnh vực
- observability
Hướng nghiên cứu
Đọc vercel-ai-orchestrion-subscriber.js cho v4–v6 và vercel-ai-dc-subscriber.js cho v7, tập trung vào cách xử lý system prompt được mô tả trong issue. Tái hiện bằng các ví dụ generateText được cung cấp, sử dụng cả prompt dạng chuỗi và prompt dạng đối tượng thông điệp. Công việc hoàn tất khi cả hai dạng đều điền gen_ai.system_instructions trên các span invoke_agent ở tất cả phiên bản bị ảnh hưởng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
SDK: @sentry/node 11.10.0 (also @sentry/nextjs 11.10.0) · ai 6.0.316 and 7.0.162
Steps to reproduce
const Sentry = require('@sentry/node');
Sentry.init({
dsn: '…',
tracesSampleRate: 1,
sendDefaultPii: true,
traceLifecycle: 'stream',
beforeSendSpan: Sentry.withStreamedSpan(span => {
if (span.name.startsWith('invoke_agent')) console.log(span.name, span.attributes['gen_ai.system_instructions'] ?? '(missing)');
return span;
}),
});
const { generateText } = require('ai');
const { MockLanguageModelV3 } = require('ai/test'); // MockLanguageModelV4 on ai v7
const model = () => new MockLanguageModelV3({
doGenerate: async () => ({ content: [{ type: 'text', text: 'ok' }], finishReason: { unified: 'stop', raw: 'stop' }, usage: { inputTokens: { total: 1 }, outputTokens: { total: 1 } }, warnings: [] }),
});
// ai v7: use `instructions` instead of `system`
await generateText({ model: model(), experimental_telemetry: { functionId: 'string' }, system: 'Be brief.', prompt: 'hi' });
await generateText({
model: model(),
experimental_telemetry: { functionId: 'object' },
system: { role: 'system', content: 'Be brief.', providerOptions: { anthropic: { cacheControl: { type: 'ephemeral' } } } },
prompt: 'hi',
});
Expected result
Both invoke_agent spans have gen_ai.system_instructions.
Actual result
invoke_agent string [{"type":"text","content":"Be brief."}]
invoke_agent object (missing)
The same happens on ai v7 with instructions.
Additional context
The AI SDK accepts string | SystemModelMessage | SystemModelMessage[] for the system prompt. The object form is the documented way to set provider options on it, for example Anthropic prompt caching. The integration reads only strings:
- v4–v6:
instructions: util.asString(options.system)invercel-ai-orchestrion-subscriber.js - v7:
util.asString(event.instructions)inbuildInputMessageAttributes(vercel-ai-dc-subscriber.js)
Possible fix: when the value is an object or an array, take each message's content.
Related: #20581 (the "System messages extracted to gen_ai.system_instructions" item).
I can open a PR if this approach works for you.
- Ngôn ngữ chính
- TypeScript
- Star
- 8.8k
- Fork
- 1.9k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 664
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry-javascript
-
Bug Node.js
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
getsentry/sentry-javascript#25950 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Browser Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
getsentry/sentry-javascript#25946 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
normalize() throws when a getter throws a Symbol or a null-prototype objectCó thể đã có người làm @rjmcgee53192 đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-javascript#25920 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Only create Nuxt database and storage spans when there is a parent spanCó thể đã có người làm @nicohrubec đã nhận 5 ngày trước. Đang mởImprovement Nuxt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
getsentry/sentry-javascript#25805 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Only create Cloudflare storage and D1 db spans when there is a parent spanCó thể đã có người làm @nicohrubec đã nhận 5 ngày trước. Đang mởCloudflare Workers Improvement Spans
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-javascript#25804 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của getsentry/sentry-javascript
Issue tương tự
-
test: claim-conflict drop leaves both facts active and is never re-proposed (untested review cell)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature]: Usage page should show API-equivalent cost and say when a connected plan shows info onlyĐang mởenhancement from-x
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
nightly-labs/openbot#4867 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
egonSchiele/agency-lang#1377 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
normalizePath removes the Windows device namespace prefixCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
caprover/caprover-frontend#273 ·
Maintainer thường phản hồi trong vòng 1 ngày