64bit / async-openai

Rust library for OpenAI
https://docs.rs/async-openai
MIT License
1.11k stars 165 forks source link

query for client files list seems to be missing #167

Closed jeremychone closed 8 months ago

jeremychone commented 8 months ago

Problem

Right now, the api to list files of an org does not seem to take query parameters.

    pub fn files(&self) -> Files<C> {
        Files::new(self)
    }

But the openai list api does accept an optional filter "purpose."

Also, I wouldn't be surprised if OpenAI updates the organization list files API to accept the same query parameters as the Assistant's list.

The current async-openai query in freeform format is pretty cool, as it allows for adaptability and future-proofing for these smaller details.

Solution

Three options:

1) Add the Q: Serialize argument (pros: consistency with Assistant files list, cons: breaking change).

2) Add another list_with_query function (pros: no breaking change, cons: asymmetry with Assistant files list).

3) Wait until OpenAI introduces more query parameters (purpose doesn't seem to be a major filter anyway, and they seem okay with returning all anyway).

Personally, I think any of those three options could be reasonable.

64bit commented 8 months ago

Thank you for issue and possible solutions.

I think (1) is fine for consistency, for breaking change - we can bump the minor version and it will be very minor fix in client code.