This project is an open-source, locally run AI-assisted analysis tool powered by Ollama. The tool is designed to run AI-assisted analysis on an entire bibliography exported from Zotero. Users who want to use this tool should have Zotero installed and export a collection they want to perform the AI analysis on as a .csv file.
This tool is based on Ollama and is structured to work with bibliographic data exported from Zotero to query abstracts. This code can also be used to query other types of data in .csv or .xls format using the custom_analysis.py
file.
- Designed to work with Zotero exports (CSV/Excel).
- Uses replication to mitigate potential errors with a consensus-based approach.
- Maintains local control of data to ensure compliance with data-handling requirements.
- Provides an open-source, reproducible method for analysis.
Provide the text of an abstract. The tool will identify the urban planning theory used in the abstract. If no urban planning theory was used, it will say "none."
Provide the text of an abstract. The tool will identify three themes from the abstract.
Provide the text of an abstract. The tool will identify the methods used in the abstract.
Provide the text of an abstract. The tool will identify the results from the abstract.
Provide the text of an abstract. The tool will identify where the research was conducted. If no location is mentioned, it will say "none."
- Export from Zotero: Export the collection you want to analyze from Zotero as a CSV or Excel file.
- Run the Python files: Use the provided Python code to run a specific AI analysis on the exported file (e.g., methods, results, location).
- Analyze Results: The tool will process each item in the bibliography, using Ollama to extract specific data from the bibliographic items. The code uses replication to account for any potential errors, employing a consensus-based approach to pull data from the bibliographic items.
- Aggregate AI Results for Consensus: Run the
ai_response_aggregation.py
file to aggregate the AI responses and get the result of the consensus and a rating for how strong the consensus is.
graph LR
A[Start] --> B[Read CSV/Excel File]
B --> C[Initialize Responses List]
C --> D{Loop Through Runs}
D --> E[Run 1]
D --> F[Run 2]
D --> G[Run N]
E --> H{Loop Through Rows}
F --> H
G --> H
H --> I[Append Title and Abstract]
I --> J[Parse prompt]
J --> K[Send to AI Model]
K --> L[Receive Response]
L --> M[Append Response to List]
M --> H
H --> N[Ensure Correct Number of Elements]
N --> O[Create DataFrame]
O --> P[Write to Excel File]
P --> Q[End]
-
Navigate to the parent directory:
cd /path/to/your/directory
-
Create the virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install Requirements:
pip install -r requirements.txt
-
Install Chosen LLM:
ollama pull gemma2
- Open a terminal or command prompt.
- Navigate to the directory where you want to clone the repository:
cd /path/to/your/directory
- Clone the repository:
git clone https://github.com/hleve/AI_Analysis_Tool.git
- Navigate to the cloned repository directory:
cd AI_Analysis_Tool
-
Ensure the virtual environment is activated:
- On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Run the desired Python file:
python <filename>.py
Replace
<filename>
with the name of the Python file you want to run. For example, to runcustom_analysis.py
, use:python custom_analysis.py
-
Follow any additional prompts or instructions provided by the script to complete the analysis.