async-openai
async-openai copied to clipboard
[suggestion] Let list methods take an Option argument
Maybe this is my lack of experience, but when I'm requesting just a full list of objects like files I have to write something like:
let file_list = files.list::<[&str; 0]>(&[]).await?;
Wouldn't it be better to let it be just files.list(None).await??
Thanks for suggestion, it can be improved, how about having two functions
files.list()with no parameters, which calls another public function belowfiles.list_with_query(query: Q)
I think files.list() has better ergonomics than files.list(None).
I think
files.list()has better ergonomics thanfiles.list(None).
I agree. I just followed #167 and tried to figure out a good compromise.
BTW, a side note here. The query arguments are currently undocumented (vector store list method uses the same design). Perhaps it worth pointing out at reqwest crate for those looking for understanding without digging into the sources, like I did.
That's a good observation too about lack of documentation on query parameter - any contribution to help improve it is most welcome! (I think one of examples have a usage but that's not very visible/searchable on docs.rs)
Discussion in #167 was in context of missing the call for Files api group. It does seem like it needs to be addressed across the whole crate, that does sound like a breaking change where existing list becomes list_with_query
Its a small breaking-change and and an improvement so why not? Can be released in a version bump.
In addition, breaking change is ok too because list would wrap list_with_query so easy to maintain and implement.
That's a good observation too about lack of documentation on
queryparameter - any contribution to help improve it is most welcome! (I think one of examples have a usage but that's not very visible/searchable on docs.rs)
Oh, I know this tone... :) Unfortunately, as you can see, I barely find time on side-projects now. Had to even quit Raku development. Otherwise it'd be my pleasure!
No obligations, thank you for your contributions, the issue is going to be here if you wanna give it a shot.
This is implemented in the latest release as fluid api:
client.files().query(&[("limit", 10)])?.list().await?
All other APIs also implement it, hence closing.