Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.46k stars 4.8k forks source link

[OpenAI] [Scenario] Add conveniences for pagination #42487

Open joseharriaga opened 8 months ago

joseharriaga commented 8 months ago

The following service methods return pageable collections:

  1. List fine-tuning jobs: πŸ”— https://platform.openai.com/docs/api-reference/fine-tuning/list
  2. List fine-tuning events: πŸ”—https://platform.openai.com/docs/api-reference/fine-tuning/list-events
  3. List assistants: πŸ”— https://platform.openai.com/docs/api-reference/assistants/listAssistants
  4. List assistant files: πŸ”— https://platform.openai.com/docs/api-reference/assistants/listAssistantFiles
  5. List messages: πŸ”— https://platform.openai.com/docs/api-reference/messages/listMessages
  6. List message files: πŸ”— https://platform.openai.com/docs/api-reference/messages/listMessageFiles
  7. List runs: πŸ”— https://platform.openai.com/docs/api-reference/runs/listRuns
  8. List run steps: πŸ”— https://platform.openai.com/docs/api-reference/runs/listRunSteps

These are identifiable by the fact that the response body has the following two properties:

  1. "object": "list"
  2. "has_more": true/false

We should explore adding a client similar to Azure.Core's Pageable but tailored to OpenAI's approach to pagination (e.g., an OpenAIPageable?)

annelo-msft commented 5 months ago

I believe this is addressed by https://github.com/Azure/azure-sdk-for-net/pull/44026, but will let @joseharriaga determine if the issue is closed for OAI.