Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List assistants throwing error when empty list. #604

Closed
1 of 12 tasks
akshdeep-singh opened this issue Nov 26, 2024 · 2 comments · Fixed by #607
Closed
1 of 12 tasks

List assistants throwing error when empty list. #604

akshdeep-singh opened this issue Nov 26, 2024 · 2 comments · Fixed by #607
Assignees
Labels
p:openai_dart openai_dart package. t:bug Something isn't working
Milestone

Comments

@akshdeep-singh
Copy link

System Info

openai_dart: 0.4.4

Related Components

  • doc-loaders
  • doc-transformers
  • prompts
  • llms
  • chat-models
  • output-parsers
  • chains
  • memory
  • stores
  • embeddings
  • retrievers
  • agents

Reproduction

  1. Use the List assistants api without creating any assistant.

Following code in the package throws error:

_$ListAssistantsResponseImpl _$$ListAssistantsResponseImplFromJson(
        Map<String, dynamic> json) =>
    _$ListAssistantsResponseImpl(
      object: json['object'] as String,
      data: (json['data'] as List<dynamic>)
          .map((e) => AssistantObject.fromJson(e as Map<String, dynamic>))
          .toList(),
      firstId: json['first_id'] as String,
      lastId: json['last_id'] as String,
      hasMore: json['has_more'] as bool,
    );

Error reason: When list is empty, the first_id and last_id are null:

image

Solution: Change String to String?.

Expected behavior

Should not throw error when parsing json response.

@akshdeep-singh akshdeep-singh added the t:bug Something isn't working label Nov 26, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in LangChain.dart Nov 26, 2024
@davidmigloz davidmigloz added the p:openai_dart openai_dart package. label Nov 26, 2024
@davidmigloz davidmigloz self-assigned this Nov 26, 2024
@davidmigloz davidmigloz added this to the 0.8.0 milestone Nov 26, 2024
@davidmigloz
Copy link
Owner

hey @akshdeep-singh ,

Thanks for reporting, I'll make it nullable in the next release.

@davidmigloz
Copy link
Owner

Fixed in openai_dart 0.4.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:openai_dart openai_dart package. t:bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants