openai / openai-python

The official Python library for the OpenAI API
https://pypi.org/project/openai/
Apache License 2.0
22k stars 3.03k forks source link

Request: make it possible to specify the upper limit of history #1208

Closed higutea closed 6 months ago

higutea commented 6 months ago

Confirm this is an issue with the Python library and not an underlying OpenAI API

Describe the bug

I specified the limit parameter, but the message history does not match the limit parameter value. https://github.com/openai/openai-python/blob/main/src/openai/types/beta/threads/message_list_params.py#L29-L30

    limit: int
    """A limit on the number of objects to be returned.

it is forum feedback url. https://community.openai.com/t/request-make-it-possible-to-specify-the-upper-limit-of-history/663420

To Reproduce

always

Code snippets

def _get_message(gpt_thread_id:str, secret:str):
    client = OpenAI(api_key=secret)
    return client.beta.threads.messages.list(
        thread_id=gpt_thread_id,
        extra_query = {"limit": 1},
        limit=1
    )


### OS

mac(docker debian)

### Python version

python3.9

### Library version

opneai v1.12.0
rattrayalex commented 6 months ago

Thanks for the suggestion!

This sounds like a feature request for the underlying OpenAI API and not the Python library, so I'm going to go ahead and close this issue.

Would you mind reposting at community.openai.com?

higutea commented 6 months ago

yes ! Already posted a request on the forum https://community.openai.com/t/request-make-it-possible-to-specify-the-upper-limit-of-history/663420/11