Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview #1393

Merged
merged 580 commits into from
May 30, 2024
Merged

Preview #1393

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
580 commits
Select commit Hold shift + click to select a range
eaf1a2b
Merge branch '📝-rename-googlepalmapi.md-to-googlegeminiapi.md' of htt…
sestinj May 3, 2024
2fa3885
Merge branch 'pzaback-📝-rename-googlepalmapi.md-to-googlegeminiapi.md…
sestinj May 3, 2024
98f6145
Nate/autocomplete-metrics (#1230)
sestinj May 4, 2024
3c954dd
Active file default context (#1231)
sestinj May 4, 2024
1fbc506
🎨 finish listDir
sestinj May 4, 2024
6dff57d
🚧 gui fixes
sestinj May 4, 2024
b7a7ed4
🏷️ update IMessenger.on return type
sestinj May 4, 2024
782e550
🐛 fix jetbrains types + IDE detection
sestinj May 4, 2024
f39388a
🧑‍💻 set up debugging for binary with TcpMessenger
sestinj May 4, 2024
aae1e3c
👷 fix prepackage.js
sestinj May 5, 2024
41984b5
🧑‍💻 turn off debug mode for intellij
sestinj May 5, 2024
a3dc140
Merge branch 'preview' into nate/refactor-core
sestinj May 5, 2024
d8f9264
🐛 merge fixes
sestinj May 5, 2024
f91ac82
🐛 fixes after refactor
sestinj May 5, 2024
eee2461
🚧 experimenting with perplexity style streaming
sestinj May 6, 2024
ae180c6
:bug: fix #1237
5eqn May 6, 2024
68b7962
💚 fix type error
sestinj May 6, 2024
e05cac9
⚡️ improve LSP usage in autocomplete
sestinj May 6, 2024
f314198
Merge branch 'fix-edit-prompt' of https://github.com/5eqn/continue in…
sestinj May 6, 2024
0c642b1
🐛 fix content parsing regression in /edit
sestinj May 6, 2024
e15259d
Merge branch '5eqn-fix-edit-prompt' into preview
sestinj May 6, 2024
7f05366
add PySide6 docs to preindexed docs (#1236)
pixelsortr May 6, 2024
6803dc5
CON-232 bring custom docs to top, alphabetize doc results, make scrol…
justinmilner1 May 6, 2024
7dd2d6f
CON-1067 condense some things
May 6, 2024
2d06910
🚚 [Auxiliary -> Continue] Sidebar
sestinj May 6, 2024
c3971a4
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 6, 2024
4160ca6
🔊 log completion options in ~/.continue/sessions
sestinj May 6, 2024
344b23d
CON-1067 wrong ret val fix
May 6, 2024
4ae128f
CON-1067: fixes from testing
May 6, 2024
2b302d9
⚡️ filter out completions that are only punctuation/space
sestinj May 7, 2024
8668308
⚡️ inject intellisense docs, no multi-line on comments
sestinj May 7, 2024
671b98c
⚡️ crawl type definitions for autocomplete
sestinj May 7, 2024
c2cb6f4
⚡️ truncate function text
sestinj May 7, 2024
52b99dc
⚡️ cache LSP calls
sestinj May 7, 2024
07b3aba
⚡️ find recently edited ranges with perfect prefix match
sestinj May 7, 2024
9e1027a
🐛 fix gif paths
sestinj May 7, 2024
c88d222
⚡️ bring back double new line stop words
sestinj May 7, 2024
6e1dcb8
📌 add yarn lock files
sestinj May 7, 2024
0cd017b
🐛 allow language keywords to be generated
sestinj May 7, 2024
81e0e0c
💄 toggle on help button
sestinj May 7, 2024
370e610
🎨 defaultContext option
sestinj May 7, 2024
3749a8c
🐛 fix lancedb bug by upgrading
sestinj May 7, 2024
b6a5391
🐛 fix groq stop tokens
sestinj May 7, 2024
8117abc
🐛 preventDefault to avoid double paste
sestinj May 8, 2024
d117d7f
🚸 don't repeatedly override cmd+J
sestinj May 8, 2024
44e90ef
🧑‍💻 fix npm run test in core
sestinj May 8, 2024
0dbb4cc
📝 change description
sestinj May 8, 2024
f71af40
🐛 silence Ollama invalid server state warning
sestinj May 8, 2024
989fcd5
Merge branch 'main' into preview
sestinj May 8, 2024
241fdbc
⚡️ more accurate getTerminalContents
sestinj May 8, 2024
29bb218
⚡️ make getTerminalContents more accurate
sestinj May 8, 2024
e75a465
Merge
sestinj May 8, 2024
b99fcbc
🧑‍💻 use yarn instead of npm
sestinj May 9, 2024
8a2e18a
👷 fix yarn add --no-save in prepackge
sestinj May 9, 2024
f641a2b
🐛 correctly read entire notebook file contents
sestinj May 9, 2024
1f49397
➕ import handlebars
sestinj May 9, 2024
0101e6f
🔥 remove unnecessary migrations
sestinj May 9, 2024
8daf2c1
⚡️ improve /comment prompt
sestinj May 10, 2024
6a10a8e
Add debug terminal context menu (#1261)
djgould May 10, 2024
7908d75
Add --no-dependencies to vsce package (#1255)
djgould May 10, 2024
aaeaccd
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 10, 2024
cfcd740
ui: change line decoration color to use vscode theme (#1253)
d-mahard May 10, 2024
c532bd2
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 10, 2024
46fa021
Merge branch 'CON-1067-failed-indexing-state' of https://github.com/j…
sestinj May 10, 2024
2ba1263
🎨 refactor indexing state into a single object
sestinj May 10, 2024
1de0d8a
CON-223 Correct diff streaming abort (#1263)
justinmilner1 May 10, 2024
74c21be
📦 switch to pnpm (#1265)
sestinj May 11, 2024
19682cd
🐛 add powershell to extension mapping, and default to ext
sestinj May 11, 2024
8e18355
Add stream support for Bedrock Anthropic
May 11, 2024
ab7bcb0
🎨 make llamatokenizer commonjs compatible
sestinj May 11, 2024
6776a12
➕ add esbuild optional deps
sestinj May 11, 2024
d775919
🚚 rename vendor/node_modules -> modules
sestinj May 11, 2024
31226a3
🔖 update core version
sestinj May 11, 2024
2cac5c8
🐛 fixes for transformers.js compatibility
sestinj May 11, 2024
e3dc72b
🔖 update core version
sestinj May 11, 2024
ab49433
🎨 set modelPath in constructor
sestinj May 12, 2024
81b95eb
🎨 fix transformers.js import
sestinj May 12, 2024
89a6957
🎨 eslint enforce import extensions
sestinj May 12, 2024
778ceca
🎨 require -> import
sestinj May 12, 2024
a707eae
🚸 notify user if not diff in /commit
sestinj May 13, 2024
6e9a56b
💄 Improve colors of the IntelliJ tool window icon (#1273)
tnglemongrass May 13, 2024
83e2bba
Merge branch 'preview' of https://github.com/KoStard/continue into Ko…
sestinj May 13, 2024
034754c
✨ send Bearer token to Ollama if apiKey set
sestinj May 13, 2024
61d472f
🐛 fix slash command bug
sestinj May 13, 2024
ed9bf43
🧑‍💻 add onnxruntime (--save-dev) for types
sestinj May 13, 2024
b2d983e
🐛 don't apply to file when running code block in terminal
sestinj May 13, 2024
0dd4ae9
🐛 avoid double paste
sestinj May 13, 2024
8b50a2b
✨ gpt-4o
sestinj May 13, 2024
96dc066
🎨 pass uniqueId to constructor
sestinj May 13, 2024
781f713
🚸 focus without scrolling into vie
sestinj May 14, 2024
ae05da6
🎨 refactoring for continue-proxy LLM (#1277)
sestinj May 14, 2024
a672f80
🐛 continue server client fixes
sestinj May 14, 2024
fb2dca8
🎨 refactor OpenAI _getHeaders
sestinj May 14, 2024
7d5dc49
🎨 pass ideSettings to llmFromDescription
sestinj May 14, 2024
17a08b4
⚡️ improve add docstring command
sestinj May 14, 2024
e877f8a
💚 ci updates
sestinj May 14, 2024
3355d18
Merge branch 'preview' into nate/refactor-core
sestinj May 15, 2024
78cb6a2
🐛 merge fixes
sestinj May 15, 2024
41a9fbc
💄 increase font size in JB
sestinj May 15, 2024
c3fd16b
🐛 fix repeated paste bug
sestinj May 15, 2024
877c13d
🐛 fix build script
sestinj May 15, 2024
abd1ef6
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 15, 2024
0eed7a0
🩹 various small improvements
sestinj May 15, 2024
5e9d28e
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 15, 2024
491d9bf
📌 pin esbuild 0.17.19
sestinj May 15, 2024
5a4cc2b
🧑‍💻 pnpm i gui in prepackage
sestinj May 15, 2024
b5052a3
🐛 show all diff changes in vscode
sestinj May 15, 2024
3f83c6a
🩹 getMetaKeyName
sestinj May 15, 2024
6f962b3
🐛 fix reading of unopened ipynb files
sestinj May 15, 2024
bc5a6f6
⚡️ gpt-4o system prompt
sestinj May 15, 2024
7857c4c
💄 make font size configurable in config.json ui.fontSize
sestinj May 15, 2024
3b45028
🩹 properly dispose of diff handler
sestinj May 16, 2024
be741ac
🐛 fix indexing status display
sestinj May 16, 2024
b670949
⚡️ context pruning
sestinj May 17, 2024
9a9b7ba
🎨 update free trial models
sestinj May 17, 2024
9f160ad
fix: remove some backup files generated by pkg if present (#1287)
fernandosanchezjr May 17, 2024
4e33901
Merge branch 'main' into preview
sestinj May 17, 2024
7fde022
adjust toCopy (#1305)
justinmilner1 May 17, 2024
bc93e4a
Nate/prompt-file (#1308)
sestinj May 17, 2024
c52b6e7
🔥 remove hello from continuerc.json
sestinj May 18, 2024
d73783e
🔥 remove example files
sestinj May 18, 2024
cf12e2a
🎨 update test prompt
sestinj May 18, 2024
2723923
🎨 update prompt
sestinj May 18, 2024
e33895d
🎨 update test prompt
sestinj May 18, 2024
430c6fe
👷 create out/node_modules in prepackage.js
sestinj May 18, 2024
b8221eb
Log prompt-tokens to devdb and show in 'My Usage' view (#1309)
tijszwinkels May 18, 2024
1b49dfb
🔥 remove console logs
sestinj May 18, 2024
1a6710d
add lm studio tab-autocomplete walkthrough (#1298)
mrdjohnson May 18, 2024
72e585a
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 18, 2024
5b4cc55
📝 update autocomplete LM Studio docs
sestinj May 18, 2024
f86e339
💚 fix prepackage.js
sestinj May 18, 2024
911c39b
⬆️ upgrade lancedb version
sestinj May 18, 2024
7fc6644
🚸 make it easier to continue past trial
sestinj May 18, 2024
630e5e9
🚸 improve model setup process
sestinj May 18, 2024
a533668
📌 update package-lock.jsons
sestinj May 18, 2024
696a955
Merge branch 'preview' into nate/refactor-core
sestinj May 19, 2024
7da39cf
🔀 merge changes
sestinj May 19, 2024
4fdae27
🩹 small fixes
sestinj May 19, 2024
27470eb
🐛 fix jetbrains build
sestinj May 19, 2024
b0397f4
🩹 more jetbrains fixes
sestinj May 19, 2024
ae75627
🎨 jetbrains improvements
sestinj May 19, 2024
d8c3b98
🐛 fix lancedb prob in jetbrains build
sestinj May 19, 2024
df68e86
👷 update jetbrains build process
sestinj May 19, 2024
95cd223
✨ intellij problems context provider
sestinj May 20, 2024
e9d0599
👷 add script utils file
sestinj May 20, 2024
609e4e6
💚 fix jetbrains build regression
sestinj May 20, 2024
b7bb1a5
🎨 dynamic import transformers.js
sestinj May 20, 2024
50f7978
🩹 small jetbrains updates
sestinj May 20, 2024
ae8ccc1
✨ folder context provider in jetbrains
sestinj May 20, 2024
ec8f40a
🎨 many more jetbrains improvements
sestinj May 20, 2024
06da0ca
🐛 fix prompt file loading bug
sestinj May 20, 2024
7cecbcc
docs: add setup guide for OpenRouter (#1284)
sambarnes May 20, 2024
ebc02fe
Update preIndexedDocs.ts (#1292)
JoseVega May 20, 2024
25d9e37
add toString (#1324)
justinmilner1 May 20, 2024
6f8528a
don't overwrite all models in onboarding
sestinj May 20, 2024
59ca138
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 20, 2024
de0dc3d
Merge branch 'preview' of https://github.com/KoStard/continue into pr…
sestinj May 20, 2024
75c5e0b
Merge branch 'KoStard-preview' into preview
sestinj May 20, 2024
e150f7d
🔧 override headers with custom headers
sestinj May 20, 2024
4523fe6
✨ allow overwriting slash command description
sestinj May 20, 2024
424f7d5
feature flag (#1327)
sestinj May 21, 2024
2509dd5
👷 remove win32-arm64 target
sestinj May 21, 2024
90fe570
Update build.js (#1330)
JoseVega May 21, 2024
f6fedfc
📌 pin onnxruntime version to match transformers.js
sestinj May 21, 2024
f3744d8
Merge branch 'preview' into nate/refactor-core
sestinj May 21, 2024
226144b
🎨 transformers cleanup, extensionVersion header
sestinj May 21, 2024
f3b7c1a
Merge branch 'main' into preview
sestinj May 21, 2024
baa0c26
🔥 remove lingering pnpm
sestinj May 21, 2024
f1fcb91
🎨 update default models
sestinj May 21, 2024
87bcecc
🎨 update defaults
sestinj May 21, 2024
aed0d86
👷 fix version in build post-check
sestinj May 21, 2024
4c03dab
Merge branch 'main' into preview
sestinj May 21, 2024
63e70e5
🎨 test.js in dev
sestinj May 21, 2024
b57b48a
🧑‍💻 cleaning
sestinj May 22, 2024
fee942e
Add Gemini 1.5 Flash as a model (#1337)
HackyRoot May 22, 2024
fbf7aba
🎨 log dev data for tokens generated
sestinj May 23, 2024
167b1a3
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 23, 2024
2e1c2f5
Expose custom context provider registration through a vscode extensio…
samelhusseini May 23, 2024
2664800
Merge branch 'main' into preview
sestinj May 23, 2024
045d98f
Merge branch 'preview' into nate/refactor-core
sestinj May 23, 2024
89549d6
🔀 merge fixes
sestinj May 23, 2024
a364ceb
⚡️ small improvements
sestinj May 23, 2024
4e5b116
🎨 tell users transformers.js not supported
sestinj May 23, 2024
e840140
🎨 trial updates
sestinj May 23, 2024
efeb582
📝 update jetbrains readmej
sestinj May 23, 2024
e26da7a
⚡️ Use gptEditPrompt for Mistral
sestinj May 24, 2024
5c4e512
✨ Codestral FIM
sestinj May 24, 2024
4231215
🔖 update gradle version
sestinj May 24, 2024
b482bbc
Merge branch 'main' into preview
sestinj May 24, 2024
1ca28ed
Fix typo "Experimantal" (#1353)
pzaback May 25, 2024
53b6128
🎨 Refactor core (#1281)
sestinj May 25, 2024
e007efb
⚡️ improved autocomplete stopping
sestinj May 25, 2024
2a0f6fe
🎨 count cmd+I
sestinj May 25, 2024
6397536
Merge branch 'main' into preview
sestinj May 25, 2024
6e47079
🔥 remove duplicate import
sestinj May 25, 2024
7d50f5f
🔥 remove unnecessary headers
sestinj May 25, 2024
10f6920
Merge branch 'main' into preview
sestinj May 25, 2024
9de68ac
⚡️ limit input history length
sestinj May 25, 2024
31f04b4
⚡️ limit submenu items until you can use disk-based search, to avoid …
sestinj May 25, 2024
f0b2060
🔥 remove duplicate function def
sestinj May 25, 2024
683d53b
Free Trial Auth (#1367)
sestinj May 26, 2024
044827b
⚡️ autocomplete stopping improvements
sestinj May 26, 2024
42aad40
🔥 remove unused auth code
sestinj May 26, 2024
129239b
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 26, 2024
664adc3
⚡️ consider previous completion in bracket matching
sestinj May 27, 2024
645d267
Build fixes: Remove duplicated code, re-add overwritten commit (#1358)
justinmilner1 May 27, 2024
98d474d
📝 update keywords
sestinj May 27, 2024
db14578
✨ /commit slash command
sestinj May 27, 2024
04d4245
🎨 make transformers.js esm compatible
sestinj May 27, 2024
12fb5d4
⚡️ fix jetbrains indexing perfomance issue
sestinj May 28, 2024
4f9b4e4
💄 autocomplete model onboarding
sestinj May 28, 2024
feac75c
✨ mistral free trial autocomplete
sestinj May 28, 2024
0b28572
✨ mistral description
sestinj May 28, 2024
507010b
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
4c19a6e
🩹 comment out fireworks.png
sestinj May 28, 2024
e289267
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
44e75aa
🎨 trial fim model
sestinj May 28, 2024
6536fad
🎨 get gh token for autocomplete model trial
sestinj May 28, 2024
5462c4d
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
04481c4
✨ gh auth token jb
sestinj May 28, 2024
7b62d76
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
69572b3
🔧 update config files
sestinj May 28, 2024
94c8206
🎨 jetbrains onboarding
sestinj May 28, 2024
145ad30
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
759ba12
🧑‍💻 create gui/dist if it doesn't exist
sestinj May 28, 2024
b70552a
Fix sidebar indexing status timing-related bugs (#1368)
justinmilner1 May 28, 2024
9907807
🚸 help user avoid login prompt if unwanted
sestinj May 28, 2024
695eab1
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 28, 2024
e349e76
🚸 update onboarding flow
sestinj May 28, 2024
7a9c0c0
📝 codestral as recommended in docs
sestinj May 28, 2024
ad8743a
feat: Add cloudflare as provider
May 28, 2024
f9e819d
📝 set up codestral walkthrough
sestinj May 29, 2024
dfc6347
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 29, 2024
27fec0f
Merge branch 'preview'
sestinj May 29, 2024
429f30b
codestral api base
sestinj May 29, 2024
f446bb2
Merge branch 'preview'
sestinj May 29, 2024
3f525f1
update codestral api link
sestinj May 29, 2024
19b5424
codestral api link
sestinj May 29, 2024
427e5c1
Merge branch 'main' into preview
sestinj May 29, 2024
2dce084
bearer token
sestinj May 29, 2024
ba04ee4
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 29, 2024
78ec8ef
🐛 fix config loading
sestinj May 29, 2024
9702e6d
cleaner error message
sestinj May 29, 2024
58691db
fix codestral templating
sestinj May 29, 2024
93e3508
Merge branch 'cf' of https://github.com/deloreyj/continue into delore…
sestinj May 29, 2024
b869894
Merge branch 'deloreyj-cf' into preview
sestinj May 29, 2024
72937af
🔥 remove unused kotlin test
sestinj May 30, 2024
98440db
🧑‍💻 ./gradlew build
sestinj May 30, 2024
e65b002
codestral fim template
sestinj May 30, 2024
264dc18
Merge branch 'main' into preview
sestinj May 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Pre-requisite: You should use the Intellij IDE, which can be downloaded [here](h
2. Run `scripts/install-dependencies.sh` or `scripts/install-dependencies.ps1` on Windows. This will install and build all of the necessary dependencies.
3. To test the plugin, select the "Run Plugin" Gradle configuration and click the "Run" or "Debug" button as shown in this screenshot:
![img](./media/IntelliJRunPluginScreenshot.png)
4. To package the extension, choose the "Build Plugin" Gradle configuration. This will generate a .zip file in `extensions/intellij/build/distributions` with the version defined in `extensions/intellij/gradle.properties`.
4. To package the extension, run `./gradlew build` (or `./gradlew.bat build` on Windows) from the `extensions/intellij` directory. This will generate a .zip file in `extensions/intellij/build/distributions` with the version defined in `extensions/intellij/gradle.properties`.
5. If you make changes, you may need to re-build before running the "Build Plugin" configuration

a. If you change code from the `core` or `binary` directories, make sure to run `npm run build` from the `binary` directory to create a new binary.
Expand Down
11 changes: 11 additions & 0 deletions core/autocomplete/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ const stableCodeFimTemplate: AutocompleteTemplate = {
},
};

const codestralFimTemplate: AutocompleteTemplate = {
template: "<s>[SUFFIX]{{{suffix}}}[PREFIX]{{{prefix}}}",
completionOptions: {
stop: ["[PREFIX]", "[SUFFIX]"],
},
};

const codegemmaFimTemplate: AutocompleteTemplate = {
template:
"<|fim_prefix|>{{{prefix}}}<|fim_suffix|>{{{suffix}}}<|fim_middle|>",
Expand Down Expand Up @@ -227,6 +234,10 @@ export function getTemplateForModel(model: string): AutocompleteTemplate {
return stableCodeFimTemplate;
}

if (lowerCaseModel.includes("codestral")) {
return codestralFimTemplate;
}

if (lowerCaseModel.includes("codegemma")) {
return codegemmaFimTemplate;
}
Expand Down
6 changes: 5 additions & 1 deletion core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ export interface LLMOptions {

useLegacyCompletionsEndpoint?: boolean;

// Cloudflare options
accountId?: string;

// Azure options
engine?: string;
apiVersion?: string;
Expand Down Expand Up @@ -539,7 +542,8 @@ type ModelProvider =
| "groq"
| "continue-proxy"
| "fireworks"
| "custom";
| "custom"
| "cloudflare";

export type ModelName =
| "AUTODETECT"
Expand Down
2 changes: 2 additions & 0 deletions core/llm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export abstract class BaseLLM implements ILLM {
apiType?: string;
region?: string;
projectId?: string;
accountId?: string;

private _llmOptions: LLMOptions;

Expand Down Expand Up @@ -150,6 +151,7 @@ export abstract class BaseLLM implements ILLM {
if (this.apiBase && !this.apiBase.endsWith("/")) {
this.apiBase = `${this.apiBase}/`;
}
this.accountId = options.accountId;

this.engine = options.engine;
this.apiVersion = options.apiVersion;
Expand Down
62 changes: 62 additions & 0 deletions core/llm/llms/Cloudflare.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { BaseLLM } from "../index.js";
import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js";
import { stripImages } from "../countTokens.js";
import { streamSse } from "../stream.js";

export default class Cloudflare extends BaseLLM {
static providerName: ModelProvider = "cloudflare";

private _convertArgs(options: CompletionOptions) {
const finalOptions = {
max_tokens: options.maxTokens,
};

return finalOptions;
}

protected async *_streamChat(
messages: ChatMessage[],
options: CompletionOptions,
): AsyncGenerator<ChatMessage, any, unknown> {
const headers = {
"Content-Type": "application/json",
Authorization: `Bearer ${this.apiKey}`,
...this.requestOptions?.headers,
};

const resp = await this.fetch(
new URL(
`https://api.cloudflare.com/client/v4/accounts/${this.accountId}/ai/v1/chat/completions`,
),
{
method: "POST",
headers,
body: JSON.stringify({
messages,
stream: true,
model: this.model,
...this._convertArgs(options),
}),
},
);

for await (const value of streamSse(resp)) {
console.log(value);
if (value.choices?.[0]?.delta?.content) {
yield value.choices[0].delta;
}
}
}

protected async *_streamComplete(
prompt: string,
options: CompletionOptions,
): AsyncGenerator<string> {
for await (const chunk of this._streamChat(
[{ role: "user", content: prompt }],
options,
)) {
yield stripImages(chunk.content);
}
}
}
2 changes: 2 additions & 0 deletions core/llm/llms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Replicate from "./Replicate.js";
import TextGenWebUI from "./TextGenWebUI.js";
import Together from "./Together.js";
import ContinueProxy from "./stubs/ContinueProxy.js";
import Cloudflare from "./Cloudflare";

function convertToLetter(num: number): string {
let result = "";
Expand Down Expand Up @@ -99,6 +100,7 @@ const LLMs = [
Groq,
Fireworks,
ContinueProxy,
Cloudflare,
];

export async function llmFromDescription(
Expand Down
46 changes: 46 additions & 0 deletions docs/docs/reference/Model Providers/cloudflare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Cloudflare Workers AI

Cloudflare Workers AI can be used for both chat and tab autocompletion in Continue. To setup Cloudflare Workers AI, add the following to your `config.json` file:

```json title="~/.continue/config.json"
{
"models": [
{
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
"apiKey": "YOUR CLOUDFLARE API KEY",
"contextLength": 2400,
"completionOptions": {
"maxTokens": 500
},
"model": "@cf/meta/llama-3-8b-instruct", // This can be the name of any model supported by Workers AI
"provider": "cloudflare",
"title": "Llama 3 8B"
},
{
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
"apiKey": "YOUR CLOUDFLARE API KEY",
"contextLength": 2400,
"completionOptions": {
"maxTokens": 500
},
"model": "@hf/thebloke/deepseek-coder-6.7b-instruct-awq",
"provider": "cloudflare",
"title": "DeepSeek Coder 6.7b Instruct"
}
...
"tabAutocompleteModel": {
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
"apiKey": "YOUR CLOUDFLARE API KEY",
"model": "@hf/thebloke/deepseek-coder-6.7b-base-awq",
"provider": "cloudflare",
"title": "DeepSeek 7b"
},
]
}
```

Visit the [Cloudflare dashboard](https://dash.cloudflare.com/) to [create an API key](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).

Review [available models](https://developers.cloudflare.com/workers-ai/models/) on Workers AI

[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Cloudflare.ts)
2 changes: 1 addition & 1 deletion docs/docs/walkthroughs/set-up-codestral.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords: [codestral, mistral, model setup]

2. Click on the gear icon in the bottom right corner of the Continue window to open `~/.continue/config.json` (MacOS) / `%userprofile%\.continue\config.json` (Windows)

3. Log in and create an API key on Mistral AI's La Plateforme [here](https://console.mistral.ai/codestral)
3. Log in and create an API key on Mistral AI's La Plateforme [here](https://console.mistral.ai/codestral). Make sure you get an API key from the "Codestral" page, as an API key for the normal "api.mistral.ai" API will not work.

4. To use Codestral as your model for both `autocomplete` and `chat`, replace `[API_KEY]` with your Mistral API key below and add it to your `config.json` file:

Expand Down
67 changes: 64 additions & 3 deletions docs/static/schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
"flowise",
"groq",
"fireworks",
"continue-proxy"
"continue-proxy",
"cloudflare"
],
"markdownEnumDescriptions": [
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
Expand All @@ -169,7 +170,8 @@
"### Llamafile\nTo get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile#binary-instructions). Then run it with the following command:\n\n```shell\nchmod +x ./llamafile\n./llamafile\n```\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/llamafile)",
"### Mistral API\n\nTo get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)",
"### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)",
"### Continue Proxy\n\nContinue Enterprise users can use the Continue Proxy as a single point of access to models."
"### Continue Proxy\n\nContinue Enterprise users can use the Continue Proxy as a single point of access to models.",
"### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)"
],
"type": "string"
},
Expand Down Expand Up @@ -313,7 +315,8 @@
"gemini",
"huggingface-inference-api",
"replicate",
"together"
"together",
"cloudflare"
]
}
},
Expand Down Expand Up @@ -359,6 +362,64 @@
}
}
},
{
"if": {
"properties": {
"provider": {
"enum": ["cloudflare"]
}
},
"required": ["provider"]
},
"then": {
"properties": {
"accountId": {
"type": "string"
},
"model": {
"anyOf": [
{
"enum": [
"@cf/meta/llama-3-8b-instruct",
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq",
"@cf/deepseek-ai/deepseek-math-7b-instruct",
"@cf/thebloke/discolm-german-7b-v1-awq",
"@cf/tiiuae/falcon-7b-instruct",
"@cf/google/gemma-2b-it-lora",
"@hf/google/gemma-7b-it",
"@cf/google/gemma-7b-it-lora",
"@hf/nousresearch/hermes-2-pro-mistral-7b",
"@cf/meta/llama-2-7b-chat-fp16",
"@cf/meta/llama-2-7b-chat-int8",
"@cf/meta-llama/llama-2-7b-chat-hf-lora",
"@hf/thebloke/llama-2-13b-chat-awq",
"@hf/thebloke/llamaguard-7b-awq",
"@cf/mistral/mistral-7b-instruct-v0.1",
"@hf/mistral/mistral-7b-instruct-v0.2",
"@cf/mistral/mistral-7b-instruct-v0.2-lora",
"@hf/thebloke/neural-chat-7b-v3-1-awq",
"@cf/openchat/openchat-3.5-0106",
"@hf/thebloke/openhermes-2.5-mistral-7b-awq",
"@cf/microsoft/phi-2",
"@cf/qwen/qwen1.5-0.5b-chat",
"@cf/qwen/qwen1.5-1.8b-chat",
"@cf/qwen/qwen1.5-7b-chat-awq",
"@cf/qwen/qwen1.5-14b-chat-awq",
"@cf/defog/sqlcoder-7b-2",
"@hf/nexusflow/starling-lm-7b-beta",
"@cf/tinyllama/tinyllama-1.1b-chat-v1.0",
"@hf/thebloke/zephyr-7b-beta-awq",
"@hf/thebloke/deepseek-coder-6.7b-base-awq"
]
},
{
"type": "string"
}
]
}
}
}
},
{
"if": {
"properties": {
Expand Down
67 changes: 64 additions & 3 deletions extensions/intellij/src/main/resources/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
"flowise",
"groq",
"fireworks",
"continue-proxy"
"continue-proxy",
"cloudflare"
],
"markdownEnumDescriptions": [
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
Expand All @@ -169,7 +170,8 @@
"### Llamafile\nTo get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile#binary-instructions). Then run it with the following command:\n\n```shell\nchmod +x ./llamafile\n./llamafile\n```\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/llamafile)",
"### Mistral API\n\nTo get access to the Mistral API, obtain your API key from the [Mistral platform](https://docs.mistral.ai/)",
"### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)",
"### Continue Proxy\n\nContinue Enterprise users can use the Continue Proxy as a single point of access to models."
"### Continue Proxy\n\nContinue Enterprise users can use the Continue Proxy as a single point of access to models.",
"### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)"
],
"type": "string"
},
Expand Down Expand Up @@ -313,7 +315,8 @@
"gemini",
"huggingface-inference-api",
"replicate",
"together"
"together",
"cloudflare"
]
}
},
Expand Down Expand Up @@ -359,6 +362,64 @@
}
}
},
{
"if": {
"properties": {
"provider": {
"enum": ["cloudflare"]
}
},
"required": ["provider"]
},
"then": {
"properties": {
"accountId": {
"type": "string"
},
"model": {
"anyOf": [
{
"enum": [
"@cf/meta/llama-3-8b-instruct",
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq",
"@cf/deepseek-ai/deepseek-math-7b-instruct",
"@cf/thebloke/discolm-german-7b-v1-awq",
"@cf/tiiuae/falcon-7b-instruct",
"@cf/google/gemma-2b-it-lora",
"@hf/google/gemma-7b-it",
"@cf/google/gemma-7b-it-lora",
"@hf/nousresearch/hermes-2-pro-mistral-7b",
"@cf/meta/llama-2-7b-chat-fp16",
"@cf/meta/llama-2-7b-chat-int8",
"@cf/meta-llama/llama-2-7b-chat-hf-lora",
"@hf/thebloke/llama-2-13b-chat-awq",
"@hf/thebloke/llamaguard-7b-awq",
"@cf/mistral/mistral-7b-instruct-v0.1",
"@hf/mistral/mistral-7b-instruct-v0.2",
"@cf/mistral/mistral-7b-instruct-v0.2-lora",
"@hf/thebloke/neural-chat-7b-v3-1-awq",
"@cf/openchat/openchat-3.5-0106",
"@hf/thebloke/openhermes-2.5-mistral-7b-awq",
"@cf/microsoft/phi-2",
"@cf/qwen/qwen1.5-0.5b-chat",
"@cf/qwen/qwen1.5-1.8b-chat",
"@cf/qwen/qwen1.5-7b-chat-awq",
"@cf/qwen/qwen1.5-14b-chat-awq",
"@cf/defog/sqlcoder-7b-2",
"@hf/nexusflow/starling-lm-7b-beta",
"@cf/tinyllama/tinyllama-1.1b-chat-v1.0",
"@hf/thebloke/zephyr-7b-beta-awq",
"@hf/thebloke/deepseek-coder-6.7b-base-awq"
]
},
{
"type": "string"
}
]
}
}
}
},
{
"if": {
"properties": {
Expand Down
Loading