AI-powered tag suggestions for Zotero items using Azure OpenAI. Analyzes document metadata and full-text (PDFs, snapshots) to suggest relevant tags from your existing library tags. Very similar to https://github.com/dnnunn/zotero-auto-tagger, but I needed azure open-ai and didn't want a whole plugin just for this. So its just a script in windingwing/zotero-action-tags
- Zotero Actions and Tags plugin
- Azure OpenAI or Azure AI Foundry deployment (GPT-4 recommended)
- API key and endpoint
- API version
2024-12-01-previewor later
Really any model that supports structured responses should work, though you could cut out the structured bit and just prompt for the a list of tags. Pull requests to support other LLMs, or free ones are very much welcomed. Also any PRs for things like improving UI, chunking file reading, protections etc. Another good PR would be to have a list of tags to ignore, or even to port this to a standalone plugin.
- Edit the configuration at the top of
zotero-ai-tag-suggester.js:
let azureEndpoint = "https://YOUR-RESOURCE-NAME.openai.azure.com"; // make sure you trim your copied endpoint from foundry. It will have extra details.
let apiKey = "YOUR-AZURE-OPENAI-API-KEY-HERE";
let deploymentName = "gpt-4.1-mini";- Import the script into Zotero via the Actions and Tags plugin
Select an item in Zotero and run the script. It will:
- Extract text from PDFs/snapshots
- Analyze with Azure OpenAI
- Apply relevant tags (up to 8) from your existing library tags
- Tags starting with
_are excluded (in case you do things like automatic read/unread tags, or only want human labelled 'important' tags.)
includeFullText: true- Analyze full text (set tofalsefor metadata-only)maxFullTextLength: 12000- Character limit (~3000 tokens)aiTemperature: 0.1- Low for consistent resultsaiMaxTokens: 1000- Response token limit
If you want more than 8 tags, you may want to increase aiMaxTokens to allow for a longer response.