@lota-sdk/core 0.4.40 → 0.4.41
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lota-sdk/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.41",
|
|
4
4
|
"files": [
|
|
5
5
|
"src",
|
|
6
6
|
"infrastructure/schema"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@ai-sdk/provider": "^3.0.9",
|
|
33
33
|
"@chat-adapter/slack": "^4.26.0",
|
|
34
34
|
"@chat-adapter/state-ioredis": "^4.26.0",
|
|
35
|
-
"@lota-sdk/shared": "0.4.
|
|
35
|
+
"@lota-sdk/shared": "0.4.41",
|
|
36
36
|
"@mendable/firecrawl-js": "^4.20.0",
|
|
37
37
|
"@surrealdb/node": "^3.0.3",
|
|
38
38
|
"ai": "^6.0.170",
|
|
@@ -5,7 +5,7 @@ import { z } from 'zod'
|
|
|
5
5
|
import type { CoreThreadProfile } from '../config/agent-defaults'
|
|
6
6
|
import type { AgentFactory, AgentRuntimeConfigProvider, AgentToolBuilder } from '../config/agent-types'
|
|
7
7
|
import { DEFAULT_AI_GATEWAY_URL } from '../config/constants'
|
|
8
|
-
import {
|
|
8
|
+
import { AI_GATEWAY_FAST_RERANK_MODEL_ID } from '../config/model-constants'
|
|
9
9
|
import type { LotaThreadConfig, ThreadBootstrapWelcomeConfig } from '../config/thread-defaults'
|
|
10
10
|
import type { RecordIdRef } from '../db/record-id'
|
|
11
11
|
import type { NotificationService } from '../services/notification.service'
|
|
@@ -239,13 +239,13 @@ export const LotaRuntimeConfigSchema = z.object({
|
|
|
239
239
|
searchK: z.coerce.number().int().positive().default(6),
|
|
240
240
|
embeddingCacheTtlSeconds: z.coerce.number().int().positive().default(7200),
|
|
241
241
|
rerankerStrategy: MemoryRerankerStrategySchema.default('rerank'),
|
|
242
|
-
rerankerModelId: z.string().trim().min(1).default(
|
|
242
|
+
rerankerModelId: z.string().trim().min(1).default(AI_GATEWAY_FAST_RERANK_MODEL_ID),
|
|
243
243
|
})
|
|
244
244
|
.default({
|
|
245
245
|
searchK: 6,
|
|
246
246
|
embeddingCacheTtlSeconds: 7200,
|
|
247
247
|
rerankerStrategy: 'rerank',
|
|
248
|
-
rerankerModelId:
|
|
248
|
+
rerankerModelId: AI_GATEWAY_FAST_RERANK_MODEL_ID,
|
|
249
249
|
}),
|
|
250
250
|
threads: threadConfigSchema.default({}),
|
|
251
251
|
agents: agentsConfigSchema,
|
|
@@ -342,7 +342,7 @@ export const lotaRuntimeEnvConfig = Config.all({
|
|
|
342
342
|
memorySearchK: Config.number('MEMORY_SEARCH_K').pipe(Config.withDefault(6)),
|
|
343
343
|
memoryRerankerStrategy: Config.string('MEMORY_RERANKER_STRATEGY').pipe(Config.withDefault('rerank')),
|
|
344
344
|
memoryRerankerModelId: Config.string('MEMORY_RERANKER_MODEL_ID').pipe(
|
|
345
|
-
Config.withDefault(
|
|
345
|
+
Config.withDefault(AI_GATEWAY_FAST_RERANK_MODEL_ID),
|
|
346
346
|
),
|
|
347
347
|
otlpBaseUrl: Config.string('OTLP_BASE_URL').pipe(Config.option),
|
|
348
348
|
otlpServiceName: Config.string('OTLP_SERVICE_NAME').pipe(Config.withDefault('lota-sdk')),
|
|
@@ -2,7 +2,7 @@ import { Context, Effect, Layer } from 'effect'
|
|
|
2
2
|
import * as Schema from 'effect/Schema'
|
|
3
3
|
import { z } from 'zod'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { AI_GATEWAY_FAST_RERANK_MODEL_ID } from '../../config/model-constants'
|
|
6
6
|
import { ConfigurationError, ERROR_TAGS } from '../../effect/errors'
|
|
7
7
|
import { RuntimeConfigServiceTag } from '../../effect/services'
|
|
8
8
|
import { toValidationError } from '../../effect/zod'
|
|
@@ -11,6 +11,7 @@ import type { ResolvedLotaRuntimeConfig } from '../../runtime/runtime-config'
|
|
|
11
11
|
const AI_GATEWAY_VIRTUAL_KEY_HEADER = 'x-bf-vk' as const
|
|
12
12
|
const EXPECTED_GATEWAY_KEY_PREFIX = 'sk-bf-' as const
|
|
13
13
|
const OPENROUTER_MODEL_PREFIX = 'openrouter/' as const
|
|
14
|
+
const LEGACY_COHERE_RERANK_MODEL_IDS = new Set(['cohere/rerank-4-fast', 'openrouter/cohere/rerank-4-fast'])
|
|
14
15
|
|
|
15
16
|
const RerankRequestBodySchema = Schema.Struct({
|
|
16
17
|
model: Schema.String,
|
|
@@ -58,6 +59,8 @@ function normalizeRerankModelId(modelId: string): string {
|
|
|
58
59
|
throw new ConfigurationError({ message: 'Rerank model id is required.', key: 'rerankModelId' })
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
if (LEGACY_COHERE_RERANK_MODEL_IDS.has(normalized)) return AI_GATEWAY_FAST_RERANK_MODEL_ID
|
|
63
|
+
|
|
61
64
|
return normalized.startsWith(OPENROUTER_MODEL_PREFIX) ? normalized.slice(OPENROUTER_MODEL_PREFIX.length) : normalized
|
|
62
65
|
}
|
|
63
66
|
|
|
@@ -137,7 +140,7 @@ export function makeRerankService(config: ResolvedLotaRuntimeConfig) {
|
|
|
137
140
|
const configured = readConfiguredRerankModelId()
|
|
138
141
|
if (configured) return normalizeRerankModelId(configured)
|
|
139
142
|
|
|
140
|
-
return
|
|
143
|
+
return AI_GATEWAY_FAST_RERANK_MODEL_ID
|
|
141
144
|
}
|
|
142
145
|
|
|
143
146
|
return {
|