https://github.com/dana-farber-aios/gpt4dfci-api
An example on how to call the API of GPT4DFCI, a private and secure generative AI tool, based on GPT and o1 models and deployed for non-clinical use at Dana-Farber Cancer Institute.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.4%) to scientific vocabulary
Repository
An example on how to call the API of GPT4DFCI, a private and secure generative AI tool, based on GPT and o1 models and deployed for non-clinical use at Dana-Farber Cancer Institute.
Basic Info
- Host: GitHub
- Owner: Dana-Farber-AIOS
- License: gpl-2.0
- Language: Python
- Default Branch: main
- Homepage: https://www.dana-farber.org/newsroom/news-releases/2024/private-and-secure-generative-ai-tool-supports-operations-and-research-at-dana-farber
- Size: 66.4 KB
Statistics
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
GPT4DFCI-API 🔌
Welcome to the code repository for GPT4DFCI-API, an example of how to call the API of GPT4DFCI, which a allows you to leverage GPT4DFCI programmatically in your application. GPT4DFCI is a private and secure generative AI tool, based on GPT and o1 models that deployed for non-clinical use at Dana-Farber Cancer Institute. See all details about GPT4DFCI in the separate GPT4DFCI code repository.
😈 If you are an advanced user, and just want the GPT4DFCI-API code straightaway please see demo.py.
🤓 All other GPT4DFCI-API users, please keep reading. This repository is organized in the following sections:
- Prerequisites
- Run the GPT4DFCI API demo
- License
- Contact
⚙️ Prerequisites
Poetry is a tool for dependency management and packaging in Python.
If you are already familiar with Poetry, or are comfortable setting up your own environment with other tools, you can probably skip this.
Installing Poetry
https://python-poetry.org/docs/#installation
For macOS this would be the suggested way:
- Install brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install poetry using:
brew install poetry
Installing GPT4DFCI API dependencies
After installing Poetry, navigate to the directory you are interested in and run:
poetry install --no-root
This should create a virtual environment with the dependencies specified in pyproject.toml installed.
To activate the virtual environment, run:
poetry shell
or, alternatively, if you don't want to use Poetry's sub-shell pattern, you can run:
source .venv/bin/activate
🟢 Run the GPT4DFCI API demo
Set up environment variables
In a file called .env, fill in the following values:
AZURE_OPENAI_ENDPOINT=https://...
AZURE_OPENAI_ENTRA_SCOPE=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
AZURE_OPENAI_ENDPOINT should be the GPT4DFCI API endpoint, without the /openai suffix.
AZURE_OPENAI_ENTRA_SCOPE should be the scope required for the bearer token, the UUID client_id.
Authenticate via Azure CLI
Prerequisites: Azure CLI
For macOS this would be
brew install azure-cli
If you are using DFCI AI Studio, you should use %sh curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Then, make sure you are logged in via the Azure CLI to an account that has been granted access to the GPT4DFCI API.
az login --allow-no-subscriptions
Close the window after logging in and get back to the shell.
VPN
Turn on the VPN or make sure you are running from an on-prem resource.
Run the demo
export $(cat .env | xargs) && python demo.py
Shutting down
When finished working, shut the current virtual environment with
deactivate
Resuming work
When you are read to resume working on this, come back to this folder and resume working with
source .venv/bin/activate
export $(cat .env | xargs) && python demo.py
🎫 License
The GNU GPL v2 version of GPT4DFCI is made available via Open Source licensing. The user is free to use, modify, and distribute under the terms of the GNU General Public License version 2.
Commercial license options are available also, and include additional features.
📧 Contact
Questions? Comments? Suggestions? Get in touch!
aios@dfci.harvard.edu
Owner
- Name: Dana-Farber-AIOS
- Login: Dana-Farber-AIOS
- Kind: organization
- Website: https://www.dana-farber.org/
- Repositories: 1
- Profile: https://github.com/Dana-Farber-AIOS
AI Operations and Data Science Services group
GitHub Events
Total
- Watch event: 1
- Fork event: 1
Last Year
- Watch event: 1
- Fork event: 1
Dependencies
- annotated-types 0.6.0
- anyio 4.3.0
- azure-core 1.30.1
- azure-identity 1.15.0
- black 24.2.0
- certifi 2024.2.2
- cffi 1.16.0
- charset-normalizer 3.3.2
- click 8.1.7
- colorama 0.4.6
- cryptography 42.0.5
- distro 1.9.0
- h11 0.14.0
- httpcore 1.0.4
- httpx 0.27.0
- idna 3.6
- msal 1.27.0
- msal-extensions 1.1.0
- mypy-extensions 1.0.0
- openai 1.13.3
- packaging 24.0
- pathspec 0.12.1
- platformdirs 4.2.0
- portalocker 2.8.2
- pycparser 2.21
- pydantic 2.6.3
- pydantic-core 2.16.3
- pyjwt 2.8.0
- pywin32 306
- requests 2.31.0
- ruff 0.3.2
- six 1.16.0
- sniffio 1.3.1
- tqdm 4.66.2
- typing-extensions 4.10.0
- urllib3 2.2.1
- black ^24.2.0 develop
- ruff ^0.3.2 develop
- azure-identity ^1.15.0
- openai ^1.13.3
- python ^3.12