Skip to content

[BUG] The PageSizeLimit property does not work with the AssistantClient.GetMessages call. #541

@aszti911

Description

@aszti911

Describe the bug

The PageSizeLimit parameter does not work with the GetMessages() and GetMessagesAsync() methods in the instantiated assistantClient class. No matter how I set the parameter, the response always contains the maximum number of messages.

I tested the endpoint provided by OpenAI (GET https://api.openai.com/v1/threads/{thread_id}/messages) via Postman using the same parameter, and it worked as expected there. This leads me to believe that the issue is not with the endpoint itself, but likely with the library implementation.

Steps to reproduce

Just call the affected methods to reproduce the bug:

Code snippets

MessageCollectionOptions options = new()
            {
                Order = order is not null ? order : MessageCollectionOrder.Ascending
            };
            if (limit.HasValue && limit > 0 && limit <= 100)
            {
                options.PageSizeLimit = limit.Value;
            }

            List<ThreadMessage> result = assistantClient.GetMessages(threadId, options).ToList();

OS

Linux Mint

.NET version

9.0.300

Library version

2.2.0

Metadata

Metadata

Assignees

Labels

issue-addressedWorkflow: The OpenAI maintainers believe the issue to be addressed and ready to close.questionCategory: The issue is seeking information about the library or its usage.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions