git-coco 0.7.5 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,123 +6,84 @@
6
6
  [![NPM Version](https://img.shields.io/npm/v/git-coco.svg)](https://www.npmjs.com/package/git-coco)
7
7
  [![NPM Downloads](https://img.shields.io/npm/dt/git-coco.svg)](https://www.npmjs.com/package/git-coco)
8
8
 
9
- Commit Copilot, or `coco`, is your personal scribe for git commit messages. Leveraging the power of [LangChain🦜🔗](https://js.langchain.com/) and LLMs to encapsulate your staged changes into meaningful commit messages!
9
+ `coco`, the Commit Copilot, is not just your scribe for git commit messages. With the power of [LangChain🦜🔗](https://js.langchain.com/) and LLMs, it now brings you a suite of tools to streamline your git workflow!
10
10
 
11
+ ## Commands
11
12
 
13
+ - **`commit`**: generates commit messages based on staged changes.
12
14
 
13
- ## Installation
15
+ - **`changelog`**: create changelogs for the current branch or a range of commits.
14
16
 
15
- Get started by adding `coco` to your project's development dependencies:
17
+ - **`init`**: step by step wizard to set up `coco` globally or for a project.
16
18
 
17
- ```bash
18
- npm i git-coco --save-dev
19
- ```
19
+ ## Getting Started
20
20
 
21
- Or, for global access, you can install `coco` system-wide:
21
+ **`coco init`** is the first step to getting started with `coco`. It will guide you through the installation process, including setting up your OpenAI API key and configuring `coco` to your preferences.
22
22
 
23
23
  ```bash
24
- npm i -g git-coco
24
+ # For local project use
25
+ npx git-coco@latest init -l project
26
+
27
+ # For global use
28
+ npx git-coco@latest init -l global
25
29
  ```
26
30
 
27
31
  ## Usage
28
32
 
29
- There are two main ways to use `coco`:
30
-
31
- 1. [Interactive Mode](#interactive)
32
- 2. [Command Line Interface (CLI)](#cli)
33
+ ### **`coco commit`**
33
34
 
34
- ### **Interactive Mode**
35
-
36
- Just type `coco` and let the friendly prompts guide you through the commit process!
35
+ Generates commit messages based on staged changes.
37
36
 
38
37
  ```bash
39
- coco -i
40
- ```
38
+ coco
41
39
 
42
- The interactive mode offers you several benefits:
40
+ # or
43
41
 
44
- - Preview and approve or regenerate the commit message before it's committed
45
- - Customize your prompts for a personalized commit experience
46
-
47
- ### **Command Line Interface (CLI)**
48
-
49
- If you're the type who likes to keep it simple, you can pass your commit message directly as a CLI argument:
50
-
51
- ```bash
52
- coco --openAIApiKey="sk_your-openai-api-key"
42
+ coco commit
53
43
  ```
54
44
 
55
- Assuming you've stored your API key in the config file ([learn more](#the-cococonfig)), you can also commit with:
56
-
57
- ```bash
58
- git commit -m $(coco)
59
- ```
45
+ ### **`coco changelog`**
60
46
 
61
- Alternatively, take advantage of `coco`'s full potential by allowing it to make the commit for you!
47
+ Creates changelogs.
62
48
 
63
49
  ```bash
64
- coco -s
65
- ```
50
+ # For the current branch
51
+ coco changelog
66
52
 
67
- ## **The `coco.config`**
53
+ # For a specific range
54
+ coco changelog -r HEAD~5:HEAD
55
+ ```
68
56
 
69
- `coco.config` houses the project-level settings and can be defined in multiple places, adhering to a hierarchical order of priority. If the same configuration is found in multiple places, the higher priority one will be considered.
70
57
 
71
- From highest to lowest, the priority order is:
58
+ ### Stdout vs. Interactive Mode
72
59
 
73
- 1. **Command Line Flags**: Flags in the command line have the highest priority, and they override all other settings.
74
- 2. **Environment Variables**: Next in line are environment variables. You can set any configuration option as an environment variable.
75
- 3. **Project Config (`.coco.config.json`)**: Create a `.coco.config.json` file in your project root to set configurations. It's recommended to store your OpenAI API key here alongside any other project-specific configurations.
76
- 4. **Git Profile (`.gitconfig`)**: You can define `coco` settings under a `[coco]` section in your git profile. These settings will be used unless overridden by higher-priority ones.
77
- 5. **XDG Configuration Directory**: If `XDG_CONFIG_HOME` is set, `coco` will look for a `coco/config` file in this directory for configurations.
60
+ `coco` offers two modes of operation: **stdout** and **interactive**, defaulting to **stdout**. You can specify your preferred mode in your config file or via command line flags.
78
61
 
79
- Here's an example `.coco.config.json` file:
62
+ ```bash
63
+ # Stdout mode
64
+ git commit -m $(coco)
80
65
 
81
- ```json
82
- {
83
- "openAIApiKey": "sk_your-openai-api-key",
84
- }
66
+ # Interactive mode
67
+ coco -i
85
68
  ```
86
69
 
87
- And the same settings in `.gitconfig`:
70
+ ### Generate and commit all in one
88
71
 
89
- ```ini
90
- [coco]
91
- openAIApiKey = sk_your-openai-api-key
92
- ```
72
+ `coco` can generate and commit your changes in one command.
93
73
 
94
- Remember, command line flags and environment variables should be defined in `UPPER_SNAKE_CASE`. For instance, the `openAIApiKey` setting becomes `OPENAI_API_KEY`.
74
+ ```bash
75
+ coco -s
76
+ ```
95
77
 
96
- ### Options
78
+ ## Configuration
97
79
 
98
- | Name | Type | Default Value | Description |
99
- |--------------------------|---------------------------------|-------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
100
- | openAIApiKey | string | None | Your OpenAI API key |
101
- | tokenLimit | number | 500 | Maximum number of tokens for the commit message |
102
- | prompt | string | `"What are the changes in this commit?"` | Prompt for OpenAI GPT-3 |
103
- | temperature | number | 0.4 | Controls randomness in GPT-3 output. Lower values yield focused output; higher values offer diversity |
104
- | mode | `stdout` \| `interactive` | `stdout` | Preferred output method for generated commit messages |
105
- | summarizePrompt | string | `"Summarize the changes in this large file:"` | GPT-3 prompt for summarizing large files |
106
- | ignoredFiles | string[] | `["package-lock.json"]` | Paths of files to be excluded when generating commit messages |
107
- | ignoredExtensions | string[] | `[".map", ".lock"]` | File extensions to be excluded when generating commit messages |
80
+ The `.coco.config` documentation has moved to our [wiki](https://github.com/gfargo/coco/wiki/Config-Overview). Here, you'll find detailed information on setting up and customizing your experience.
108
81
 
109
- ## Roadmap
82
+ ### **Ignoring Files**
110
83
 
111
- - [x] Interactive mode 🤖
112
- - [x] Stdout 📤
113
- - [x] LangChain integration 🦜
114
- - [ ] Additional tests! 🧪
115
- - [ ] Conventional commits 🔜
116
- - [x] HuggingFace integration 🔜
117
- - [ ] Google Vertex AI integration (?)
118
- - [ ] Automatic changelog generation 🫣
119
- - [ ] Rebase support 🔀
120
- - [ ] `coco --amend b31dfc` 👩‍💻
84
+ You can specify files to be ignored when generating commit messages by adding them to your config file or via command line flags. Read more about ignoring files & extensions in the [wiki](https://github.com/gfargo/coco/wiki/Ignoring-Files-&-Extensions).
121
85
 
122
- ...and more! 🧑‍🔬 🚀
123
86
 
124
87
  ## Contribution
125
88
 
126
- Have an idea for a feature or want to get involved, we welcome contributions!
127
-
128
- Please check out our [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
89
+ We welcome contributions! Check out our [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,78 @@
1
1
  /// <reference types="yargs" />
2
- import * as yargs from 'yargs';
3
- import { HuggingFaceInference } from 'langchain/llms/hf';
2
+ import { TiktokenModel, OpenAIInput } from 'langchain/dist/types/openai-types';
3
+ import { OllamaInput } from 'langchain/dist/util/ollama';
4
4
  import { BaseLLMParams } from 'langchain/llms/base';
5
- import { OpenAIInput, AzureOpenAIInput, OpenAI } from 'langchain/llms/openai';
6
- import { TiktokenModel } from 'langchain/dist/types/openai-types';
5
+ import * as yargs from 'yargs';
6
+ import * as langchain_llms_openai from 'langchain/llms/openai';
7
+ import { OpenAI } from 'langchain/llms/openai';
8
+ import { Ollama } from 'langchain/llms/ollama';
7
9
  import { SimpleGit } from 'simple-git';
8
10
  import { Color } from 'chalk';
9
11
 
12
+ type LLMProvider = 'openai' | 'ollama';
13
+ type OllamaModel = 'neural-chat' | 'starling-lm' | 'mistral' | 'llama2' | 'codellama' | 'llama2-uncensored' | 'llama2:13b' | 'llama2:70b' | 'orca-mini' | 'vicuna';
14
+ type LLMModel = TiktokenModel | OllamaModel;
15
+ interface BaseLLMService {
16
+ provider: LLMProvider;
17
+ model: LLMModel;
18
+ /**
19
+ * The maximum number of tokens per request.
20
+ *
21
+ * @default 1024
22
+ */
23
+ tokenLimit?: number;
24
+ /**
25
+ * The temperature value controls the randomness of the generated output.
26
+ * Higher values (e.g., 0.8) make the output more random, while lower values (e.g., 0.2) make it more deterministic.
27
+ *
28
+ * @default 0.4
29
+ */
30
+ temperature?: number;
31
+ /**
32
+ * The maximum number of requests to make concurrently.
33
+ *
34
+ * @default 6
35
+ */
36
+ maxConcurrent?: number;
37
+ authentication: Authentication;
38
+ requestOptions?: {
39
+ timeout?: number;
40
+ maxRetries?: number;
41
+ };
42
+ fields?: OpenAIFields | OllamaFields;
43
+ }
44
+ type Authentication = {
45
+ type: 'None';
46
+ credentials: undefined;
47
+ } | {
48
+ type: 'OAuth';
49
+ credentials: {
50
+ clientId?: string;
51
+ clientSecret?: string;
52
+ token?: string;
53
+ };
54
+ } | {
55
+ type: 'APIKey';
56
+ credentials: {
57
+ apiKey: string;
58
+ };
59
+ };
60
+ type OpenAIFields = Partial<OpenAIInput> & BaseLLMParams;
61
+ type OllamaFields = Partial<OllamaInput> & BaseLLMParams;
62
+ interface OpenAILLMService extends BaseLLMService {
63
+ provider: 'openai';
64
+ model: TiktokenModel;
65
+ fields?: OpenAIFields;
66
+ }
67
+ interface OllamaLLMService extends BaseLLMService {
68
+ provider: 'ollama';
69
+ model: OllamaModel;
70
+ endpoint: string;
71
+ fields?: OllamaFields;
72
+ }
73
+ type LLMService = OpenAILLMService | OllamaLLMService;
74
+ type LLMServiceAlias = 'openai' | 'ollama';
75
+
10
76
  declare const _default$2: {
11
77
  command: string;
12
78
  desc: string;
@@ -19,10 +85,9 @@ declare const _default$2: {
19
85
  openInEditor: boolean;
20
86
  ignoredFiles: string[];
21
87
  ignoredExtensions: string[];
22
- service: "openai/text-davinci-003" | "openai/text-davinci-002" | "openai/text-davinci-001" | "openai/text-curie-001" | "openai/text-babbage-001" | "openai/text-ada-001" | "openai/davinci" | "openai/curie" | "openai/babbage" | "openai/ada" | "openai/code-davinci-002" | "openai/code-davinci-001" | "openai/code-cushman-002" | "openai/code-cushman-001" | "openai/davinci-codex" | "openai/cushman-codex" | "openai/text-davinci-edit-001" | "openai/code-davinci-edit-001" | "openai/text-embedding-ada-002" | "openai/text-similarity-davinci-001" | "openai/text-similarity-curie-001" | "openai/text-similarity-babbage-001" | "openai/text-similarity-ada-001" | "openai/text-search-davinci-doc-001" | "openai/text-search-curie-doc-001" | "openai/text-search-babbage-doc-001" | "openai/text-search-ada-doc-001" | "openai/code-search-babbage-code-001" | "openai/code-search-ada-code-001" | "openai/gpt2" | "openai/gpt-3.5-turbo" | "openai/gpt-3.5-turbo-0301" | "openai/gpt-3.5-turbo-0613" | "openai/gpt-3.5-turbo-16k" | "openai/gpt-3.5-turbo-16k-0613" | "openai/gpt-4" | "openai/gpt-4-0314" | "openai/gpt-4-0613" | "openai/gpt-4-32k" | "openai/gpt-4-32k-0314" | "openai/gpt-4-32k-0613" | "huggingface/text-davinci-003" | "huggingface/text-davinci-002" | "huggingface/text-davinci-001" | "huggingface/text-curie-001" | "huggingface/text-babbage-001" | "huggingface/text-ada-001" | "huggingface/davinci" | "huggingface/curie" | "huggingface/babbage" | "huggingface/ada" | "huggingface/code-davinci-002" | "huggingface/code-davinci-001" | "huggingface/code-cushman-002" | "huggingface/code-cushman-001" | "huggingface/davinci-codex" | "huggingface/cushman-codex" | "huggingface/text-davinci-edit-001" | "huggingface/code-davinci-edit-001" | "huggingface/text-embedding-ada-002" | "huggingface/text-similarity-davinci-001" | "huggingface/text-similarity-curie-001" | "huggingface/text-similarity-babbage-001" | "huggingface/text-similarity-ada-001" | "huggingface/text-search-davinci-doc-001" | "huggingface/text-search-curie-doc-001" | "huggingface/text-search-babbage-doc-001" | "huggingface/text-search-ada-doc-001" | "huggingface/code-search-babbage-code-001" | "huggingface/code-search-ada-code-001" | "huggingface/gpt2" | "huggingface/gpt-3.5-turbo" | "huggingface/gpt-3.5-turbo-0301" | "huggingface/gpt-3.5-turbo-0613" | "huggingface/gpt-3.5-turbo-16k" | "huggingface/gpt-3.5-turbo-16k-0613" | "huggingface/gpt-4" | "huggingface/gpt-4-0314" | "huggingface/gpt-4-0613" | "huggingface/gpt-4-32k" | "huggingface/gpt-4-32k-0314" | "huggingface/gpt-4-32k-0613";
23
- openAIApiKey: string | undefined;
24
- huggingFaceHubApiKey: string | undefined;
25
- tokenLimit: number | undefined;
88
+ service: LLMServiceAlias;
89
+ openAIApiKey: string;
90
+ tokenLimit: number;
26
91
  interactive: boolean;
27
92
  help: boolean;
28
93
  verbose: boolean;
@@ -36,10 +101,9 @@ declare const _default$2: {
36
101
  openInEditor: boolean;
37
102
  ignoredFiles: string[];
38
103
  ignoredExtensions: string[];
39
- service: "openai/text-davinci-003" | "openai/text-davinci-002" | "openai/text-davinci-001" | "openai/text-curie-001" | "openai/text-babbage-001" | "openai/text-ada-001" | "openai/davinci" | "openai/curie" | "openai/babbage" | "openai/ada" | "openai/code-davinci-002" | "openai/code-davinci-001" | "openai/code-cushman-002" | "openai/code-cushman-001" | "openai/davinci-codex" | "openai/cushman-codex" | "openai/text-davinci-edit-001" | "openai/code-davinci-edit-001" | "openai/text-embedding-ada-002" | "openai/text-similarity-davinci-001" | "openai/text-similarity-curie-001" | "openai/text-similarity-babbage-001" | "openai/text-similarity-ada-001" | "openai/text-search-davinci-doc-001" | "openai/text-search-curie-doc-001" | "openai/text-search-babbage-doc-001" | "openai/text-search-ada-doc-001" | "openai/code-search-babbage-code-001" | "openai/code-search-ada-code-001" | "openai/gpt2" | "openai/gpt-3.5-turbo" | "openai/gpt-3.5-turbo-0301" | "openai/gpt-3.5-turbo-0613" | "openai/gpt-3.5-turbo-16k" | "openai/gpt-3.5-turbo-16k-0613" | "openai/gpt-4" | "openai/gpt-4-0314" | "openai/gpt-4-0613" | "openai/gpt-4-32k" | "openai/gpt-4-32k-0314" | "openai/gpt-4-32k-0613" | "huggingface/text-davinci-003" | "huggingface/text-davinci-002" | "huggingface/text-davinci-001" | "huggingface/text-curie-001" | "huggingface/text-babbage-001" | "huggingface/text-ada-001" | "huggingface/davinci" | "huggingface/curie" | "huggingface/babbage" | "huggingface/ada" | "huggingface/code-davinci-002" | "huggingface/code-davinci-001" | "huggingface/code-cushman-002" | "huggingface/code-cushman-001" | "huggingface/davinci-codex" | "huggingface/cushman-codex" | "huggingface/text-davinci-edit-001" | "huggingface/code-davinci-edit-001" | "huggingface/text-embedding-ada-002" | "huggingface/text-similarity-davinci-001" | "huggingface/text-similarity-curie-001" | "huggingface/text-similarity-babbage-001" | "huggingface/text-similarity-ada-001" | "huggingface/text-search-davinci-doc-001" | "huggingface/text-search-curie-doc-001" | "huggingface/text-search-babbage-doc-001" | "huggingface/text-search-ada-doc-001" | "huggingface/code-search-babbage-code-001" | "huggingface/code-search-ada-code-001" | "huggingface/gpt2" | "huggingface/gpt-3.5-turbo" | "huggingface/gpt-3.5-turbo-0301" | "huggingface/gpt-3.5-turbo-0613" | "huggingface/gpt-3.5-turbo-16k" | "huggingface/gpt-3.5-turbo-16k-0613" | "huggingface/gpt-4" | "huggingface/gpt-4-0314" | "huggingface/gpt-4-0613" | "huggingface/gpt-4-32k" | "huggingface/gpt-4-32k-0314" | "huggingface/gpt-4-32k-0613";
40
- openAIApiKey: string | undefined;
41
- huggingFaceHubApiKey: string | undefined;
42
- tokenLimit: number | undefined;
104
+ service: LLMServiceAlias;
105
+ openAIApiKey: string;
106
+ tokenLimit: number;
43
107
  interactive: boolean;
44
108
  help: boolean;
45
109
  verbose: boolean;
@@ -62,10 +126,9 @@ declare const _default$1: {
62
126
  openInEditor: boolean;
63
127
  ignoredFiles: string[];
64
128
  ignoredExtensions: string[];
65
- service: "openai/text-davinci-003" | "openai/text-davinci-002" | "openai/text-davinci-001" | "openai/text-curie-001" | "openai/text-babbage-001" | "openai/text-ada-001" | "openai/davinci" | "openai/curie" | "openai/babbage" | "openai/ada" | "openai/code-davinci-002" | "openai/code-davinci-001" | "openai/code-cushman-002" | "openai/code-cushman-001" | "openai/davinci-codex" | "openai/cushman-codex" | "openai/text-davinci-edit-001" | "openai/code-davinci-edit-001" | "openai/text-embedding-ada-002" | "openai/text-similarity-davinci-001" | "openai/text-similarity-curie-001" | "openai/text-similarity-babbage-001" | "openai/text-similarity-ada-001" | "openai/text-search-davinci-doc-001" | "openai/text-search-curie-doc-001" | "openai/text-search-babbage-doc-001" | "openai/text-search-ada-doc-001" | "openai/code-search-babbage-code-001" | "openai/code-search-ada-code-001" | "openai/gpt2" | "openai/gpt-3.5-turbo" | "openai/gpt-3.5-turbo-0301" | "openai/gpt-3.5-turbo-0613" | "openai/gpt-3.5-turbo-16k" | "openai/gpt-3.5-turbo-16k-0613" | "openai/gpt-4" | "openai/gpt-4-0314" | "openai/gpt-4-0613" | "openai/gpt-4-32k" | "openai/gpt-4-32k-0314" | "openai/gpt-4-32k-0613" | "huggingface/text-davinci-003" | "huggingface/text-davinci-002" | "huggingface/text-davinci-001" | "huggingface/text-curie-001" | "huggingface/text-babbage-001" | "huggingface/text-ada-001" | "huggingface/davinci" | "huggingface/curie" | "huggingface/babbage" | "huggingface/ada" | "huggingface/code-davinci-002" | "huggingface/code-davinci-001" | "huggingface/code-cushman-002" | "huggingface/code-cushman-001" | "huggingface/davinci-codex" | "huggingface/cushman-codex" | "huggingface/text-davinci-edit-001" | "huggingface/code-davinci-edit-001" | "huggingface/text-embedding-ada-002" | "huggingface/text-similarity-davinci-001" | "huggingface/text-similarity-curie-001" | "huggingface/text-similarity-babbage-001" | "huggingface/text-similarity-ada-001" | "huggingface/text-search-davinci-doc-001" | "huggingface/text-search-curie-doc-001" | "huggingface/text-search-babbage-doc-001" | "huggingface/text-search-ada-doc-001" | "huggingface/code-search-babbage-code-001" | "huggingface/code-search-ada-code-001" | "huggingface/gpt2" | "huggingface/gpt-3.5-turbo" | "huggingface/gpt-3.5-turbo-0301" | "huggingface/gpt-3.5-turbo-0613" | "huggingface/gpt-3.5-turbo-16k" | "huggingface/gpt-3.5-turbo-16k-0613" | "huggingface/gpt-4" | "huggingface/gpt-4-0314" | "huggingface/gpt-4-0613" | "huggingface/gpt-4-32k" | "huggingface/gpt-4-32k-0314" | "huggingface/gpt-4-32k-0613";
66
- openAIApiKey: string | undefined;
67
- huggingFaceHubApiKey: string | undefined;
68
- tokenLimit: number | undefined;
129
+ service: LLMServiceAlias;
130
+ openAIApiKey: string;
131
+ tokenLimit: number;
69
132
  interactive: boolean;
70
133
  help: boolean;
71
134
  verbose: boolean;
@@ -80,10 +143,9 @@ declare const _default$1: {
80
143
  openInEditor: boolean;
81
144
  ignoredFiles: string[];
82
145
  ignoredExtensions: string[];
83
- service: "openai/text-davinci-003" | "openai/text-davinci-002" | "openai/text-davinci-001" | "openai/text-curie-001" | "openai/text-babbage-001" | "openai/text-ada-001" | "openai/davinci" | "openai/curie" | "openai/babbage" | "openai/ada" | "openai/code-davinci-002" | "openai/code-davinci-001" | "openai/code-cushman-002" | "openai/code-cushman-001" | "openai/davinci-codex" | "openai/cushman-codex" | "openai/text-davinci-edit-001" | "openai/code-davinci-edit-001" | "openai/text-embedding-ada-002" | "openai/text-similarity-davinci-001" | "openai/text-similarity-curie-001" | "openai/text-similarity-babbage-001" | "openai/text-similarity-ada-001" | "openai/text-search-davinci-doc-001" | "openai/text-search-curie-doc-001" | "openai/text-search-babbage-doc-001" | "openai/text-search-ada-doc-001" | "openai/code-search-babbage-code-001" | "openai/code-search-ada-code-001" | "openai/gpt2" | "openai/gpt-3.5-turbo" | "openai/gpt-3.5-turbo-0301" | "openai/gpt-3.5-turbo-0613" | "openai/gpt-3.5-turbo-16k" | "openai/gpt-3.5-turbo-16k-0613" | "openai/gpt-4" | "openai/gpt-4-0314" | "openai/gpt-4-0613" | "openai/gpt-4-32k" | "openai/gpt-4-32k-0314" | "openai/gpt-4-32k-0613" | "huggingface/text-davinci-003" | "huggingface/text-davinci-002" | "huggingface/text-davinci-001" | "huggingface/text-curie-001" | "huggingface/text-babbage-001" | "huggingface/text-ada-001" | "huggingface/davinci" | "huggingface/curie" | "huggingface/babbage" | "huggingface/ada" | "huggingface/code-davinci-002" | "huggingface/code-davinci-001" | "huggingface/code-cushman-002" | "huggingface/code-cushman-001" | "huggingface/davinci-codex" | "huggingface/cushman-codex" | "huggingface/text-davinci-edit-001" | "huggingface/code-davinci-edit-001" | "huggingface/text-embedding-ada-002" | "huggingface/text-similarity-davinci-001" | "huggingface/text-similarity-curie-001" | "huggingface/text-similarity-babbage-001" | "huggingface/text-similarity-ada-001" | "huggingface/text-search-davinci-doc-001" | "huggingface/text-search-curie-doc-001" | "huggingface/text-search-babbage-doc-001" | "huggingface/text-search-ada-doc-001" | "huggingface/code-search-babbage-code-001" | "huggingface/code-search-ada-code-001" | "huggingface/gpt2" | "huggingface/gpt-3.5-turbo" | "huggingface/gpt-3.5-turbo-0301" | "huggingface/gpt-3.5-turbo-0613" | "huggingface/gpt-3.5-turbo-16k" | "huggingface/gpt-3.5-turbo-16k-0613" | "huggingface/gpt-4" | "huggingface/gpt-4-0314" | "huggingface/gpt-4-0613" | "huggingface/gpt-4-32k" | "huggingface/gpt-4-32k-0314" | "huggingface/gpt-4-32k-0613";
84
- openAIApiKey: string | undefined;
85
- huggingFaceHubApiKey: string | undefined;
86
- tokenLimit: number | undefined;
146
+ service: LLMServiceAlias;
147
+ openAIApiKey: string;
148
+ tokenLimit: number;
87
149
  interactive: boolean;
88
150
  help: boolean;
89
151
  verbose: boolean;
@@ -117,45 +179,7 @@ declare const _default: {
117
179
  options: Record<string, yargs.Options>;
118
180
  };
119
181
 
120
- type ServiceProvider = "openai" | "huggingface";
121
- type ServiceModel = TiktokenModel;
122
- type Service = `${ServiceProvider}/${ServiceModel}`;
123
- interface Config$1 {
124
- /**
125
- * The LLM model to use for generating results.
126
- *
127
- * @default 'openai/gpt-4'
128
- *
129
- * @example 'openai/gpt-4'
130
- * @example 'openai/gpt-3.5-turbo'
131
- * @example 'huggingface/bigscience/bloom'
132
- **/
133
- service?: Service;
134
- /**
135
- * The OpenAI API key.
136
- */
137
- openAIApiKey?: string;
138
- /**
139
- * The HuggingFace Hub API key.
140
- */
141
- huggingFaceHubApiKey?: string;
142
- /**
143
- * The maximum number of tokens per request.
144
- *
145
- * @default 1024
146
- */
147
- tokenLimit?: number;
148
- /**
149
- * The prompt text used for generating results.
150
- */
151
- prompt?: string;
152
- /**
153
- * The temperature value controls the randomness of the generated output.
154
- * Higher values (e.g., 0.8) make the output more random, while lower values (e.g., 0.2) make it more deterministic.
155
- *
156
- * @default 0.4
157
- */
158
- temperature?: number;
182
+ interface BaseConfig {
159
183
  /**
160
184
  * The output destination for the generated result.
161
185
  * - 'stdout': Prints the result to the standard output. This is the default behavior.
@@ -163,7 +187,7 @@ interface Config$1 {
163
187
  *
164
188
  * @default 'stdout'
165
189
  */
166
- mode?: 'stdout' | 'interactive';
190
+ mode: 'stdout' | 'interactive';
167
191
  /**
168
192
  * Enable verbose logging.
169
193
  *
@@ -176,6 +200,10 @@ interface Config$1 {
176
200
  * @default false
177
201
  */
178
202
  openInEditor?: boolean;
203
+ /**
204
+ * The prompt text used for generating results.
205
+ */
206
+ prompt?: string;
179
207
  /**
180
208
  * The prompt text used specifically for generating summaries of large files.
181
209
  */
@@ -201,16 +229,44 @@ interface Config$1 {
201
229
  *
202
230
  * @default 'main'
203
231
  */
204
- defaultBranch?: string;
232
+ defaultBranch: string;
233
+ }
234
+ interface OpenAIAliasConfig extends BaseConfig {
235
+ service: 'openai';
236
+ model?: OpenAILLMService['model'];
237
+ openAIApiKey: string;
238
+ }
239
+ interface OllamaAliasConfig extends BaseConfig {
240
+ service: 'ollama';
241
+ model?: OllamaLLMService['model'];
242
+ endpoint: string;
243
+ }
244
+ type ConfigWithServiceAlias = (OpenAIAliasConfig | OllamaAliasConfig) & Partial<BaseCommandOptions>;
245
+ type ConfigWithServiceObject = BaseConfig & Partial<BaseCommandOptions> & {
246
+ service: LLMService;
247
+ };
248
+ type Config$1 = ConfigWithServiceAlias | ConfigWithServiceObject;
249
+
250
+ interface BaseArgvOptions {
251
+ [x: string]: unknown;
252
+ interactive: boolean;
253
+ help: boolean;
254
+ verbose: boolean;
255
+ }
256
+ interface BaseCommandOptions extends BaseArgvOptions {
257
+ service: LLMServiceAlias;
258
+ openAIApiKey: string;
259
+ tokenLimit: number;
205
260
  }
206
261
 
207
262
  /**
208
263
  * Get LLM Model Based on Configuration
264
+ *
209
265
  * @param fields
210
266
  * @param configuration
211
267
  * @returns LLM Model
212
268
  */
213
- declare function getLlm(service: Config$1['service'], key: string, fields?: (Partial<OpenAIInput> & Partial<AzureOpenAIInput> & BaseLLMParams) | undefined): OpenAI | HuggingFaceInference;
269
+ declare function getLlm(provider: 'openai' | 'ollama', model: TiktokenModel | OllamaModel, config: Config$1): Ollama | OpenAI<langchain_llms_openai.OpenAICallOptions>;
214
270
 
215
271
  interface LoggerOptions {
216
272
  color?: typeof Color;
@@ -236,7 +292,7 @@ declare class Logger {
236
292
  }
237
293
 
238
294
  type TokenCounter = Awaited<ReturnType<typeof getTokenCounter>>;
239
- declare const getTokenCounter: (modelName: ServiceModel) => Promise<(text: string) => number>;
295
+ declare const getTokenCounter: (modelName: TiktokenModel) => Promise<(text: string) => number>;
240
296
 
241
297
  type FileChangeStatus = 'modified' | 'renamed' | 'added' | 'deleted' | 'untracked' | 'unknown';
242
298
  interface FileChange {