Skip to content

Commit 0a3aad5

Browse files
committed
added o1 support
1 parent e2d856f commit 0a3aad5

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

.vscode/extensions.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
// See http://go.microsoft.com/fwlink/?LinkId=827846
33
// for the documentation about the extensions.json format
4-
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint",
6+
"amodio.tsl-problem-matcher",
7+
"carusyte.gai-choy"
8+
]
59
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.4.0] - 2025-03-10
9+
10+
- Added support for o1 model.
11+
812
## [0.3.0] - 2024-11-13
913

1014
- Added support for o1-preview and o1-mini models.

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "GAI Choy",
44
"description": "G̲enerative A̲I̲ empowered, C̲ode H̲elper O̲n Y̲our side. Yet another Copilot for coding, with built-in integration capability with Azure OpenAI models or, local LLM such as CodeShell.",
55
"publisher": "carusyte",
6-
"version": "0.3.0",
6+
"version": "0.4.0",
77
"icon": "assets/logo.png",
88
"pricing": "Free",
99
"keywords": [
@@ -64,7 +64,8 @@
6464
"gpt-4-32k",
6565
"gpt-4o",
6666
"o1-mini",
67-
"o1-preview"
67+
"o1-preview",
68+
"o1"
6869
],
6970
"type": "string",
7071
"order": 4
@@ -79,7 +80,8 @@
7980
"gpt-4-32k",
8081
"gpt-4o",
8182
"o1-mini",
82-
"o1-preview"
83+
"o1-preview",
84+
"o1"
8385
],
8486
"type": "string",
8587
"order": 5
@@ -110,7 +112,9 @@
110112
"2024-02-01",
111113
"2024-05-01-preview",
112114
"2024-08-01-preview",
113-
"2024-10-21"
115+
"2024-10-21",
116+
"2024-12-01-preview",
117+
"2025-01-01-preview"
114118
],
115119
"type": "string",
116120
"order": 8

src/RequestEventStream.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export async function postEventStream(prompt: string, chatList: Array<ChatItem>,
6969
temperature: 0.8,
7070
messages: [
7171
{
72-
role: model === "o1-preview" ? "user" : "system",
72+
role: (/^o1(-.*)?$/.test(model)) ? "user" : "system",
7373
// "content": `
7474
// Your role is an AI pair programming assistant and technical consultant, a programming expert with strong coding skills.
7575
// Your task is to answer questions raised by the user as a developer.
@@ -95,7 +95,7 @@ export async function postEventStream(prompt: string, chatList: Array<ChatItem>,
9595

9696
AzureOAI.mergeParameters(body, parameters)
9797

98-
if (model === "o1-preview") {
98+
if (/^o1(-.*)?$/.test(model)) {
9999
delete body.temperature // this parameter is not supported by o1 model
100100
}
101101

src/llm/AzureOAI.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class AzureOAI {
5050
"temperature": 0.2,
5151
"messages": [
5252
{
53-
"role": model === "o1-preview" ? "user": "system",
53+
"role": (/^o1(-.*)?$/.test(model)) ? "user": "system",
5454
"content": `Your role is an AI code generator. Your name is "GAI Choy".
5555
Your task is to provide executable and functional code fragments AS-IS, based on the context provided by the user.
5656
The context and metadata of the code fragment will be provided by user in the following format, as surrounded by triple-backticks.
@@ -120,7 +120,7 @@ Expected response in JSON format:
120120
...data, response_format: { type: 'json_object' }
121121
} : data
122122

123-
if (model === "o1-preview") {
123+
if (/^o1(-.*)?$/.test(model)) {
124124
delete data.temperature // this parameter is not supported by o1 model
125125
}
126126

0 commit comments

Comments
 (0)