A programming framework for agentic AI
docs: initial Jupyter support for website docs, move config notebook (#1448)
Jack Gerrits276d5b7d31ac
diff --git a/.devcontainer/dev/Dockerfile b/.devcontainer/dev/Dockerfileindex 62b18ade3..482157437 100644--- a/.devcontainer/dev/Dockerfile+++ b/.devcontainer/dev/Dockerfile@@ -4,7 +4,7 @@ FROM python:3.11-slim-bookworm# Update and install necessary packagesRUN apt-get update && apt-get -y update# added vim and nano for convenience-RUN apt-get install -y sudo git npm vim nano curl+RUN apt-get install -y sudo git npm vim nano curl wget# Setup a non-root user 'autogen' with sudo accessRUN adduser --disabled-password --gecos '' autogen@@ -32,6 +32,14 @@ RUN sudo pip install pydoc-markdownRUN cd websiteRUN yarn install --frozen-lockfile --ignore-engines+RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \+ wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.549/quarto-1.4.549-linux-${arch}.tar.gz && \+ mkdir -p /home/autogen/quarto/ && \+ tar -xzf quarto-1.4.549-linux-${arch}.tar.gz --directory /home/autogen/quarto/ && \+ rm quarto-1.4.549-linux-${arch}.tar.gz++ENV PATH="${PATH}:/home/autogen/quarto/quarto-1.4.549/bin/"+# Exposes the Yarn port for DocusaurusEXPOSE 3000diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.ymlindex ccc6e4b21..f90a78f87 100644--- a/.github/workflows/deploy-website.yml+++ b/.github/workflows/deploy-website.yml@@ -41,6 +41,15 @@ jobs:- name: pydoc-markdown runrun: |pydoc-markdown+ - name: quarto install+ working-directory: ${{ runner.temp }}+ run: |+ wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.549/quarto-1.4.549-linux-amd64.tar.gz+ tar -xzf quarto-1.4.549-linux-amd64.tar.gz+ echo "$(pwd)/quarto-1.4.549/bin/" >> $GITHUB_PATH+ - name: quarto run+ run: |+ quarto render .- name: Test Buildrun: |if [ -e yarn.lock ]; then@@ -75,6 +84,15 @@ jobs:- name: pydoc-markdown runrun: |pydoc-markdown+ - name: quarto install+ working-directory: ${{ runner.temp }}+ run: |+ wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.549/quarto-1.4.549-linux-amd64.tar.gz+ tar -xzf quarto-1.4.549-linux-amd64.tar.gz+ echo "$(pwd)/quarto-1.4.549/bin/" >> $GITHUB_PATH+ - name: quarto run+ run: |+ quarto render .- name: Build websiterun: |if [ -e yarn.lock ]; thendiff --git a/website/.gitignore b/website/.gitignoreindex b88fd5871..495a9753d 100644--- a/website/.gitignore+++ b/website/.gitignore@@ -10,6 +10,8 @@ package-lock.json.cache-loaderdocs/reference+docs/llm_endpoint_configuration.mdx+# Misc.DS_Store.env.local@@ -20,3 +22,5 @@ docs/referencenpm-debug.log*yarn-debug.log*yarn-error.log*++/.quarto/diff --git a/website/README.md b/website/README.mdindex a931c9024..cc52f4480 100644--- a/website/README.md+++ b/website/README.md@@ -19,12 +19,19 @@ cd websiteyarn install```+### Install Quarto++`quarto` is used to render notebooks.++Install it [here](https://quarto.org/docs/get-started/).+## Local Development-Navigate to the website folder and run:+Navigate to the `website` folder and run:```consolepydoc-markdown+quarto render ./docsyarn start```diff --git a/notebook/oai_openai_utils.ipynb b/website/docs/llm_endpoint_configuration.ipynbsimilarity index 93%rename from notebook/oai_openai_utils.ipynbrename to website/docs/llm_endpoint_configuration.ipynbindex 7b40ae3e0..2cbca3d3f 100644--- a/notebook/oai_openai_utils.ipynb+++ b/website/docs/llm_endpoint_configuration.ipynb@@ -4,20 +4,57 @@"cell_type": "markdown","metadata": {},"source": [- "# In-depth Guide to OpenAI Utility Functions\n",+ "---\n",+ "custom_edit_url: https://github.com/microsoft/autogen/edit/main/website/docs/llm_endpoint_configuration.ipynb\n",+ "---\n",+ "\n",+ "# LLM Endpoint Configuration\n",+ "\n",+ "## TL;DR\n",+ "\n",+ "For just getting started with AutoGen you can use the following to define your LLM endpoint configuration:"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {},+ "outputs": [],+ "source": [+ "import autogen\n",+ "\n",+ "config_list = autogen.get_config_list([\"YOUR_OPENAI_API_KEY\"], api_type=\"openai\")"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "\\:\\:\\:danger \n",+ "\n",+ "Never commit secrets into your code. Before committing, change the code to use a different way of providing your API keys as described below.\n",+ "\n",+ "\\:\\:\\:"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "\n",+ "\n",+ "## In-depth\n","\n","Managing API configurations can be tricky, especially when dealing with multiple models and API versions. The provided utility functions assist users in managing these configurations effectively. Ensure your API keys and other sensitive data are stored securely. You might store keys in `.txt` or `.env` files or environment variables for local development. Never expose your API keys publicly. If you insist on storing your key files locally on your repo (you shouldn't), ensure the key file path is added to the `.gitignore` file.\n","\n",- "#### Steps:\n",+ "### Steps:\n","1. Obtain API keys from OpenAI and optionally from Azure OpenAI (or other provider).\n","2. Store them securely using either:\n"," - Environment Variables: `export OPENAI_API_KEY='your-key'` in your shell.\n"," - Text File: Save the key in a `key_openai.txt` file.\n"," - Env File: Save the key to a `.env` file eg: `OPENAI_API_KEY=sk-********************`\n",+ "3. [Ensure `pyautogen` is installed](./installation/Installation.mdx)\n","\n",- "---\n",- "\n",- "**TL;DR:** <br>\n","There are many ways to generate a `config_list` depending on your use case:\n","\n","- `get_config_list`: Generates configurations for API calls, primarily from provided API keys.\n",@@ -26,14 +63,14 @@"- `config_list_from_models`: Creates configurations based on a provided list of models, useful when targeting specific models without manually specifying each configuration.\n","- `config_list_from_dotenv`: Constructs a configuration list from a `.env` file, offering a consolidated way to manage multiple API configurations and keys from a single file.\n","\n",- "If mutiple models are provided, the Autogen client (`OpenAIWrapper`) and agents don't choose the \"best model\" on any criteria - inference is done through the very first model and the next one is used only if the current model fails (e.g. API throttling by the provider or a filter condition is unsatisfied)."+ "If multiple models are provided, the Autogen client (`OpenAIWrapper`) and agents don't choose the \"best model\" on any criteria - inference is done through the very first model and the next one is used only if the current model fails (e.g. API throttling by the provider or a filter condition is unsatisfied)."]},{"cell_type": "markdown","metadata": {},"source": [- "#### What is a `config_list`?\n",+ "### What is a `config_list`?\n","When instantiating an assistant, such as the example below, it is passed a `config_list`. This is used to tell the `AssistantAgent` which models or configurations it has access to:\n","```python\n","\n",@@ -56,24 +93,6 @@"Different tasks may require different models, and the `config_list` aids in dynamically selecting the appropriate model configuration, managing API keys, endpoints, and versions for efficient operation of the intelligent assistant. In summary, the `config_list` helps the agents work efficiently, reliably, and optimally by managing various configurations and interactions with the OpenAI API - enhancing the adaptability and functionality of the agents."]},- {- "cell_type": "code",- "execution_count": 2,- "metadata": {},- "outputs": [],- "source": [- "# %pip install \"pyautogen>=0.2.3\""- ]- },- {- "cell_type": "code",- "execution_count": 3,- "metadata": {},- "outputs": [],- "source": [- "import autogen"- ]- },{"cell_type": "markdown","metadata": {},diff --git a/website/sidebars.js b/website/sidebars.jsindex aa50eef0c..cdc3ef6f2 100644--- a/website/sidebars.js+++ b/website/sidebars.js@@ -22,6 +22,7 @@id: "installation/Installation"},},+ 'llm_endpoint_configuration',{'Use Cases': [{type: 'autogenerated', dirName: 'Use-Cases'}]},'Contribute','Research',