Skip to content

Commit ba5e369

Browse files
Initial documentation on debugging issues with clients (#1103)
Based on a recent experience with Coninue I think we should start documenting how the issue was solved to help the next person trying to debug a similar issue.
1 parent c17e719 commit ba5e369

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

docs/debugging_clients.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Debugging Clients (extensions)
2+
3+
CodeGate supports [different clients](https://docs.codegate.ai/integrations/) (extensions installed in a code editor).
4+
5+
Sometimes, there may be issues in the interaction between the client and CodeGate. If CodeGate is receiving the request correctly from the client, forwarding the request to the provider (LLM), and receiving the response from the provider, then the issue is likely in the client. Most commonly, the issue is a difference in the response sent by CodeGate and the one expected by the client.
6+
7+
To debug issues like the one mentioned above, a straightforward approach is removing CodeGate from the middle. Try the request directly to the provider (LLM) and compare the response with the one received from CodeGate. The following subsections will guide you on how to do this for different clients.
8+
9+
## Continue
10+
11+
As a prerequisite, follow [Continue's guide to build from source](https://docs.codegate.ai/integrations/) and be able to run Continue in debug mode. Depending on whether the issue was in a FIM or a Chat request, follow the corresponding subsection.
12+
13+
### FIM
14+
15+
The raw responses for FIM can be seen in the function `streamSse`.
16+
17+
https://github.com/continuedev/continue/blob/b6436dd84978c348bba942cc16b428dcf4235ed7/core/llm/stream.ts#L73-L77
18+
19+
Add a `console.log` statement to print the raw response inside the for-loop:
20+
```typescript
21+
console.log('Raw stream data:', value);
22+
```
23+
24+
Observe the differences between the response received from CodeGate and the one received directly from the provider.
25+
26+
Sample configuration for CodeGate:
27+
```json
28+
"tabAutocompleteModel": {
29+
"title": "CodeGate - Provider",
30+
"provider": "openai",
31+
"model": "<model>",
32+
"apiKey": "<insert-api-key-if-required>",
33+
"apiBase": "http://localhost:8989/<provider>"
34+
}
35+
```
36+
37+
Sample configuration calling the provider directly:
38+
```json
39+
"tabAutocompleteModel": {
40+
"title": "Provider",
41+
"provider": "openai",
42+
"model": "<model>",
43+
"apiKey": "<insert-api-key-if-required>",
44+
"apiBase": "<provider-url>"
45+
}
46+
```
47+
48+
Hopefully, there will be a difference in the response that will help you identify the issue.

0 commit comments

Comments
 (0)