diff --git a/doc/code/targets/1_openai_chat_target.ipynb b/doc/code/targets/1_openai_chat_target.ipynb index 45e28ab1e3..b70343c1c5 100644 --- a/doc/code/targets/1_openai_chat_target.ipynb +++ b/doc/code/targets/1_openai_chat_target.ipynb @@ -70,11 +70,25 @@ "\n", "- endpoint: The API endpoint (`OPENAI_CHAT_ENDPOINT` environment variable). For OpenAI, these are just \"https://api.openai.com/v1/chat/completions\". For Ollama, even though `/api/chat` is referenced in its official documentation, the correct endpoint to use is `/v1/chat/completions` to ensure compatibility with OpenAI's response format.\n", "- auth: The API key for authentication (`OPENAI_CHAT_KEY` environment variable).\n", - "- model_name: The model to use (`OPENAI_CHAT_MODEL` environment variable). For OpenAI, these are any available model name and are listed here: \"https://platform.openai.com/docs/models\".\n" + "- model_name: The model to use (`OPENAI_CHAT_MODEL` environment variable). For OpenAI, these are any available model name and are listed here: \"https://platform.openai.com/docs/models\".\n", + "\n", + "## LM Studio Support\n", + "\n", + "You can also use `OpenAIChatTarget` with [LM Studio](https://lmstudio.ai), a desktop app for running local LLMs with OpenAI-like endpoints. To set it up with PyRIT:\n", + "\n", + "- Launch LM Studio, ensure a model is loaded, and verify that the API server is running (typically at `http://127.0.0.1:1234`).\n", + "- Be sure to configure your environment variables:\n", + " ```\n", + " OPENAI_CHAT_ENDPOINT=\"http://127.0.0.1:1234/v1/chat/completions\"\n", + " OPENAI_CHAT_MODEL=\"your-model-api-identifier\" # e.g., \"phi-3.1-mini-128k-instruct\"\n", + " ```\n" ] } ], "metadata": { + "jupytext": { + "main_language": "python" + }, "language_info": { "codemirror_mode": { "name": "ipython", diff --git a/doc/code/targets/1_openai_chat_target.py b/doc/code/targets/1_openai_chat_target.py index 66fa443d10..e3877f42ee 100644 --- a/doc/code/targets/1_openai_chat_target.py +++ b/doc/code/targets/1_openai_chat_target.py @@ -54,3 +54,14 @@ # - auth: The API key for authentication (`OPENAI_CHAT_KEY` environment variable). # - model_name: The model to use (`OPENAI_CHAT_MODEL` environment variable). For OpenAI, these are any available model name and are listed here: "https://platform.openai.com/docs/models". # +# ## LM Studio Support +# +# You can also use `OpenAIChatTarget` with [LM Studio](https://lmstudio.ai), a desktop app for running local LLMs with OpenAI-like endpoints. To set it up with PyRIT: +# +# - Launch LM Studio, ensure a model is loaded, and verify that the API server is running (typically at `http://127.0.0.1:1234`). +# - Be sure to configure your environment variables: +# ``` +# OPENAI_CHAT_ENDPOINT="http://127.0.0.1:1234/v1/chat/completions" +# OPENAI_CHAT_MODEL="your-model-api-identifier" # e.g., "phi-3.1-mini-128k-instruct" +# ``` +#