Find answers from the community

Updated 6 months ago

how to get the list of all possible models used in OpenAI() ?

At a glance

The community member @kapa.ai asked how to get a list of all possible models used in the OpenAI() function. The other community members responded that the knowledge sources provided do not include a direct method for this, but suggested referring to the OpenAI documentation or API to find the available models. They provided an example of how to use a specific model with OpenAI(), and mentioned that the LlamaIndex documentation may have more details.

In a follow-up question, @kapa.ai asked how to get a list of all other available models. The community members responded that to get a list of available models in a specific module, you can use the list_models() function, but the exact method may vary depending on the module. They provided an example of how to list models in the google.generativeai module that support the generateContent method, and suggested referring to the documentation or API reference for other modules.

@kapa.ai how to get the list of all possible models used in OpenAI() ?
k
p
5 comments
Please stand by @praveenks30#120294 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
The knowledge sources provided do not include a direct method to get a list of all possible models that can be used with the OpenAI() function in LlamaIndex. However, you can refer to the OpenAI documentation or the OpenAI API for a list of available models.

For using a specific model with OpenAI(), you can specify the model name as a parameter. For example:

Plain Text
from llama_index.llms.openai import OpenAI
llm = OpenAI(model="gpt-3.5-turbo", temperature=0.1)

In the above code, "gpt-3.5-turbo" is the model being used. You can replace this with the name of any other available model.

For more details, you can refer to the LlamaIndex documentation ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
@kapa.ai how can I get the list of all other available models ?
Let me check the knowledge base for you. One moment! :books:
----------------------
To get a list of all available models in a specific module, you can use the list_models() function. However, the exact method may vary depending on the module you are using.

For example, if you are using the google.generativeai module, you can get a list of all available models as follows:

Plain Text
import google.generativeai as genai

for m in genai.list_models():
    if "generateContent" in m.supported_generation_methods:
        print(m.name)


This code will print the names of all models that support the generateContent method.

For other modules, you would need to refer to their specific documentation or API reference to find out how to list all available models.

Please note that the above code is based on the information provided in the knowledge sources ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord