{"id":17998868,"url":"https://github.com/rayeed221/openai-ollama-workflow","last_synced_at":"2026-02-11T13:33:36.061Z","repository":{"id":258863346,"uuid":"875801301","full_name":"Rayeed221/OpenAI-Ollama-Workflow","owner":"Rayeed221","description":"This Python project showcases an AI integration using both OpenAI’s API and local Ollama models to perform tasks such as crafting detailed prompts, enhancing outlines, and incorporating specific knowledge. It also includes a feature for storing the history of generated responses.","archived":false,"fork":false,"pushed_at":"2024-10-28T12:15:28.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-31T01:38:48.938Z","etag":null,"topics":["ai","ollama","openai-api","python","workflow"],"latest_commit_sha":null,"homepage":"","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/Rayeed221.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":"2024-10-20T21:22:18.000Z","updated_at":"2024-12-07T22:21:01.000Z","dependencies_parsed_at":"2024-10-28T13:37:05.770Z","dependency_job_id":null,"html_url":"https://github.com/Rayeed221/OpenAI-Ollama-Workflow","commit_stats":null,"previous_names":["rayeed221/openai-ollama-workflow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rayeed221/OpenAI-Ollama-Workflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeed221%2FOpenAI-Ollama-Workflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeed221%2FOpenAI-Ollama-Workflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeed221%2FOpenAI-Ollama-Workflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeed221%2FOpenAI-Ollama-Workflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rayeed221","download_url":"https://codeload.github.com/Rayeed221/OpenAI-Ollama-Workflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeed221%2FOpenAI-Ollama-Workflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272929998,"owners_count":25017057,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ai","ollama","openai-api","python","workflow"],"created_at":"2024-10-29T22:08:09.458Z","updated_at":"2026-02-11T13:33:36.032Z","avatar_url":"https://github.com/Rayeed221.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAI(API)-Ollama(Local)-Workflow\nThis Python project showcases an AI integration using both OpenAI’s API and local Ollama models to perform tasks such as crafting detailed prompts, enhancing outlines, and incorporating specific knowledge. It loops through local models and uses API calls to enhance the structure and content of a message. The script can be used to generate detailed outlines, improve textual data, and generate well-structured responses using several AI models.\n\n### Features\n- Local use of **Ollama** models (`qwen2.5:1.5b` and `llama3.2`) for creating prompts and outlines.\n- Integration with **OpenAI GPT-4o** and **GPT-4o-mini** for improving outlines and generating responses.\n- History of AI-generated content, including timestamps, in a local file.\n### Requirements\n- Python 3.7+\n- OpenAI Python SDK\n- Downloaded **ollama** models on PC\n- LangChain integration with **Ollama** models\n## Installation\n\n### Download Ollama models if you do not have one\n1) Go and download ollama from [here](https://ollama.com/)\n2) Browse models of Ollama from [here](https://ollama.com/library)\n3) To install `qwen2.5:1.5b` and `llama3.2` open your command prompt and enter the following command to strat/to download:\n```\nollama run llama3.2\n```\n\n4) Now, activate a virtual environment (if not already\nactivated):\n   - On Windows/Linux: ```python -m venv env```\n   - On macOS: ```source ./env/bin/activate```\n   - \n\n\n### Note:\n- Ensure you have the necessary permissions to install\npackages and activate virtual environments.\n- The script will loop through different stages of outline\ngeneration, improvement, and response creation, saving all\noutputs in a text file with timestamps within this folder.\n\n### Install Python Dependencies\nYou can install the required Python packages using `pip`:\n\n```python\npip install langchain_ollama\npip install openai\n```\n\n### Set your OpenAI API key\n\nReplace `\"YOUR_API_KEY\"` with your actual OpenAI API key in the code:\n\n```python\nclient = OpenAI(api_key = \"YOUR_API_KEY\")\n```\n\nThe code will interact with the following models:\n- **Qwen 2.5:1.5b** (for prompt and improving outline generation)\n- **Llama 3.2** (for adding information to the outline)\n- **GPT-4o-mini** (for improving outlines)\n- **GPT-4o** (for final response generation)\n\n\n### Saving output:\n\nThe script saves the generated response to a file `History.txt` in the specified folder. You can modify the file path by changing `FOLDER_ADDRESS` in the script.\n\n```python\nwith open(file = r\"FOLDER_ADDRESS\\History.txt\", mode = \"a\") as file:\n    present_time = datetime.now()\n    file.write(f\"Time {present_time}\\n\")\n    file.write(gpt4o_response)\n```\n\n### Enjoy changing and playng with the parameters and instructions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayeed221%2Fopenai-ollama-workflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frayeed221%2Fopenai-ollama-workflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayeed221%2Fopenai-ollama-workflow/lists"}