OpenAI API provider: Difference between revisions

From MoodleDocs
Update OpenAI documentation
No edit summary
Line 5: Line 5:
Moodle integration with OpenAI provides a service that lets people use advanced AI tools like generate a text, generate an image or summarize a text.  
Moodle integration with OpenAI provides a service that lets people use advanced AI tools like generate a text, generate an image or summarize a text.  


More information about OpenAI can be found on the following link <nowiki>https://platform.openai.com</nowiki>
More information about OpenAI can be found on the following link https://platform.openai.com  


==== Requirements: ====
==== Requirements: ====
Line 16: Line 16:
# Click on the "OpenAI API Provider" settings link.
# Click on the "OpenAI API Provider" settings link.
# In the “Settings” area proceed to configure the following:  
# In the “Settings” area proceed to configure the following:  
#* OpenAI API key: You can get the key from your OpenAI account / API Keys (OpenAI API keys).
#* OpenAI API key: You can get the key from your OpenAI account / API Keys ([https://platform.openai.com/account/api-keys OpenAI API keys]).
#* OpenAI organization ID: You can get it from  your OpenAI account / Organization settings page (OpenAI account).
#* OpenAI organization ID: You can get it from  your OpenAI account / Organization settings page ([https://platform.openai.com/account/org-settings OpenAI account]).
#* Set site-wide rate limit: Limit the number of requests that the OpenAI API provider can receive across the entire site every hour.  
#* Set site-wide rate limit: Limit the number of requests that the OpenAI API provider can receive across the entire site every hour.  
#* Maximum number of site-wide requests can be configured after enable “Set site-wide rate limit”
#* Maximum number of site-wide requests can be configured after enable “Set site-wide rate limit”
Line 23: Line 23:
#* Maximum number of requests per user can be configured after enable “Set user rate limit”
#* Maximum number of requests per user can be configured after enable “Set user rate limit”
# In the “Actions” area enable all actions by clicking on their “Enabled” toggle.
# In the “Actions” area enable all actions by clicking on their “Enabled” toggle.
 
.[[File:OpenAI.jpg|none|thumb|600x600px|OpenAI Dashboard]]
[[File:OpenAI.jpg|none|thumb|600x600px|OpenAI]]


==== Configuring OpenAI API provider actions ====
==== Configuring OpenAI API provider actions ====
Line 33: Line 32:
'''Generate text''': You can configure the following settings:  
'''Generate text''': You can configure the following settings:  


* AI model: OpenAI API is powered by a diverse set of models with different capabilities and price points. There is more information about OpenAI models in the following link <nowiki>https://platform.openai.com/docs/models</nowiki>   As default is set to “GPT-4o” but it can be change for any other compatible model, see your settings organization limits for more information (<nowiki>https://platform.openai.com/settings/organization/limits</nowiki>)
* AI model: OpenAI API is powered by a diverse set of models with different capabilities and price points. There is more information about OpenAI models in the following link https://platform.openai.com/docs/models  As default is set to “GPT-4o” but it can be change for any other compatible model, see your settings organization limits for more information (https://platform.openai.com/settings/organization/limits)


* API endpoint. Please ensure your API endpoint is compatible with your Model, see more information in the following link <nowiki>https://platform.openai.com/docs/models/model-endpoint-compatibility</nowiki>
* API endpoint. Please ensure your API endpoint is compatible with your Model, see more information in the following link https://platform.openai.com/docs/models/model-endpoint-compatibility


* System instruction: There are some system instructions as default, but this can be adapted to your needs.  
* System instruction: There are some system instructions as default, but this can be adapted to your needs.  
 
'''Summarise text:''' The required configuration is the same as for the Generate text action.
'''Summarise text:''' The required configuration is the same as for the Generate text action.  


'''Generate image''': You can configure the following settings:  
'''Generate image''': You can configure the following settings:  


* AI model: As default is set to “dall-e-3” but it can be changed for any other image generation compatible model. See more information in the following link <nowiki>https://platform.openai.com/docs/models/dall-e</nowiki>
* AI model: As default is set to “dall-e-3” but it can be changed for any other image generation compatible model. See more information in the following link https://platform.openai.com/docs/models/dall-e  
* API endpoint:  Please ensure your API endpoint is compatible with your Model.
* API endpoint:  Please ensure your API endpoint is compatible with your Model.



Revision as of 19:00, 15 October 2024

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.


New feature
in Moodle 5.2!


Moodle integration with OpenAI provides a service that lets people use advanced AI tools like generate a text, generate an image or summarize a text.

More information about OpenAI can be found on the following link https://platform.openai.com

Requirements:

An OpenAI account with access to the API key (Usage limits and pricing tiers are dependent on the level of access and the volume of queries).

Configuring OpenAI API provider settings

  1. Go to Admin -> General -> AI -> AI providers
  2. Enable the "OpenAI API Provider" by clicking on the “Enabled” toggle.
  3. Click on the "OpenAI API Provider" settings link.
  4. In the “Settings” area proceed to configure the following:
    • OpenAI API key: You can get the key from your OpenAI account / API Keys (OpenAI API keys).
    • OpenAI organization ID: You can get it from  your OpenAI account / Organization settings page (OpenAI account).
    • Set site-wide rate limit: Limit the number of requests that the OpenAI API provider can receive across the entire site every hour.
    • Maximum number of site-wide requests can be configured after enable “Set site-wide rate limit”
    • Set user rate limit
    • Maximum number of requests per user can be configured after enable “Set user rate limit”
  5. In the “Actions” area enable all actions by clicking on their “Enabled” toggle.

.

OpenAI Dashboard

Configuring OpenAI API provider actions

OpenAI Actions

Access to the Settings link on each action to configure them.


Generate text: You can configure the following settings:

  • System instruction: There are some system instructions as default, but this can be adapted to your needs.

Summarise text: The required configuration is the same as for the Generate text action.

Generate image: You can configure the following settings:

  • AI model: As default is set to “dall-e-3” but it can be changed for any other image generation compatible model. See more information in the following link https://platform.openai.com/docs/models/dall-e
  • API endpoint:  Please ensure your API endpoint is compatible with your Model.
Generate text in OpenAI


Now we should be able to use OpenAI provider for the AI placements available in our Moodle instance: Course Assistance and HTML Text Editor Placements. Don't forget to enable and configure AI Placements settings.