You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can control the technique you use for optimization by prepending the slug to the model name `{slug}-model-name`. E.g. in the above code we are using `moa` or
74
+
You can control the technique you use for optimization by prepending the slug to the model name `{slug}-model-name`. E.g. in the above code we are using `moa` or
74
75
mixture of agents as the optimization approach. In the proxy logs you will see the following showing the `moa` is been used with the base model as `gpt-4o-mini`.
75
76
76
77
```bash
@@ -83,20 +84,86 @@ mixture of agents as the optimization approach. In the proxy logs you will see t
83
84
84
85
## Implemented techniques
85
86
86
-
| Technique | Slug | Description |
87
-
|-----------|----------------|-------------|
88
-
| Agent |`agent `| Determines which of the below approaches to take and then combines the results |
89
-
| Monte Carlo Tree Search |`mcts`| Uses MCTS for decision-making in chat responses |
90
-
| Best of N Sampling |`bon`| Generates multiple responses and selects the best one |
91
-
| Mixture of Agents |`moa`| Combines responses from multiple critiques |
92
-
| Round Trip Optimization |`rto`| Optimizes responses through a round-trip process |
93
-
| Z3 Solver |`z3`| Utilizes the Z3 theorem prover for logical reasoning |
94
-
| Self-Consistency |`self_consistency`| Implements an advanced self-consistency method |
95
-
| PV Game |`pvg`| Applies a prover-verifier game approach at inference time |
96
-
| R* Algorithm |`rstar`| Implements the R* algorithm for problem-solving |
97
-
| CoT with Reflection |`cot_reflection`| Implements chain-of-thought reasoning with \<thinking\>, \<reflection> and \<output\> sections |
98
-
| PlanSearch |`plansearch`| Implements a search algorithm over candidate plans for solving a problem in natural language |
99
-
| LEAP |`leap`| Learns task-specific principles from few shot examples |
|`--approach`| Inference approach to use |`"auto"`|
109
+
|`--simulations`| Number of MCTS simulations | 2 |
110
+
|`--exploration`| Exploration weight for MCTS | 0.2 |
111
+
|`--depth`| Simulation depth for MCTS | 1 |
112
+
|`--best-of-n`| Number of samples for best_of_n approach | 3 |
113
+
|`--model`| OpenAI model to use |`"gpt-4o-mini"`|
114
+
|`--base-url`| Base URL for OpenAI compatible endpoint |`""`|
115
+
|`--rstar-max-depth`| Maximum depth for rStar algorithm | 3 |
116
+
|`--rstar-num-rollouts`| Number of rollouts for rStar algorithm | 5 |
117
+
|`--rstar-c`| Exploration constant for rStar algorithm | 1.4 |
118
+
|`--n`| Number of final responses to be returned | 1 |
119
+
|`--return-full-response`| Return the full response including the CoT with <thinking> tags |`False`|
120
+
|`--port`| Specify the port to run the proxy | 8000 |
121
+
|`--api-key`| Optional API key for client authentication to optillm |`""`|
122
+
123
+
When using Docker, these can be set as environment variables prefixed with `OPTILLM_`.
124
+
125
+
## Running with Docker
126
+
127
+
optillm can optionally be built and run using Docker and the provided [Dockerfile](./Dockerfile).
128
+
129
+
### Using Docker Compose
130
+
131
+
1. Make sure you have Docker and Docker Compose installed on your system.
132
+
133
+
2. Either update the environment variables in the docker-compose.yaml file or create a `.env` file in the project root directory and add any environment variables you want to set. For example, to set the OpenAI API key, add the following line to the `.env` file:
134
+
135
+
```bash
136
+
OPENAI_API_KEY=your_openai_api_key_here
137
+
```
138
+
139
+
3. Run the following command to start optillm:
140
+
141
+
```bash
142
+
docker compose up -d
143
+
```
144
+
145
+
This will build the Docker image if it doesn't exist and start the optillm service.
146
+
147
+
4. optillm will be available at `http://localhost:8000`.
148
+
149
+
When using Docker, you can set these parameters as environment variables. For example, to set the approach and model, you would use:
150
+
151
+
```bash
152
+
OPTILLM_APPROACH=mcts
153
+
OPTILLM_MODEL=gpt-4
154
+
```
155
+
156
+
To secure the optillm proxy with an API key, set the `OPTILLM_API_KEY` environment variable:
157
+
158
+
```bash
159
+
OPTILLM_API_KEY=your_secret_api_key
160
+
```
161
+
162
+
When the API key is set, clients must include it in their requests using the `Authorization` header:
0 commit comments