Skip to content

Commit

Permalink
Added promptflow connection creates to dockerbuild to make setup easi…
Browse files Browse the repository at this point in the history
…er, less steps, also positions for GH actions
  • Loading branch information
dividor committed Jun 29, 2024
1 parent 4405eb0 commit 6a4133d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ HAPI_API_TOKEN=

# OPENAI
OPENAI_API_KEY=
ASSISTANTS_API_KEY=${OPENAI_API_KEY}
ASSISTANTS_API_TYPE=openai
ASSISTANTS_ID=
ASSISTANTS_BASE_URL=""
ASSISTANTS_MODEL=gpt-4o
ASSISTANTS_BOT_NAME="Humanitarian AI Assistant"

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,8 @@ Then ...
5. Open folder `/app`
6. Click on `flow.dag.yaml`
7. Top left of main pane, click on 'Visual editor'
8. On bottom left under connections, configure an Azure OpenAI connection called 'azure_openai'
9. On the Groundedness node, select your new connection
10. You can no run by clicking the play icon. See Promptflow documentation for more details
8. On the Groundedness node, select your new connection
9. You can no run by clicking the play icon. See Promptflow documentation for more details

# Deployment

Expand Down
5 changes: 4 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ services:
build:
context: .
dockerfile: ./flows/chainlit-ui-evaluation//Dockerfile
args:
OPENAI_API_KEY: ${ASSISTANTS_API_KEY}
OPENAI_API_ENDPOINT: ${ASSISTANTS_BASE_URL}
container_name: recipes-ai-promptflow
env_file:
- .env
- .env
volumes:
- ./flows:/app
- ./utils:/app/chainlit-ui-evaluation/utils
Expand Down
23 changes: 21 additions & 2 deletions flows/chainlit-ui-evaluation/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
FROM mcr.microsoft.com/azureml/promptflow/promptflow-runtime-stable:latest

# No need to copy the app code, we mount via docker-compose-dev.yml
ARG OPENAI_API_KEY
ENV OPENAI_API_KEY=$OPENAI_API_KEY

ARG OPENAI_API_ENDPOINT
ENV OPENAI_API_ENDPOINT=$OPENAI_API_ENDPOINT

COPY ./flows /app
COPY ./utils /app/chainlit-ui-evaluation/utils
COPY ./templates /app/chainlit-ui-evaluation/templates
COPY ./management/skills.py /app/chainlit-ui-evaluation/recipes/skills.py
COPY ./ui/chat-chainlit-assistant/app.py /app/chainlit-ui-evaluation/app.py

RUN pip3 install --upgrade pip
RUN pip3 install chainlit==1.1.305

# Needed for running chainlit code if using Mock tests
RUN pip3 install chainlit==1.1.305

# Needed for promptflow connections
RUN pip install keyrings.alt

# Set up Connections
RUN cd /app/chainlit-ui-evaluation && pf connection create --file ./openai.yaml --set api_key=$OPENAI_API_KEY --name open_ai_connection
RUN cd /app/chainlit-ui-evaluation && pf connection create --file ./azure_openai.yaml --set api_key=$OPENAI_API_KEY --set api_base=$OPENAI_API_ENDPOINT --name azure_openai
2 changes: 1 addition & 1 deletion flows/chainlit-ui-evaluation/flow.dag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ nodes:
context: ${inputs.context}
temperature: 1
model: gpt-4-turbo-preview
connection: azure_openai
connection: open_ai_connection
api: chat
- name: concat_scores
type: python
Expand Down

0 comments on commit 6a4133d

Please sign in to comment.