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 7 |
+
|
| 8 |
+
This guide will get you up and running with **AnyCoder** in minutes.
|
| 9 |
+
|
| 10 |
+
## 1. Clone the Repository
|
| 11 |
+
```bash
|
| 12 |
+
git clone https://github.com/your-org/anycoder.git
|
| 13 |
+
cd anycoder
|
| 14 |
+
````
|
| 15 |
+
|
| 16 |
+
## 2. Install Dependencies
|
| 17 |
+
|
| 18 |
+
Make sure you have Python 3.9+ installed.
|
| 19 |
+
|
| 20 |
+
```bash
|
| 21 |
+
pip install --upgrade pip
|
| 22 |
+
pip install -r requirements.txt
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## 3. Set Environment Variables
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
export HF_TOKEN=<YOUR_HUGGINGFACE_TOKEN>
|
| 29 |
+
export OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
|
| 30 |
+
export GEMINI_API_KEY=<YOUR_GEMINI_API_KEY>
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
## 4. Run the App Locally
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
python app.py
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
Open [http://localhost:7860](http://localhost:7860) in your browser to access the UI.
|
| 40 |
+
|
| 41 |
+
## 5. Explore Features
|
| 42 |
+
|
| 43 |
+
* **Model selector**: Choose from Groq, OpenAI, Gemini, Fireworks, and HF models.
|
| 44 |
+
* **Input**: Enter prompts, upload files or images for context.
|
| 45 |
+
* **Generate**: View code, preview, and conversation history.
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
# docs/API\_REFERENCE.md
|
| 50 |
+
|
| 51 |
+
````markdown
|
| 52 |
+
# API Reference
|
| 53 |
+
|
| 54 |
+
This document describes the public Python modules and functions available in AnyCoder.
|
| 55 |
+
|
| 56 |
+
## `models.py`
|
| 57 |
+
|
| 58 |
+
### `ModelInfo` dataclass
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
@dataclass
|
| 62 |
+
class ModelInfo:
|
| 63 |
+
name: str
|
| 64 |
+
id: str
|
| 65 |
+
description: str
|
| 66 |
+
default_provider: str = "auto"
|
| 67 |
+
````
|
| 68 |
+
|
| 69 |
+
### `AVAILABLE_MODELS: List[ModelInfo]`
|
| 70 |
+
|
| 71 |
+
A list of supported models with metadata.
|
| 72 |
+
|
| 73 |
+
### `find_model(identifier: str) -> Optional[ModelInfo]`
|
| 74 |
+
|
| 75 |
+
Lookup a model by name or ID.
|
| 76 |
+
|
| 77 |
+
---
|
| 78 |
+
|
| 79 |
+
## `inference.py`
|
| 80 |
+
|
| 81 |
+
### `chat_completion(model_id: str, messages: List[Dict[str,str]], provider: Optional[str]=None, max_tokens: int=4096) -> str`
|
| 82 |
+
|
| 83 |
+
Send a one-shot chat completion request.
|
| 84 |
+
|
| 85 |
+
### `stream_chat_completion(model_id: str, messages: List[Dict[str,str]], provider: Optional[str]=None, max_tokens: int=4096) -> Generator[str]`
|
| 86 |
+
|
| 87 |
+
Stream partial generation results.
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## `hf_client.py`
|
| 92 |
+
|
| 93 |
+
### `get_inference_client(model_id: str, provider: str="auto") -> InferenceClient`
|
| 94 |
+
|
| 95 |
+
Creates an HF InferenceClient with provider routing logic.
|
| 96 |
+
|
| 97 |
+
---
|
| 98 |
+
|
| 99 |
+
# docs/ARCHITECTURE.md
|
| 100 |
+
|
| 101 |
+
```markdown
|
| 102 |
+
# Architecture Overview
|
| 103 |
+
|
| 104 |
+
Below is a high-level diagram of AnyCoder's components and data flow:
|
| 105 |
+
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
```
|
| 109 |
+
+------------+
|
| 110 |
+
| User |
|
| 111 |
+
+-----+------+
|
| 112 |
+
|
|
| 113 |
+
v
|
| 114 |
+
+---------+----------+
|
| 115 |
+
| Gradio UI (app.py)|
|
| 116 |
+
+---------+----------+
|
| 117 |
+
|
|
| 118 |
+
+------------------------+------------------------+
|
| 119 |
+
| | |
|
| 120 |
+
v v v
|
| 121 |
+
models.py inference.py plugins.py
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
(model registry) (routing & chat\_completion) (extension points)
|
| 125 |
+
\| | |
|
| 126 |
+
+---------------------+ +------------------------+
|
| 127 |
+
|
|
| 128 |
+
v
|
| 129 |
+
hf\_client.py deploy.py
|
| 130 |
+
(HF/OpenAI/Gemini/etc routing) (HF Spaces integration)
|
| 131 |
+
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
- **UI Layer** (`app.py` + Gradio): handles inputs, outputs, and state.
|
| 135 |
+
- **Model Registry** (`models.py`): metadata-driven list of supported models.
|
| 136 |
+
- **Inference Layer** (`inference.py`, `hf_client.py`): abstracts provider selection and API calls.
|
| 137 |
+
- **Extensions** (`plugins.py`): plugin architecture for community or custom integrations.
|
| 138 |
+
- **Deployment** (`deploy.py`): Helpers to preview in an iframe or push to Hugging Face Spaces.
|
| 139 |
+
|
| 140 |
+
This separation ensures modularity, testability, and easy extensibility.
|
| 141 |
+
|
| 142 |
+
```
|