Skip to content

Commit

Permalink
workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudhendra committed Oct 16, 2024
1 parent 34de65e commit 68e4d57
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/step1workflow.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
jobs:
example-job:
steps:
- name: Use API Key
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run application
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
# Your script that uses the API key
python medapp.py
6 changes: 3 additions & 3 deletions medapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
# Wrap the entire app in streamlit_analytics.track()
with streamlit_analytics.track():
# Set up OpenAI client
st.sidebar.title("OpenAI API Key")
key = os.getenv("OPENAI_API_KEY")
if not key:
key = st.sidebar.text_input("Enter your OpenAI API key:", type="password")
st.error("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
st.stop()
client = OpenAI(api_key=key)

# Check for GPU availability
Expand Down Expand Up @@ -85,7 +85,7 @@ def retrieve_passages(query: str, index, embeddings: np.ndarray, video_data: Lis
def generate_answer(query: str, context: str) -> str:
try:
response = client.chat.completions.create(
model="gpt-4o-mini",
model="gpt-4-0125-preview",
messages=[
{"role": "system", "content": "You are a helpful assistant that answers medical questions based on the provided context. Always ground your answers in the given context and be concise."},
{"role": "user", "content": f"Context: {context}\n\nQuestion: {query}\n\nAnswer:"}
Expand Down

0 comments on commit 68e4d57

Please sign in to comment.