{"id":24282688,"url":"https://github.com/flozi00/o1-server","last_synced_at":"2025-10-02T20:31:24.567Z","repository":{"id":271265217,"uuid":"912748533","full_name":"flozi00/o1-server","owner":"flozi00","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-07T17:36:14.000Z","size":38,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-16T03:47:09.007Z","etag":null,"topics":["fastapi","llm","o1","openai","openai-api","reasoning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flozi00.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-01-06T10:10:03.000Z","updated_at":"2025-01-07T17:36:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"c8fb4f8f-655c-4a04-8838-cdffdba88e0c","html_url":"https://github.com/flozi00/o1-server","commit_stats":null,"previous_names":["flozi00/o1-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flozi00%2Fo1-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flozi00%2Fo1-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flozi00%2Fo1-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flozi00%2Fo1-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flozi00","download_url":"https://codeload.github.com/flozi00/o1-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235039185,"owners_count":18926301,"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":["fastapi","llm","o1","openai","openai-api","reasoning"],"created_at":"2025-01-16T03:35:49.817Z","updated_at":"2025-10-02T20:31:24.294Z","avatar_url":"https://github.com/flozi00.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Step-by-Step Reasoning API\n\nThis project provides an API that leverages large language models (LLMs) to perform complex reasoning tasks through a unique step-by-step approach. It uses a feedback-driven system to ensure accuracy and logical consistency. The API is built with FastAPI and is compatible with OpenAI's chat completion endpoint.\n\n## Features\n\n- **Step-by-Step Reasoning:** Breaks down complex problems into smaller, manageable steps.\n- **Feedback Mechanism:**  Integrates a rewarder model that provides feedback on each step, ensuring correctness.\n- **Logical/Analytical and Creative Task Handling:** Adapts the problem-solving strategy based on the nature of the task.\n- **OpenAI Compatibility:** Designed to work with models compatible with the OpenAI API interface.\n- **Streaming Support:** Offers streaming responses for real-time interaction.\n\n## Architecture\n\nThe core of the system is based on two main components:\n\n1.  **Reasoning Agent:** This component generates the step-by-step solution based on the provided prompt and system instructions.\n2.  **Rewarder Agent:** This component evaluates each step generated by the reasoning agent and provides feedback.\n\nThe system iteratively generates and evaluates steps until a complete and correct solution is reached.\n\n### System Message (`SYS_MSG`)\n\nThe `SYS_MSG` defines the framework for problem-solving. It outlines the process for both logical/analytical and creative tasks.\n\n**For Logical/Analytical Tasks:**\n\n-   **Problem Decomposition:** Clearly state the problem, list given information, constraints, missing information, and the expected output format.\n-   **Component Analysis:** Analyze primary, secondary, and implicit components, including their properties and dependencies.\n-   **Relationship Mapping:** Define direct, indirect, hierarchical, causal, and temporal relationships between components.\n-   **Comprehension Levels:** Understand the problem at literal, contextual, and abstract levels.\n-   **Solution Development:** List assumptions, detail solution steps with validation points, and define boundary conditions.\n-   **Solution Verification:** Ensure logical consistency, completeness, handle edge cases, and check for contradictions.\n\n**For Creative Tasks:**\n\n-   Focus on originality and innovation.\n-   Provide clear reasoning for creative choices.\n\n### Rewarder Message (`REWARDER`)\n\nThe `REWARDER` message defines the role of the rewarder agent, which is to critically rate each step provided by the user. The rewarder only responds with one of three options:\n\n-   **Correct:** If the step is logically sound.\n-   **Wrong:** If the step contains an error.\n-   **Too much information in one step. Split this up into smaller parts and think again:** If the step contains multiple facts or ideas that should be separated.\n\n## Setup\n\n### Prerequisites\n\n-   Python 3.9+\n-   An OpenAI-compatible API endpoint (e.g., a self-hosted LLM with an OpenAI-compatible interface).\n-   An API key for your LLM provider.\n\n**Set environment variables:**\n\n    Create a `.env` file in the project root directory and add the following:\n\n    ```\n    OAI_BASE_URL=\u003cyour_openai_compatible_api_base_url\u003e\n    OAI_KEY=\u003cyour_api_key\u003e\n    LLM_NAME=\u003cyour_model_name\u003e\n    ```\n    Replace the placeholders with your actual API base URL, API key, and the name of the LLM you want to use.\n\n### Running the API\n\n1.  **Start the FastAPI server using uvicorn:**\n\n    ```bash\n    uvicorn app:app --reload\n    ```\n\n    This will start the API server on `http://0.0.0.0:8000`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflozi00%2Fo1-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflozi00%2Fo1-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflozi00%2Fo1-server/lists"}