This application connects to a Bitbucket repository, retrieves repository data, and uses a pre-trained model from Hugging Face (Mistral-7B-Instruct-v0.2) to answer queries based on the repository content.
- app.py: Main application script that initializes the Bitbucket connection, retrieves repository data, and processes user queries using the Mistral-7B-Instruct-v0.2 model.
- requirements.txt: List of dependencies required to run the application.
- .env: Environment configuration file (not included in the repository; you need to create this with your specific configuration).
transformers
: Hugging Face Transformers library for model loading and processing.atlassian-python-api
: Python API client for Bitbucket.truststore
: Ensures SSL certificate validation.python-dotenv
: Loads environment variables from a.env
file.
Create a .env
file in the root directory of your project with the following variables:
BITBUCKET_URL=<your-bitbucket-url>
BITBUCKET_USERNAME=<your-bitbucket-username>
BITBUCKET_PASSWORD=<your-bitbucket-password>
PROJECT_KEY=<your-bitbucket-project-key>
REPO_SLUG=<your-bitbucket-repo-slug>
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Create and activate a virtual environment:
python3 -m venv myenv source myenv/bin/activate # On Windows, use `myenv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Set up your
.env
file with the necessary environment variables.
Run the application using the following command:
python app.py
Ensure your Bitbucket credentials and access token are correctly set in the .env
file. Verify the values of BITBUCKET_URL
, BITBUCKET_USERNAME
, and BITBUCKET_PASSWORD
.
If downloading the model during execution is problematic, pre-download the model files from Hugging Face and place them in the appropriate directory. Ensure the directory structure matches the expected format.
Verify your network connection and ensure that the Bitbucket server URL is accessible. Check if the BITBUCKET_URL
in your .env
file is correct and reachable.
Ensure SSL certificate validation by using the truststore
package. If you encounter SSL errors, check your certificate configurations and network settings.
Here's an example of how the .env
file should look:
BITBUCKET_URL=https://your-bitbucket-server-url
BITBUCKET_USERNAME=your-username
BITBUCKET_PASSWORD=your-password
PROJECT_KEY=your-project-key
REPO_SLUG=your-repo-slug
This example sets up the necessary environment variables to authenticate and connect to your Bitbucket repository.