OpenAI API provider: Difference between revisions

From MoodleDocs
No edit summary
mNo 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 https://platform.openai.com  
More information about OpenAI can be found on the following link https://platform.openai.com


==== Requirements: ====
=== 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).
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 ====
When setting up an OpenAI account with an API key, users can generate keys with both free and paid accounts, but API usage is restricted based on the account type and payment method. '''Access to the API requires a subscription to one of OpenAI’s paid plans''', such as the Pay-as-you-go or Pro/Enterprise plan, which provide different levels of access depending on the selected pricing tier.


=== Configuring OpenAI API provider settings ===
# Go to Admin -> General -> AI -> AI providers
# Go to Admin -> General -> AI -> AI providers
# Enable the "OpenAI API Provider" by clicking on the “Enabled” toggle.
# Enable the "OpenAI API Provider" by clicking on the “Enabled” toggle.
Line 18: Line 19:
#* 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 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 ([https://platform.openai.com/account/org-settings 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”
#* Set user rate limit
#* Set user rate limit
#* 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.<br />
.[[File:OpenAI.jpg|none|thumb|600x600px|OpenAI Dashboard]]


 
=== Configuring OpenAI API provider actions ===
====Configuring OpenAI API provider actions====
[[File:OpenAI Actions.png|none|thumb|600x600px|OpenAI Actions]]
[[File:OpenAI Actions.png|none|thumb|600x600px|OpenAI Actions]]
Access to the Settings link on each action to configure them.  
Access to the Settings link on each action to configure them.  
Line 52: Line 51:




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.  
 
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 13:46, 16 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).

When setting up an OpenAI account with an API key, users can generate keys with both free and paid accounts, but API usage is restricted based on the account type and payment method. Access to the API requires a subscription to one of OpenAI’s paid plans, such as the Pay-as-you-go or Pro/Enterprise plan, which provide different levels of access depending on the selected pricing tier.

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.

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.