Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Bug]: Exception when calling GetResponseAsync

Đang mở Phù hợp với người mới
#1,127 2 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp, huggingface
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu từ đường dẫn tuần tự hóa của GetResponseAsync và kiểm tra cách xử lý SourceGenerationContext cho HuggingFace.ChatRequest. Tái hiện yêu cầu Qwen/Qwen2.5-Coder-32B-Instruct từ issue, sau đó xác minh rằng yêu cầu trả về phản hồi hợp lệ mà không gặp ngoại lệ JsonTypeInfo.

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

Mô tả

bug
Summary

Calling GetResponseAsync throws an exception.

Affected area

Serialization

NuGet package version

4.2

.NET version

10

Endpoint or model

Qwen/Qwen2.5-Coder-32B-Instruct

Minimal reproduction

using var client = new HuggingFaceInferenceClient("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");
IChatClient chatClient = client;

var response = await chatClient.GetResponseAsync(
[new(ChatRole.User, "Say hello in one word.")],
new ChatOptions { ModelId = "Qwen/Qwen2.5-Coder-32B-Instruct", MaxOutputTokens = 32 });

Actual behavior

System.InvalidOperationException: 'JsonTypeInfo metadata for type 'HuggingFace.ChatRequest' was not provided by TypeInfoResolver of type 'HuggingFace.SourceGenerationContext'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.'

Expected behavior

I get a proper response

Logs or request/response details

Operating system

Windows 11

Additional context

No response

Confirmations
  • I searched existing issues for duplicates.
  • I removed API keys, credentials, and other sensitive data.
Ngôn ngữ chính
C#
Star
58
Fork
9
Merge trung bình
22 phút
Pull request đã merge (30 ngày)
133

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

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 tương tự

Thêm issue về C#

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.