Skip to content

Conversation

krishnaagrawal7508
Copy link

@krishnaagrawal7508 krishnaagrawal7508 commented Mar 30, 2025

Add support for all LIST type of API calls

This PR attempts to adds all LIST type of API calls which includes listModels(), listTunedModels(), listCachedContent(), listCorpora() and listFiles().

  • created a new request-list.ts file which enables dynamic handling of future API calls for all the functions mentioned above (similar to request.ts)

  • created a new file request-list.test.ts and added test cases

  • added test cases for listModels(), listTunedModels(), listCachedContent(), listCorpora() and listFiles(). in the file gen-ai.test.ts

Screenshot 2025-03-30 102258

Try running with:

const genAI = new GoogleGenerativeAI(apiKey);

const list1 = genAI.listModels();
const list2 = genAI.listTunedModels();
const list3 = genAI.listCachedContent();
const list4 = genAI.listCorpora();
const list5 = genAI.listFiles();

All these function accepts two optional params pageSize and pageToken

@wanlin31 wanlin31 added type:feature request New feature request/enhancement p3 status:triaged Issue/PR triaged to the corresponding sub-team labels Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3 status:triaged Issue/PR triaged to the corresponding sub-team type:feature request New feature request/enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants