Skip to content

Commit

Permalink
fix: supported pathlike deployment ids (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik authored Jul 1, 2024
1 parent 3d70551 commit 385385f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions aidial_adapter_dial/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async def parse(
)


@app.post("/openai/deployments/{deployment_id}/embeddings")
@app.post("/openai/deployments/{deployment_id:path}/embeddings")
@dial_exception_decorator
async def embeddings_proxy(request: Request, deployment_id: str):
body = await request.json()
Expand All @@ -137,7 +137,7 @@ async def embeddings_proxy(request: Request, deployment_id: str):
return response.to_dict()


@app.post("/openai/deployments/{deployment_id}/chat/completions")
@app.post("/openai/deployments/{deployment_id:path}/chat/completions")
@dial_exception_decorator
async def chat_completions_proxy(request: Request, deployment_id: str):

Expand Down
21 changes: 19 additions & 2 deletions docker-compose/local/generate_config_from_listing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@

set -e

get_python_cmd() {
# Check if python is defined
if command -v python &> /dev/null
then
echo "python"
elif command -v python3 &> /dev/null
then
echo "python3"
else
echo "Error: Neither python nor python3 is installed." >&2
return 1
fi
}

cd ../generate-config

PYTHON_CMD=$(get_python_cmd) || exit 1

echo "Installing Python dependencies..."
python -m venv .venv
$PYTHON_CMD -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt > /dev/null

echo "Generating config file..."
python app.py --local-app-port=5005 $@ > ../local/core/config.json
mkdir -p ../local/core
$PYTHON_CMD app.py --local-app-port=5005 $@ > ../local/core/config.json

echo "Config file saved to ./core/config.json"

0 comments on commit 385385f

Please sign in to comment.