alexrudall/ruby-openai

batches.list is missing after/limit query parameters support + README inaccuracy regarding batches

marckohlbrugge opened this issue · 0 comments

module OpenAI
class Batches
def initialize(client:)
@client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION)
end
def list
@client.get(path: "/batches")
end
def retrieve(id:)
@client.get(path: "/batches/#{id}")
end
def create(parameters: {})
@client.json_post(path: "/batches", parameters: parameters)
end
def cancel(id:)
@client.post(path: "/batches/#{id}/cancel")
end
end
end

Is missing support for the after and limit parameters described here:

after
string
Optional
A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

limit
integer
Optional
Defaults to 20
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

API Reference


In addition, the README incorrectly states that Batches are only available for completions, while embeddings are also supported.

README:

The Batches endpoint allows you to create and manage large batches of API requests to run asynchronously. Currently, only the `/v1/chat/completions` endpoint is supported for batches.

OpenAI Docs:

Batches start with a .jsonl file where each line contains the details of an individual request to the API. For now, the available endpoints are /v1/chat/completions (Chat Completions API) and /v1/embeddings (Embeddings API).

Source: https://platform.openai.com/docs/guides/batch/1-preparing-your-batch-file