{"id":29345577,"url":"https://github.com/ayushmodi001/opportunity_lens_model","last_synced_at":"2026-05-20T10:02:24.076Z","repository":{"id":301885832,"uuid":"1007003225","full_name":"ayushmodi001/opportunity_lens_model","owner":"ayushmodi001","description":"A high-performance multiple-choice question generator powered by Phi-3 LLM. Features: • Generates 10 validated MCQs per request • GPU-accelerated with CUDA support • Local deployment with Ollama • AWS Lambda ready • Automatic format validation • Configurable difficulty levels Tech: Python, Ollama, FastAPI","archived":false,"fork":false,"pushed_at":"2025-06-29T11:53:52.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-29T12:29:35.266Z","etag":null,"topics":["ollama","phi-3","python-3"],"latest_commit_sha":null,"homepage":"https://opportunitylens.vercel.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ayushmodi001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-23T10:11:49.000Z","updated_at":"2025-06-29T11:57:48.000Z","dependencies_parsed_at":"2025-06-29T12:40:15.367Z","dependency_job_id":null,"html_url":"https://github.com/ayushmodi001/opportunity_lens_model","commit_stats":null,"previous_names":["ayushmodi001/opportunity_lens_model"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ayushmodi001/opportunity_lens_model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushmodi001%2Fopportunity_lens_model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushmodi001%2Fopportunity_lens_model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushmodi001%2Fopportunity_lens_model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushmodi001%2Fopportunity_lens_model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayushmodi001","download_url":"https://codeload.github.com/ayushmodi001/opportunity_lens_model/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushmodi001%2Fopportunity_lens_model/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264295471,"owners_count":23586523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ollama","phi-3","python-3"],"created_at":"2025-07-08T15:28:45.712Z","updated_at":"2026-05-20T10:02:23.967Z","avatar_url":"https://github.com/ayushmodi001.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phi-3 Question Generator API\n\nA fast and efficient multiple-choice question generator using the Phi-3 language model, optimized for performance and reliability.\n\n## Features\n\n- Generates high-quality multiple-choice questions (MCQs)\n- Optimized for both cloud and local environments\n- CUDA support for faster generation\n- Automatic validation and quality control\n- Configurable difficulty levels\n- No external API dependencies\n\n## Prerequisites\n\n- Python 3.12+\n- Ollama installed and running locally\n- Required Python packages (install via `requirements.txt`)\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone \u003cyour-repo-url\u003e\ncd phi3_model\n```\n\n2. Create and activate a virtual environment:\n```bash\npython -m venv myvenv\n./myvenv/Scripts/Activate.ps1  # For PowerShell\n```\n\n3. Install dependencies:\n```bash\npip install -r requirements.txt\n```\n\n4. Ensure Ollama is installed and running with the phi3 model:\n```bash\nollama run phi3:3.8b\n```\n\n## API Usage\n\n### Generate Questions\n\nEndpoint: `/generate`\nMethod: `POST`\n\nRequest Body:\n```json\n{\n    \"topic\": \"string\",           // The topic to generate questions about\n    \"proficiency_level\": \"string\" // Difficulty level (e.g., \"beginner\", \"intermediate\", \"advanced\")\n}\n```\n\nExample Response:\n```json\n{\n    \"questions\": [\n        {\n            \"question\": \"What is the capital of France?\",\n            \"options\": [\n                \"London\",\n                \"Berlin\",\n                \"Madrid\",\n                \"Paris\"\n            ],\n            \"correct_answer\": \"Paris\"\n        },\n        // ... more questions\n    ]\n}\n```\n\n### Question Format\n\nEach generated question follows a strict format:\n1. Question text starting with \"Q1:\", \"Q2:\", etc.\n2. Exactly 4 options labeled as \"A)\", \"B)\", \"C)\", \"D)\"\n3. One correct answer marked with (✓)\n4. Each option on a new line\n\n### Configuration Options\n\nModel configuration can be customized in `model.py`:\n\n```python\n{\n    \"num_predict\": 1024,     # Token prediction limit\n    \"temperature\": 0.8,      # Control randomness (0.0-1.0)\n    \"top_p\": 0.9,           # Nucleus sampling parameter\n    \"cuda\": true,           # Enable GPU acceleration\n    \"num_thread\": 6,        # Number of CPU threads\n    \"batch_size\": 8,        # Batch size for generation\n    \"gpu_layers\": 24,       # Number of GPU layers\n    \"ctx_size\": 1024       # Context window size\n}\n```\n\n## Performance Optimization\n\nThe system automatically detects and optimizes for:\n- CUDA availability for GPU acceleration\n- Cloud vs local environment\n- Available CPU cores\n- Memory constraints\n\n## Error Handling\n\nThe API includes:\n- Automatic retry mechanism (up to 3 attempts)\n- Input validation\n- Question format verification\n- Duplicate question detection\n- Service status monitoring\n\n## Logging\n\nComprehensive logging is available with:\n- Generation timing\n- Success/failure status\n- Question validation results\n- System configuration details\n\n## Environment Variables\n\nOptional environment variables:\n- `AWS_LAMBDA_FUNCTION_NAME`: Detected for cloud deployment\n- Custom configuration can be added through environment variables\n\n## Development\n\nTo run in development mode:\n```bash\nuvicorn main:app --reload\n```\n\nTo run tests:\n```bash\npytest tests/\n```\n\n## License\n\n[Your chosen license]\n\n## Contributing\n\n[Your contribution guidelines]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayushmodi001%2Fopportunity_lens_model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayushmodi001%2Fopportunity_lens_model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayushmodi001%2Fopportunity_lens_model/lists"}