OpenAI API provider: Difference between revisions

From MoodleDocs
German Valero (talk | contribs)
m Added link to Spanish page
Update OpenAI documentation
Line 1: Line 1:
{{AI subsystem}}
{{Work in progress}}
{{Work in progress}}
{{New features}}
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>
==== 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 ====
# Go to Admin -> General -> AI -> AI providers
# Enable the "OpenAI API Provider" by clicking on the “Enabled” toggle.
# Click on the "OpenAI API Provider" settings link.
# 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”
# In the “Actions” area enable all actions by clicking on their “Enabled” toggle.
[[File:OpenAI.jpg|none|thumb|600x600px|OpenAI]]
==== Configuring OpenAI API provider actions ====
[[File:OpenAI Actions.png|none|thumb|600x600px|OpenAI Actions]]
Access to the Settings link on each action to configure them.
'''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>)
* 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>
* 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 <nowiki>https://platform.openai.com/docs/models/dall-e</nowiki>
* API endpoint:  Please ensure your API endpoint is compatible with your Model.
[[File:Generate text in OpenAI.png|none|thumb|600x600px|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|AI Placements]] settings.


[[es:Proveedor OpenAI API]]
[[es:Proveedor OpenAI API]]

Revision as of 18:57, 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.0!


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

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:

  • 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 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.

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.