sap-ai-core pins the AI SDK V2 package → "Schema validation failed" in opencode ≥ 2.4

Đang mở Phù hợp với người mới
#14,467 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
62/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ệ
typescript
Lĩnh vực
api

Hướng nghiên cứu

Payload không nêu tên tệp nào trong repo này, nên hãy bắt đầu bằng việc tìm mục provider sap-ai-core trong dữ liệu models.dev và trường npm của mục đó, hiện đang trỏ tới @jerome-benoit/sap-ai-provider-v2. Kiểm tra xem gói V3 @jerome-benoit/sap-ai-provider có phải là gói thay thế đã định hay không, rồi chỉ thay đổi trường đó. Hoàn thành khi mục này được phân giải tới gói V3. Bảng kiểm tra trong issue là tài liệu tham chiếu để kiểm tra thủ công trên tenant SAP AI Core.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

The sap-ai-core provider entry resolves to the AI SDK V2 package:

npm: @jerome-benoit/sap-ai-provider-v2

opencode ≥ 2.4 consumes providers through the AI SDK V3 (v6) LanguageModel interface, where a finish event carries finishReason as an object { normalized, raw } and normalized is validated against stop | length | tool-calls | content-filter | error | unknown.

The V2 package emits finishReason as a plain string, and the AI SDK V2→V3 bridge collapses "unknown" (and any unmapped fallback) to unified: "other":

// node_modules/ai/dist/index.js
convertV2FinishReasonToV3(finishReason) {
  return { unified: finishReason === "unknown" ? "other" : finishReason, raw: undefined };
}

"other" is not in opencode's step-finish enum, so every SAP AI Core turn fails with Error: Schema validation failed / Failed to drain Session (fatal on tool-call turns). This is the finish-reason analogue of the V2-provider problems already seen in anomalyco/opencode#50338.

Fix

The same author publishes a V3/default package at the same version. Point the registry entry at it:

npm: @jerome-benoit/sap-ai-provider
Verification

Reproduced and fixed end-to-end against a live SAP AI Core tenant with sap-ai-core/gpt-6.1-sol:

Case -v2 (current) @jerome-benoit/sap-ai-provider (V3)
reply with exactly: PONG PONG + Error: Schema validation failed PONG, clean
tool-call turn (ls + describe) Failed to drain Session, aborts tool runs, answer renders, clean

Full write-up, repro script and config: https://github.com/fyx99/opencode-sap-ai-core-fix

Ngôn ngữ chính
TypeScript
Star
7.8k
Fork
2.2k
Merge trung bình
7 giờ 1 phút
Pull request đã merge (30 ngày)
794

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/models.dev

Tất cả issue của anomalyco/models.dev

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.