Skip to content

Commit

Permalink
Initial updates, before testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sealad886 committed Dec 13, 2024
1 parent 86b40c7 commit fc8edcd
Show file tree
Hide file tree
Showing 10 changed files with 231 additions and 203 deletions.
408 changes: 205 additions & 203 deletions core/config/types.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions core/control-plane/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const modelDescriptionSchema = z.object({
presencePenalty: z.number().optional(),
frequencyPenalty: z.number().optional(),
mirostat: z.number().optional(),
mirostatEta: z.number().optional(),
mirostatTau: z.number().optional(),
stop: z.array(z.string()).optional(),
maxTokens: z.number().optional(),
numThreads: z.number().optional(),
Expand Down
2 changes: 2 additions & 0 deletions core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,8 @@ interface BaseCompletionOptions {
presencePenalty?: number;
frequencyPenalty?: number;
mirostat?: number;
mirostatEta?: number;
mirostatTau?: number;
stop?: string[];
maxTokens?: number;
numThreads?: number;
Expand Down
2 changes: 2 additions & 0 deletions core/llm/llms/LlamaCpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class LlamaCpp extends BaseLLM {
presence_penalty: options.presencePenalty,
min_p: options.minP,
mirostat: options.mirostat,
mirostatEta: options.mirostatEta,
mirostatTau: options.mirostatTau,
stop: options.stop,
top_k: options.topK,
top_p: options.topP,
Expand Down
2 changes: 2 additions & 0 deletions core/llm/llms/Ollama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ class Ollama extends BaseLLM {
stop: options.stop,
num_ctx: this.contextLength,
mirostat: options.mirostat,
mirostat_eta: options.mirostatEta,
mirostat_tau: options.mirostatTau,
num_thread: options.numThreads,
use_mmap: options.useMmap,
min_p: options.minP,
Expand Down
2 changes: 2 additions & 0 deletions docs/docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ Parameters that control the behavior of text generation and completion settings.
- `presencePenalty`: Discourages the model from generating tokens that have already appeared in the output.
- `frequencePenalty`: Penalizes tokens based on their frequency in the text, reducing repetition.
- `mirostat`: Enables Mirostat sampling, which controls the perplexity during text generation. Supported by Ollama, LM Studio, and llama.cpp providers (default: `0`, where `0` = disabled, `1` = Mirostat, and `2` = Mirostat 2.0).
- `mirostatEta`: Influences how quickly the algorithm responds to feedback from the generated text. A lower learning rate will result in slower adjustments, while a higher learning rate will make the algorithm more responsive. (Default: 0.1)
- `mirostatTau`: Controls the balance between coherence and diversity of the output. A lower value will result in more focused and coherent text. (Default: 5.0)
- `stop`: An array of stop tokens that, when encountered, will terminate the completion. Allows specifying multiple end conditions.
- `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`).
- `numThreads`: The number of threads used during the generation process. Available only for Ollama as `num_thread`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Write unit tests for the above selected code, following each of these instructio
- `presencePenalty`
- `frequencyPenalty`
- `mirostat`
- `mirostatEta`
- `mirostatTau`
- `stop`
- `maxTokens`
- `description`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ Parameters that control the behavior of text generation and completion settings.
- `presencePenalty`: Discourages the model from generating tokens that have already appeared in the output.
- `frequencePenalty`: Penalizes tokens based on their frequency in the text, reducing repetition.
- `mirostat`: Enables Mirostat sampling, which controls the perplexity during text generation. Supported by Ollama, LM Studio, and llama.cpp providers (default: `0`, where `0` = disabled, `1` = Mirostat, and `2` = Mirostat 2.0).
- `mirostatEta`: Influences how quickly the algorithm responds to feedback from the generated text. A lower learning rate will result in slower adjustments, while a higher learning rate will make the algorithm more responsive. (Default: 0.1)
- `mirostatTau`: Controls the balance between coherence and diversity of the output. A lower value will result in more focused and coherent text. (Default: 5.0)
- `stop`: An array of stop tokens that, when encountered, will terminate the completion. Allows specifying multiple end conditions.
- `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`).
- `numThreads`: The number of threads used during the generation process. Available only for Ollama as `num_thread`.
Expand Down
10 changes: 10 additions & 0 deletions extensions/vscode/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
"description": "Enable Mirostat sampling, controlling perplexity during text generation (default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0). Only available for Ollama, LM Studio, and llama.cpp providers",
"type": "number"
},
"mirostatEta": {
"title": "Mirostat Eta",
"description": "The Mirostat eta value, which controls how quickly the model converges to its optimal perplexity. A higher value means faster convergence but may result in less accurate results. Only enabled when `mirostat` is also enabled. (default: 0.1)",
"type": "number"
},
"mirostatTau": {
"title": "Mirostat Tau",
"description": "The Mirostat tau value, which controls how quickly the model converges to its optimal perplexity. A higher value means faster convergence but may result in less accurate results. Only enabled when `mirostat` is also enabled. (default: 5.0)",
"type": "number"
},
"stop": {
"title": "Stop",
"description": "The stop tokens of the completion.",
Expand Down
2 changes: 2 additions & 0 deletions packages/config-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const completionOptionsSchema = z.object({
presencePenalty: z.number().optional(),
frequencyPenalty: z.number().optional(),
mirostat: z.number().optional(),
mirostatEta: z.number().optional(),
mirostatTau: z.number().optional(),
stop: z.array(z.string()).optional(),
maxTokens: z.number().optional(),
numThreads: z.number().optional(),
Expand Down

0 comments on commit fc8edcd

Please sign in to comment.