Skip to content

Commit

Permalink
fix: patch-release 0.1.1 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik authored Sep 9, 2024
2 parents 7a00601 + 79b62ab commit 4ac4cf6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,44 @@ Copy `.env.example` to `.env` and customize it for your environment:

### Running interceptor as a DIAL service

To run dev application locally run:
#### From package

To run the server with examples using pip:

```sh
make examples_serve
pip install uvicorn python-dotenv "aidial-interceptors-sdk[examples]"
echo "DIAL_URL=URL" > .env
uvicorn "aidial_interceptors_sdk.examples.app:app" --host "0.0.0.0" --port 5000 --env-file ./.env
```

To run from Docker container:
Don't forget to set the appropriate `DIAL_URL` in the `.env` file.

The command will start the server on `http://localhost:5000` exposing endpoints for each of the interceptors like the following:

- `http://localhost:5000/openai/deployments/pii-anonymizer/chat/completions`
- `http://localhost:5000/openai/deployments/normalize-vector/embeddings`

#### From sources

First clone the repository:

```sh
make examples_docker_serve
git clone https://github.com/epam/ai-dial-interceptors-sdk.git .
cd ai-dial-interceptors-sdk
echo "DIAL_URL=URL" > .env
```

Either of the commands will start the server on `http://localhost:5000` exposing endpoints for each of the interceptors like these:
Then run dev server with examples:

- `http://localhost:5000/openai/deployments/pii-anonymizer/chat/completions`
- `http://localhost:5000/openai/deployments/normalize-vector/embeddings`
```sh
make examples_serve
```

Or run the server from Docker container:

```sh
make examples_docker_serve
```

### DIAL Core configuration

Expand Down
3 changes: 2 additions & 1 deletion aidial_interceptors_sdk/dial_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ async def create(
client = AsyncAzureOpenAI(
azure_endpoint=DIAL_URL,
azure_deployment="interceptor",
api_key=api_key,
# NOTE: DIAL SDK takes care of propagating auth headers
api_key="dummy",
# NOTE: api-version query parameter is not required in the chat completions DIAL API.
# However, it is required in Azure OpenAI API, that's why the openai library fails when it's missing:
# https://github.com/openai/openai-python/blob/9850c169c4126fd04dc6796e4685f1b9e4924aa4/src/openai/lib/azure.py#L174-L177
Expand Down
3 changes: 3 additions & 0 deletions aidial_interceptors_sdk/examples/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
embeddings_interceptors,
)
from aidial_interceptors_sdk.examples.utils.log_config import configure_loggers
from aidial_interceptors_sdk.utils._env import get_env

app = DIALApp(
description="Examples of DIAL interceptors",
telemetry_config=TelemetryConfig(),
add_healthcheck=True,
dial_url=get_env("DIAL_URL"),
propagate_auth_headers=True,
)

configure_loggers()
Expand Down

0 comments on commit 4ac4cf6

Please sign in to comment.