doc2vec 2.10.2 → 2.10.3
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 +11 -0
- package/dist/doc2vec.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -151,6 +151,16 @@ Configuration is managed through two files:
|
|
|
151
151
|
OPENAI_API_KEY="sk-..."
|
|
152
152
|
OPENAI_MODEL="text-embedding-3-large" # Optional, defaults to text-embedding-3-large
|
|
153
153
|
|
|
154
|
+
# Optional: Override the OpenAI API base URL. Useful for pointing the
|
|
155
|
+
# OpenAI SDK at an OpenAI-compatible endpoint such as Ollama, LM Studio,
|
|
156
|
+
# llama.cpp, vLLM, or a proxy gateway. When unset, the SDK uses the
|
|
157
|
+
# default OpenAI endpoint. Equivalent to the `embedding.openai.base_url`
|
|
158
|
+
# field in config.yaml; the env var wins if both are set.
|
|
159
|
+
# Example values:
|
|
160
|
+
# OPENAI_BASE_URL="http://localhost:11434/v1" # Ollama
|
|
161
|
+
# OPENAI_BASE_URL="https://gateway.example.com/v1" # proxy / gateway
|
|
162
|
+
OPENAI_BASE_URL="http://localhost:11434/v1"
|
|
163
|
+
|
|
154
164
|
# Optional: Embedding dimension size (defaults to 3072)
|
|
155
165
|
EMBEDDING_DIMENSION="3072"
|
|
156
166
|
|
|
@@ -277,6 +287,7 @@ Configuration is managed through two files:
|
|
|
277
287
|
openai:
|
|
278
288
|
api_key: '${OPENAI_API_KEY}' # Optional, uses env var by default
|
|
279
289
|
model: 'text-embedding-3-large' # Optional, defaults to text-embedding-3-large
|
|
290
|
+
# base_url: 'http://localhost:11434/v1' # Optional, override OpenAI API base URL for Ollama / other OpenAI-compatible endpoints. Falls back to OPENAI_BASE_URL env var.
|
|
280
291
|
# For Azure OpenAI, use this instead:
|
|
281
292
|
# azure:
|
|
282
293
|
# api_key: '${AZURE_OPENAI_KEY}'
|
package/dist/doc2vec.js
CHANGED
|
@@ -96,13 +96,17 @@ class Doc2Vec {
|
|
|
96
96
|
else {
|
|
97
97
|
const openaiApiKey = embeddingConfig.openai?.api_key || process.env.OPENAI_API_KEY;
|
|
98
98
|
const openaiModel = embeddingConfig.openai?.model || process.env.OPENAI_MODEL || 'text-embedding-3-large';
|
|
99
|
+
const openaiBaseURL = embeddingConfig.openai?.base_url || process.env.OPENAI_BASE_URL;
|
|
99
100
|
if (!openaiApiKey) {
|
|
100
101
|
this.logger.error('OpenAI requires api_key to be configured');
|
|
101
102
|
process.exit(1);
|
|
102
103
|
}
|
|
103
|
-
this.openai = new openai_1.OpenAI({
|
|
104
|
+
this.openai = new openai_1.OpenAI({
|
|
105
|
+
apiKey: openaiApiKey,
|
|
106
|
+
...(openaiBaseURL && { baseURL: openaiBaseURL }),
|
|
107
|
+
});
|
|
104
108
|
this.embeddingModel = openaiModel;
|
|
105
|
-
this.logger.info(`Using OpenAI with model: ${openaiModel} (${this.embeddingDimension} dimensions)`);
|
|
109
|
+
this.logger.info(`Using OpenAI with model: ${openaiModel} (${this.embeddingDimension} dimensions)${openaiBaseURL ? ` via ${openaiBaseURL}` : ''}`);
|
|
106
110
|
}
|
|
107
111
|
this.contentProcessor = new content_processor_1.ContentProcessor(this.logger);
|
|
108
112
|
// Initialize Postgres markdown store if configured
|