diff --git a/README.Rmd b/README.Rmd index 1209c5f..5e0f347 100644 --- a/README.Rmd +++ b/README.Rmd @@ -63,53 +63,76 @@ install.packages("gpttools") help(package = "gpttools") ``` -## Privacy Notice for gpttools -This privacy notice is applicable to the R package that utilizes the GPT-3 and GPT-3.5 API provided by OpenAI. By using this package, you agree to adhere to the privacy terms and conditions set by OpenAI. - -### Data Sharing with OpenAI -When using this R package, the text or code that you highlight/select with your cursor, or the prompt you enter within the built-in applications, will be sent to OpenAI as part of an API request. This data sharing is governed by the privacy notice, rules, and exceptions that you agreed to with OpenAI when creating an account. +### Available AI Services and Models -### Security and Data Usage by OpenAI -We cannot guarantee the security of the data you send to OpenAI via the API, nor can we provide details on how OpenAI processes or uses your data. However, OpenAI has stated that they utilize prompts and results to enhance their AI models, as outlined in their terms of use. You can opt-out of this data usage by contacting OpenAI directly and making an explicit request. +| AI Service | Models | Documentation | Setup | +| ---- | ---- | ---- | ---- | +| [OpenAI](https://platform.openai.com) | gpt-4-turbo, gpt-4, gpt-3.5-turbo ([latest models](https://platform.openai.com/docs/models)) | [OpenAI API Docs](https://platform.openai.com/docs/api-reference) | [OpenAI Setup](articles/openai.md) | +| [HuggingFace](https://huggingface.co/) | various | [HF Inference API Docs](https://huggingface.co/docs/hub/models-inference) | [HF Setup](articles/huggingface.md) | +| [Anthropic](https://docs.anthropic.com/claude/docs/guide-to-anthropics-prompt-engineering-resources) | claude-2.1, claude-instant-1.2 | [Anthropic API Docs](https://docs.anthropic.com/claude/reference/getting-started-with-the-api) | [Anthropic Setup](articles/anthropic.md) | +| [Ollama](https://ollama.ai/) | mistral, llama2, mixtral, phi ([latest models](https://ollama.ai/library)) | [Ollama API Docs](https://github.com/jmorganca/ollama/blob/main/docs/api.md) | [Ollama Setup](articles/ollama.md) | +| [Perplexity](https://www.perplexity.ai) | pplx-7b-chat, pplx-70b-chat, pplx-7b-online, pplx-70b-online, llama-2-70b-chat, codellama-34b-instruct, mistral-7b-instruct, and mixtral-8x7b-instruct | [Perplexity API Docs](https://docs.perplexity.ai/reference/post_chat_completions) | [Perplexity Setup](articles/perplexity.md) | +| [Google AI Studio](https://ai.google.dev/tutorials/ai-studio_quickstart) | Gemini and Palm (legacy) | [Google AI Studio Docs](https://ai.google.dev/docs) | [Google AI Studio Setup](articles/googleai.md) | +| [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview) | gpt-4, gpt-3.5-turbo ([latest models](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-preview)) | [Azure OpenAI API Docs](https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line,python&pivots=rest-api) | [Azure OpenAI Setup](articles/azure.md) | -### Limiting Data Sharing -The R package is designed to share only the text or code that you specifically highlight/select or include in a prompt through our built-in applications. No other elements of your R environment will be shared. It is your responsibility to ensure that you do not accidentally share sensitive data with OpenAI. +### Default AI Service: OpenAI -**IMPORTANT: To maintain the privacy of your data, do not highlight, include in a prompt, or otherwise upload any sensitive data, code, or text that should remain confidential.** +To get started, you must first set up an API service. The package is configured to work with several AI service providers, allowing for flexibility and choice based on your specific needs. The default configuration is set to use OpenAI's services. To use it you need: - -## Prerequisites - -1. Make an OpenAI account. +1. Make an OpenAI account. [Sign up here](https://platform.openai.com/). 2. [Create an OpenAI API key](https://platform.openai.com/account/api-keys) to use with the package. -3. Set the API key up in Rstudio +3. Set the API key up in Rstudio. See the section below on configuring the API key. -### Setting OpenAI API Key +#### Configuring OpenAI API Key -By default, API calls will look for `OPENAI_API_KEY` environment variable. If you want to set a global environment variable, you can use the following command, where `""` should be replaced with your actual key: +To interact with the OpenAI API, it's required to have a valid `OPENAI_API_KEY` environment variable. Here are the steps to configure it. -```{r} -#| eval: false -Sys.setenv(OPENAI_API_KEY = "") -``` +You can establish this environment variable globally by including it in your project's .Renviron file. This approach ensures that the environment variable persists across all sessions as the Shiny app runs in the background. -Otherwise, you can add the key to the .Renviron file of the project. The following commands will open .Renviron for editing: +Here is a set of commands to open the .Renviron file for modification: ```{r} #| eval: false require(usethis) -edit_r_environ(scope = "project") +edit_r_environ() ``` -You can add the following line to .Renviron (again, replace `""` with your actual key): +For a persistent setting that loads every time you launch this project, add the following line to .Renviron, replacing `""` with your actual API key: ``` bash -OPENAI_API_KEY= "") +OPENAI_API_KEY="" ``` -This now set the API key every time you start up this particular project. Note: If you are using GitHub/Gitlab, do not forget to add .Renviron to .gitignore! +**Caution:** If you're using version control systems like GitHub or GitLab, remember to include .Renviron in your .gitignore file to prevent exposing your API key! + +**Important Note:** OpenAI API will not function without valid payment details entered into your OpenAI account. This is a restriction imposed by OpenAI and is unrelated to this package. + +### Alternative AI Service Providers + +While OpenAI is the default and currently considered one of the most robust options, `gpttools` is also compatible with other AI service providers. These include [Anthropic](articles/anthropic.md), [HuggingFace](articles/huggingface.md), [Google AI Studio](articles/googleai.md), [Azure OpenAI](articles/azure.md), and [Perplexity](articles/perplexity.md). You can select any of these providers based on your preference or specific requirements. You can also run local models with [Ollama](articles/ollama.md). This requires more setup but at the benefit of not sharing your data with any third party. + +To use an alternative provider, you will need to obtain the relevant API key or access credentials from the chosen provider and configure them similarly. + +## Privacy Notice for gpttools + +This privacy notice is applicable to the R package that uses popular language models like gpt-4 turbo and claude-2.1. By using this package, you agree to adhere to the privacy terms and conditions set by the API service. + +### Data Sharing with AI Services + +When using this R package, any text or code you highlight/select with your cursor, or the prompt you enter within the built-in applications, will be sent to the selected AI service provider (e.g., OpenAI, Anthropic, HuggingFace, Google AI Studio, Azure OpenAI) as part of an API request. This data sharing is governed by the privacy notice, rules, and exceptions that you agreed to with the respective service provider when creating an account. + +### Security and Data Usage by AI Service Providers + +We cannot guarantee the security of the data you send via the API to any AI service provider, nor can we provide details on how each service processes or uses your data. However, these providers often state that they use prompts and results to enhance their AI models, as outlined in their terms of use. Be sure to review the terms of use of the respective AI service provider directly. + +### Limiting Data Sharing + +The R package is designed to share only the text or code that you specifically highlight/select or include in a prompt through our built-in applications. No other elements of your R environment will be shared unless you turn those features on. It is your responsibility to ensure that you do not accidentally share sensitive data with any AI service provider. + +**IMPORTANT: To maintain the privacy of your data, do not highlight, include in a prompt, or otherwise upload any sensitive data, code, or text that should remain confidential.** + ## Usage diff --git a/README.md b/README.md index 1a8f42b..2f6c17f 100644 --- a/README.md +++ b/README.md @@ -53,80 +53,124 @@ install.packages("gpttools") help(package = "gpttools") ``` -## Privacy Notice for gpttools - -This privacy notice is applicable to the R package that utilizes the -GPT-3 and GPT-3.5 API provided by OpenAI. By using this package, you -agree to adhere to the privacy terms and conditions set by OpenAI. - -### Data Sharing with OpenAI +### Available AI Services and Models -When using this R package, the text or code that you highlight/select -with your cursor, or the prompt you enter within the built-in -applications, will be sent to OpenAI as part of an API request. This -data sharing is governed by the privacy notice, rules, and exceptions -that you agreed to with OpenAI when creating an account. +| AI Service | Models | Documentation | Setup | +|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------| +| [OpenAI](https://platform.openai.com) | gpt-4-turbo, gpt-4, gpt-3.5-turbo ([latest models](https://platform.openai.com/docs/models)) | [OpenAI API Docs](https://platform.openai.com/docs/api-reference) | [OpenAI Setup](articles/openai.md) | +| [HuggingFace](https://huggingface.co/) | various | [HF Inference API Docs](https://huggingface.co/docs/hub/models-inference) | [HF Setup](articles/huggingface.md) | +| [Anthropic](https://docs.anthropic.com/claude/docs/guide-to-anthropics-prompt-engineering-resources) | claude-2.1, claude-instant-1.2 | [Anthropic API Docs](https://docs.anthropic.com/claude/reference/getting-started-with-the-api) | [Anthropic Setup](articles/anthropic.md) | +| [Ollama](https://ollama.ai/) | mistral, llama2, mixtral, phi ([latest models](https://ollama.ai/library)) | [Ollama API Docs](https://github.com/jmorganca/ollama/blob/main/docs/api.md) | [Ollama Setup](articles/ollama.md) | +| [Perplexity](https://www.perplexity.ai) | pplx-7b-chat, pplx-70b-chat, pplx-7b-online, pplx-70b-online, llama-2-70b-chat, codellama-34b-instruct, mistral-7b-instruct, and mixtral-8x7b-instruct | [Perplexity API Docs](https://docs.perplexity.ai/reference/post_chat_completions) | [Perplexity Setup](articles/perplexity.md) | +| [Google AI Studio](https://ai.google.dev/tutorials/ai-studio_quickstart) | Gemini and Palm (legacy) | [Google AI Studio Docs](https://ai.google.dev/docs) | [Google AI Studio Setup](articles/googleai.md) | +| [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview) | gpt-4, gpt-3.5-turbo ([latest models](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-preview)) | [Azure OpenAI API Docs](https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line,python&pivots=rest-api) | [Azure OpenAI Setup](articles/azure.md) | -### Security and Data Usage by OpenAI +### Default AI Service: OpenAI -We cannot guarantee the security of the data you send to OpenAI via the -API, nor can we provide details on how OpenAI processes or uses your -data. However, OpenAI has stated that they utilize prompts and results -to enhance their AI models, as outlined in their terms of use. You can -opt-out of this data usage by contacting OpenAI directly and making an -explicit request. - -### Limiting Data Sharing +To get started, you must first set up an API service. The package is +configured to work with several AI service providers, allowing for +flexibility and choice based on your specific needs. The default +configuration is set to use OpenAI’s services. To use it you need: -The R package is designed to share only the text or code that you -specifically highlight/select or include in a prompt through our -built-in applications. No other elements of your R environment will be -shared. It is your responsibility to ensure that you do not accidentally -share sensitive data with OpenAI. - -**IMPORTANT: To maintain the privacy of your data, do not highlight, -include in a prompt, or otherwise upload any sensitive data, code, or -text that should remain confidential.** - -## Prerequisites - -1. Make an OpenAI account. +1. Make an OpenAI account. [Sign up + here](https://platform.openai.com/). 2. [Create an OpenAI API key](https://platform.openai.com/account/api-keys) to use with the package. -3. Set the API key up in Rstudio +3. Set the API key up in Rstudio. See the section below on configuring + the API key. -### Setting OpenAI API Key +#### Configuring OpenAI API Key -By default, API calls will look for `OPENAI_API_KEY` environment -variable. If you want to set a global environment variable, you can use -the following command, where `""` should be replaced with your -actual key: +To interact with the OpenAI API, it’s required to have a valid +`OPENAI_API_KEY` environment variable. Here are the steps to configure +it. -``` r -Sys.setenv(OPENAI_API_KEY = "") -``` +You can establish this environment variable globally by including it in +your project’s .Renviron file. This approach ensures that the +environment variable persists across all sessions as the Shiny app runs +in the background. -Otherwise, you can add the key to the .Renviron file of the project. The -following commands will open .Renviron for editing: +Here is a set of commands to open the .Renviron file for modification: ``` r require(usethis) -edit_r_environ(scope = "project") +edit_r_environ() ``` -You can add the following line to .Renviron (again, replace `""` -with your actual key): +For a persistent setting that loads every time you launch this project, +add the following line to .Renviron, replacing `""` with your +actual API key: ``` bash -OPENAI_API_KEY= "") +OPENAI_API_KEY="" ``` -This now set the API key every time you start up this particular -project. Note: If you are using GitHub/Gitlab, do not forget to add -.Renviron to .gitignore! +**Caution:** If you’re using version control systems like GitHub or +GitLab, remember to include .Renviron in your .gitignore file to prevent +exposing your API key! + +**Important Note:** OpenAI API will not function without valid payment +details entered into your OpenAI account. This is a restriction imposed +by OpenAI and is unrelated to this package. + +### Alternative AI Service Providers + +While OpenAI is the default and currently considered one of the most +robust options, `gpttools` is also compatible with other AI service +providers. These include [Anthropic](articles/anthropic.md), +[HuggingFace](articles/huggingface.md), [Google AI +Studio](articles/googleai.md), [Azure OpenAI](articles/azure.md), and +[Perplexity](articles/perplexity.md). You can select any of these +providers based on your preference or specific requirements. You can +also run local models with [Ollama](articles/ollama.md). This requires +more setup but at the benefit of not sharing your data with any third +party. + +To use an alternative provider, you will need to obtain the relevant API +key or access credentials from the chosen provider and configure them +similarly. + +## Privacy Notice for gpttools + +This privacy notice is applicable to the R package that uses popular +language models like gpt-4 turbo and claude-2.1. By using this package, +you agree to adhere to the privacy terms and conditions set by the API +service. + +### Data Sharing with AI Services + +When using this R package, any text or code you highlight/select with +your cursor, or the prompt you enter within the built-in applications, +will be sent to the selected AI service provider (e.g., OpenAI, +Anthropic, HuggingFace, Google AI Studio, Azure OpenAI) as part of an +API request. This data sharing is governed by the privacy notice, rules, +and exceptions that you agreed to with the respective service provider +when creating an account. + +### Security and Data Usage by AI Service Providers + +We cannot guarantee the security of the data you send via the API to any +AI service provider, nor can we provide details on how each service +processes or uses your data. However, these providers often state that +they use prompts and results to enhance their AI models, as outlined in +their terms of use. Be sure to review the terms of use of the respective +AI service provider directly. + +### Limiting Data Sharing + +The R package is designed to share only the text or code that you +specifically highlight/select or include in a prompt through our +built-in applications. No other elements of your R environment will be +shared unless you turn those features on. It is your responsibility to +ensure that you do not accidentally share sensitive data with any AI +service provider. + +**IMPORTANT: To maintain the privacy of your data, do not highlight, +include in a prompt, or otherwise upload any sensitive data, code, or +text that should remain confidential.** ## Usage