@@ -15,10 +15,10 @@ especially useful when you're working on multiple projects or tasks that require
1515different AI models.
1616
1717In each of your CodeGate workspaces, you can select the AI provider and model
18- combinations to use, even dynamically switching the active model based on file
19- types found in your prompt. Then, configure your AI coding tool to use the
20- CodeGate muxing endpoint ` http://localhost:8989/v1/mux ` as an OpenAI-compatible
21- API provider.
18+ combinations to use, even dynamically switching the active model based on the
19+ request type and file types found in your prompt. Then, configure your AI coding
20+ tool to use the CodeGate muxing endpoint ` http://localhost:8989/v1/mux ` as an
21+ OpenAI-compatible API provider.
2222
2323To change the model(s) currently in use, simply switch your active CodeGate
2424workspace.
@@ -38,9 +38,11 @@ flowchart LR
3838 CodeGate --> WS1
3939 CodeGate --> WS2
4040 CodeGate --> WS3
41- WS1 --> |api| LLM1
42- WS2 --> |api| LLM2
43- WS3 --> |api| LLM3
41+ WS1 --> |FIM requests| LLM1
42+ WS1 --> |Chat| LLM2
43+ WS2 --> |.md files| LLM2
44+ WS2 --> |.js files| LLM3
45+ WS3 --> |All prompts| LLM3
4446```
4547
4648## Use cases
@@ -109,21 +111,33 @@ workspace selection menu or the
109111In the ** Model Muxing** section, select the default ("catch-all") model to use
110112with the workspace.
111113
112- To assign a different model based on filename, click ** Add Filter** . In the
113- ** Filter by** column, enter a file name or extension string to match. This is a
114- simple substring match, wildcards are not supported. For example, to match
115- Python files, enter ` .py ` . Then select the model to use with that file type.
114+ To assign a different model based on request type or filename, click ** Add
115+ Filter** .
116+
117+ In the ** Request Type** column, select the type of prompt to match:
118+
119+ - ` FIM & Chat ` matches all prompt types
120+ - ` FIM ` matches fill-in-the-middle (completion) requests
121+ - ` Chat ` matches chat prompts
122+
123+ In the ** Filter by** column, enter a file name or extension string to match.
124+ This is an exact or ` endswith ` match, wildcards are not supported. For example,
125+ to match Python files, enter ` .py ` .
126+
127+ Finally, select the model to use for prompts that match the rule.
116128
117129Filter rules are evaluated top-down. CodeGate selects the active model for a
118130request using the first matching rule. If the prompt contains multiple files in
119131context, the first rule that matches _ any_ of the files is used. If no filter is
120132matched, the catch-all rule applies.
121133
134+ #### Example configuration
135+
122136<ThemedImage
123137 alt = ' An example showing several muxing rules for different file types'
124138 sources = { {
125139 light: useBaseUrl (' /img/features/muxing-rules-light.webp' ),
126- dark: useBaseUrl (' /img/quickstart /muxing-rules-dark.webp' ),
140+ dark: useBaseUrl (' /img/features /muxing-rules-dark.webp' ),
127141 }}
128142 title = ' Example muxing rules'
129143 width = { ' 800px' }
@@ -132,10 +146,13 @@ _An example showing several muxing rules for different file types_
132146
133147Breaking down the above example:
134148
135- - Markdown files (` .md ` ) use the gpt-4o-mini model from the OpenAI provider.
136- - JavaScript and TypeScript files (` .js ` and ` .ts ` , which also matches ` .jsx `
137- and ` .tsx ` ) use anthropic/claude-3.5-sonnet via OpenRouter.
138- - All other requests use Ollama.
149+ - Markdown files (` .md ` ) use the gpt-4o-mini model from the OpenAI provider for
150+ all request types.
151+ - Chat prompts for JavaScript files (` .js ` , but NOT ` .jsx ` ) use
152+ anthropic/claude-3.7-sonnet via OpenRouter.
153+ - FIM requests for all files (except ` .md ` since it's higher in the list) use
154+ Ollama with the qwen2.5-coder:1.5b model.
155+ - All other requests use anthropic/claude-3.5-sonnet via OpenRouter.
139156- A request containing both a JavaScript and Markdown file will match the ` .md `
140157 rule first and use OpenAI.
141158
0 commit comments