Environment variables
PAS2 supports environment variables for API authentication and configuration. Create a.env file in your project root:
.env
The
HF_ prefix is prioritized for Hugging Face Spaces deployment. The system also supports MISTRAL_API_KEY and OPENAI_API_KEY as fallback options.Configuration priority
PAS2 checks for API keys in the following order:Hugging Face environment variables
Environment variables with
HF_ prefix:HF_MISTRAL_API_KEYHF_OPENAI_API_KEY
Model configuration
PAS2 uses specific models for different tasks:Default models
- Mistral model:
mistral-large-latest- Used for paraphrase generation and response generation - OpenAI model:
o3-mini- Used as the judge model for hallucination detection
Paraphrase settings
Configure the number of paraphrases generated for each query:More paraphrases increase accuracy but also increase API costs and processing time.
Database configuration
PAS2 uses SQLite for persistent feedback storage:- Default path:
/data/feedback.db(Hugging Face Spaces) - Fallback path:
./temp_data/feedback.db(local development)
- Original queries and responses
- Paraphrased queries and responses
- Hallucination detection results
- User feedback
- Confidence scores and reasoning
Logging configuration
PAS2 includes built-in logging for debugging and monitoring:Performance tuning
Parallel processing
PAS2 usesThreadPoolExecutor for parallel API calls with a default maximum of 5 workers:
Progress tracking
Enable progress callbacks for real-time updates:Next steps
- API keys - Get your Mistral and OpenAI API keys
- Web interface - Learn how to use the web interface
- Python library - Use PAS2 as a Python library