Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: supported pathlike deployment ids #5

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"