First, check if Python is already installed on your system. Open your terminal and try running the following commands:
python --version
or
conda info
If these commands do not work, follow the steps below to install Python. You'll need Python 3.9 or later. We recommend using a virtual environment to manage dependencies, such as Anaconda. However, installing Python directly is also acceptable.
Using virtual environments allows you to create isolated environments for different projects, preventing conflicts between dependencies. You can use Anaconda or Python's built-in venv
module to create virtual environments.
NOTE: For Prompt Flow, Python needs to be >= 3.9 and < 3.12. (June 2024ZYZS)
-
Download and Install Anaconda:
- Visit the Anaconda Distribution page.
- Download the installer for your operating system.
- Follow the installation instructions on the Anaconda website. (Make sure to check the box that adds Anaconda to your system's PATH during installation)
-
Verify the Installation:
- Open your terminal and run:
conda --version
- This should display the version of Conda installed, confirming that Anaconda is correctly set up.
- Open your terminal and run:
-
Setting Up a Virtual Environment (Optional but Recommended):
-
Create a new virtual environment with Python 3.9 or later:
conda create --name myenv python=3.9 conda init
-
Restart VS Code or the terminal to activate the virtual environment.
-
Activate the virtual environment:
conda activate myenv
-
-
Download Python:
- Visit the Python Downloads page.
- Download the installer for Python 3.9 or later for your operating system.
- Follow the installation instructions on the Python website.
-
Verify the Installation:
- Open your terminal and run:
python --version
- This should display the version of Python installed, confirming that Python is correctly set up.
- Open your terminal and run:
Important Note:
Regardless of how you install Python (via Anaconda or directly), ensure that the Python executable is included in your system's PATH. This allows you to run Python commands from any terminal window.
Before beginning any development, install the Prompt Flow extension from the Visual Studio Marketplace to seamlessly integrate it into your development environment. This extension facilitates the creation and management of chat flows directly within your IDE.
Visit: Prompt Flow Extension
After installation, navigate to Quick Access | Install Dependencies in your IDE to prepare Python and the necessary Promptflow packages.
Before deploying any chat flows, ensure that all required dependencies are installed. This step is crucial for the smooth functioning of your chat flows.
Run in youtube-chat
and youtube-chat-v2
directories:
pip install -r requirements.txt
To interact with the LLM tool, you must establish a connection. There are two main types of connections:
- OpenAI: If you opt for the OpenAI connection type, you will need to create an OpenAI account. Visit OpenAI for more information.
- Azure OpenAI: Alternatively, if you choose this connection type, create an Azure OpenAI service first. For more details, please visit Azure OpenAI Service.
Here are the commands to set up these connections:
# Override keys with --set to avoid yaml file changes
# Create OpenAI connection
pf connection create --file openai.yaml --set api_key=<your_api_key> --name open_ai_connection
# Create Azure OpenAI connection
pf connection create --file azure_openai.yaml --set api_key=<your_api_key> api_base=<your_api_base> --name open_ai_connection
You can verify your connection setup using:
# Show registered connection
pf connection show --name open_ai_connection
Refer to the connections documentation and examples for further details.
To run the flow, use the following command:
pf flow test --flow ./youtube-chat --interactive
Ask it a question for it to answer by looking up a YouTube video, e.g., "What is Calum's latest video on SSW TV about?"