Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env_example
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ AZURE_CONTENT_SAFETY_API_KEY="xxxxx"
AZURE_CONTENT_SAFETY_API_ENDPOINT="https://xxxxx.cognitiveservices.azure.com/"

HUGGINGFACE_TOKEN="hf_xxxxxxx"
HUGGINGFACE_ENDPOINT="https://router.huggingface.co/v1"

GOOGLE_GEMINI_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta/openai"
GOOGLE_GEMINI_API_KEY = "xxxxx"
Expand Down
2 changes: 1 addition & 1 deletion doc/code/targets/1_openai_chat_target.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
"source": [
"## OpenAI Configuration\n",
"\n",
"All `OpenAITarget`s can communicate to [Azure OpenAI (AOAI)](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference), [OpenAI](https://platform.openai.com/docs/api-reference/introduction), or other compatible endpoints (e.g., Ollama, Groq).\n",
"All `OpenAITarget`s can communicate to [Azure OpenAI (AOAI)](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference), [OpenAI](https://platform.openai.com/docs/api-reference/introduction), or other compatible endpoints (e.g., Ollama, Groq, HuggingFace).\n",
"\n",
"The `OpenAIChatTarget` is built to be as cross-compatible as we can make it, while still being as flexible as we can make it by exposing functionality via parameters.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion doc/code/targets/1_openai_chat_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
# %% [markdown]
# ## OpenAI Configuration
#
# All `OpenAITarget`s can communicate to [Azure OpenAI (AOAI)](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference), [OpenAI](https://platform.openai.com/docs/api-reference/introduction), or other compatible endpoints (e.g., Ollama, Groq).
# All `OpenAITarget`s can communicate to [Azure OpenAI (AOAI)](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference), [OpenAI](https://platform.openai.com/docs/api-reference/introduction), or other compatible endpoints (e.g., Ollama, Groq, HuggingFace).
#
# The `OpenAIChatTarget` is built to be as cross-compatible as we can make it, while still being as flexible as we can make it by exposing functionality via parameters.
#
Expand Down
4 changes: 2 additions & 2 deletions doc/getting_started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ from pyrit.setup.initializers import SimpleInitializer
await initialize_pyrit_async(memory_db_type="InMemory", initializers=[SimpleInitializer()])
```

This gives you an in-memory database and default converter/scorer config — enough to run most notebooks and examples. Replace the endpoint/key/model for your provider (Azure, Ollama, Groq, etc.).
This gives you an in-memory database and default converter/scorer config — enough to run most notebooks and examples. Replace the endpoint/key/model for your provider (Azure, Ollama, Groq, HuggingFace, etc.).

## For Persistent Setup

Expand All @@ -50,7 +50,7 @@ For anything beyond a quick test — especially `pyrit_scan`, scenarios, and rep
:link: ./populating_secrets
**Set Up Your .env File**

Create `~/.pyrit/.env` with your provider credentials. Tabbed examples for OpenAI, Azure, Ollama, Groq, and more.
Create `~/.pyrit/.env` with your provider credentials. Tabbed examples for OpenAI, Azure, Ollama, Groq, HuggingFace, and more.
::::

::::{card} 📄 Configuration File (Recommended)
Expand Down
10 changes: 10 additions & 0 deletions doc/getting_started/populating_secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ OPENAI_CHAT_MODEL="llama3-8b-8192"
Get your API key from [console.groq.com](https://console.groq.com/).
:::

:::{tab-item} HuggingFace
```bash
OPENAI_CHAT_ENDPOINT="https://router.huggingface.co/v1"
OPENAI_CHAT_KEY="hf_your-token-here"
OPENAI_CHAT_MODEL="meta-llama/Llama-3.1-8B-Instruct"
Comment thread
romanlutz marked this conversation as resolved.
```

Get your token from [huggingface.co/docs/hub/security-tokens](https://huggingface.co/docs/hub/security-tokens). Browse available models at [huggingface.co/models](https://huggingface.co/models).
:::

:::{tab-item} OpenRouter
```bash
OPENAI_CHAT_ENDPOINT="https://openrouter.ai/api/v1"
Expand Down
2 changes: 1 addition & 1 deletion doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ After installing, configure PyRIT with your AI endpoint credentials and initiali
:link: getting_started/populating_secrets
**Set Up Your .env File**

Create `~/.pyrit/.env` with your provider credentials. Tabbed examples for OpenAI, Azure, Ollama, Groq, and more.
Create `~/.pyrit/.env` with your provider credentials. Tabbed examples for OpenAI, Azure, Ollama, Groq, HuggingFace, and more.
::::

::::{card} 📄 Config File (Recommended)
Expand Down
Loading
Loading