From 144ce84235add3003d868e8a53942780508d3772 Mon Sep 17 00:00:00 2001 From: Hemang Sarkar Date: Wed, 12 Feb 2025 09:24:20 +0100 Subject: [PATCH 1/5] Update README.md --- README.md | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1cec817..453f79d 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,32 @@ To integrate the Proxy with your AI agent, you’ll need to modify how your clie base_url="https://explorer.invariantlabs.ai/api/v1/proxy//openai", ) - # Make API requests to OpenAI as usual. + # Make API requests to OpenAI using the client as usual. ### **🔹 Anthropic Integration** -Coming Soon! +1. **Get an API Key** + Follow the instructions [here](https://explorer.invariantlabs.ai/docs/explorer/Explorer_API/1_client_setup/) to obtain an API key. + +2. **Modify Anthropic Client Setup** + Instead of connecting directly to Anthropic, configure your `Anthropic` client to use the proxy. + + ```python + from httpx import Client + from anthropic import Anthropic + + client = Anthropic( + http_client=Client( + headers={ + "Invariant-Authorization": "Bearer " + }, + ), + base_url="https://explorer.invariantlabs.ai/api/v1/proxy//anthropic", + ) + + # Make API requests to Anthropic using the client as usual. ### Run -./run.sh up \ No newline at end of file +./run.sh up + +### Run tests +./run.sh tests From a182f027c5ca437e4fc920347a405c0cd5eb46c8 Mon Sep 17 00:00:00 2001 From: Hemang Sarkar Date: Wed, 12 Feb 2025 09:24:51 +0100 Subject: [PATCH 2/5] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 453f79d..b60b4e6 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,11 @@ To integrate the Proxy with your AI agent, you’ll need to modify how your clie # Make API requests to Anthropic using the client as usual. ### Run +```bash ./run.sh up +``` ### Run tests +```bash ./run.sh tests +``` From b6916039c6d45ac8d533d63494da01cbbb8e5503 Mon Sep 17 00:00:00 2001 From: Hemang Sarkar Date: Wed, 12 Feb 2025 09:29:12 +0100 Subject: [PATCH 3/5] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b60b4e6..b2d0739 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,13 @@ Invariant Proxy is a lightweight Docker service that acts as an intermediary bet ## **Getting Started** To integrate the Proxy with your AI agent, you’ll need to modify how your client interacts with LLM providers. -### **🔹 OpenAI Integration** -1. **Get an API Key** +1. **Get an Invariant API Key** Follow the instructions [here](https://explorer.invariantlabs.ai/docs/explorer/Explorer_API/1_client_setup/) to obtain an API key. -2. **Modify OpenAI Client Setup** +### **🔹 OpenAI Integration** +2. To setup an OpenAI key follow the steps [here](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key). + +3. **Modify OpenAI Client Setup** Instead of connecting directly to OpenAI, configure your `OpenAI` client to use the proxy. ```python @@ -35,10 +37,9 @@ To integrate the Proxy with your AI agent, you’ll need to modify how your clie # Make API requests to OpenAI using the client as usual. ### **🔹 Anthropic Integration** -1. **Get an API Key** - Follow the instructions [here](https://explorer.invariantlabs.ai/docs/explorer/Explorer_API/1_client_setup/) to obtain an API key. +2. To setup an Anthropic key follow the steps [here](https://docs.anthropic.com/en/docs/initial-setup#set-your-api-key). -2. **Modify Anthropic Client Setup** +3. **Modify Anthropic Client Setup** Instead of connecting directly to Anthropic, configure your `Anthropic` client to use the proxy. ```python From cc953ed2fa23e1b229dcd10e1156290819ed59da Mon Sep 17 00:00:00 2001 From: Hemang Sarkar Date: Wed, 12 Feb 2025 09:29:44 +0100 Subject: [PATCH 4/5] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b2d0739..abedc03 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ Invariant Proxy is a lightweight Docker service that acts as an intermediary bet ## **Getting Started** To integrate the Proxy with your AI agent, you’ll need to modify how your client interacts with LLM providers. -1. **Get an Invariant API Key** +1. **Setup an Invariant API Key** Follow the instructions [here](https://explorer.invariantlabs.ai/docs/explorer/Explorer_API/1_client_setup/) to obtain an API key. ### **🔹 OpenAI Integration** -2. To setup an OpenAI key follow the steps [here](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key). +2. To setup an OpenAI API key follow the steps [here](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key). 3. **Modify OpenAI Client Setup** Instead of connecting directly to OpenAI, configure your `OpenAI` client to use the proxy. @@ -37,7 +37,7 @@ To integrate the Proxy with your AI agent, you’ll need to modify how your clie # Make API requests to OpenAI using the client as usual. ### **🔹 Anthropic Integration** -2. To setup an Anthropic key follow the steps [here](https://docs.anthropic.com/en/docs/initial-setup#set-your-api-key). +2. To setup an Anthropic API key follow the steps [here](https://docs.anthropic.com/en/docs/initial-setup#set-your-api-key). 3. **Modify Anthropic Client Setup** Instead of connecting directly to Anthropic, configure your `Anthropic` client to use the proxy. From b9e1d07d67713bd774aa49967b2d5062aea36af4 Mon Sep 17 00:00:00 2001 From: Hemang Sarkar Date: Wed, 12 Feb 2025 09:49:28 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index abedc03..9520fac 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,13 @@ To integrate the Proxy with your AI agent, you’ll need to modify how your clie client = OpenAI( http_client=Client( headers={ - "Invariant-Authorization": "Bearer " + "Invariant-Authorization": "Bearer your-invariant-api-key" }, ), - base_url="https://explorer.invariantlabs.ai/api/v1/proxy//openai", + base_url="https://explorer.invariantlabs.ai/api/v1/proxy/{add-your-dataset-name-here}/openai", ) - + # If a dataset with the given name already doesn't exist in Invariant Explorer, this will create the dataset + # before adding the traces to it. # Make API requests to OpenAI using the client as usual. ### **🔹 Anthropic Integration** @@ -49,12 +50,14 @@ To integrate the Proxy with your AI agent, you’ll need to modify how your clie client = Anthropic( http_client=Client( headers={ - "Invariant-Authorization": "Bearer " + "Invariant-Authorization": "Bearer your-invariant-api-key" }, ), - base_url="https://explorer.invariantlabs.ai/api/v1/proxy//anthropic", + base_url="https://explorer.invariantlabs.ai/api/v1/proxy/{add-your-dataset-name-here}/anthropic", ) - + + # If a dataset with the given name already doesn't exist in Invariant Explorer, this will create the dataset + # before adding the traces to it. # Make API requests to Anthropic using the client as usual. ### Run