@cellaware/utils 7.0.4 → 7.1.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/dist/azure/cosmos.js +9 -5
- package/dist/llm/chain-store.js +1 -2
- package/package.json +1 -1
package/dist/azure/cosmos.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CosmosClient } from '@azure/cosmos';
|
|
1
|
+
import { ConnectionMode, CosmosClient } from '@azure/cosmos';
|
|
2
2
|
import { isDaylightSavingTime } from '../util.js';
|
|
3
3
|
const COSMOS_CURRENT_DATETIME = `GetCurrentDateTime()`;
|
|
4
4
|
const COSMOS_TIMESTAMP_DATETIME = `TimestampToDateTime(c._ts*1000)`;
|
|
@@ -164,7 +164,8 @@ export async function cosmosSelect(databaseId, collectionId, partitionKey, query
|
|
|
164
164
|
try {
|
|
165
165
|
const cosmosClient = new CosmosClient({
|
|
166
166
|
endpoint: process.env.COSMOS_DB_ENDPOINT ?? '',
|
|
167
|
-
key: process.env.COSMOS_DB_KEY ?? ''
|
|
167
|
+
key: process.env.COSMOS_DB_KEY ?? '',
|
|
168
|
+
connectionPolicy: { connectionMode: ConnectionMode.Gateway, enableEndpointDiscovery: false }
|
|
168
169
|
});
|
|
169
170
|
const { database } = await cosmosClient.databases.createIfNotExists({ id: databaseId });
|
|
170
171
|
const { container } = await database.containers.createIfNotExists({
|
|
@@ -182,7 +183,8 @@ export async function cosmosInsert(databaseId, collectionId, partitionKey, data)
|
|
|
182
183
|
try {
|
|
183
184
|
const cosmosClient = new CosmosClient({
|
|
184
185
|
endpoint: process.env.COSMOS_DB_ENDPOINT ?? '',
|
|
185
|
-
key: process.env.COSMOS_DB_KEY ?? ''
|
|
186
|
+
key: process.env.COSMOS_DB_KEY ?? '',
|
|
187
|
+
connectionPolicy: { connectionMode: ConnectionMode.Gateway, enableEndpointDiscovery: false }
|
|
186
188
|
});
|
|
187
189
|
const { database } = await cosmosClient.databases.createIfNotExists({ id: databaseId });
|
|
188
190
|
const { container } = await database.containers.createIfNotExists({
|
|
@@ -203,7 +205,8 @@ export async function cosmosDelete(databaseId, collectionId, partitionKey, query
|
|
|
203
205
|
try {
|
|
204
206
|
const cosmosClient = new CosmosClient({
|
|
205
207
|
endpoint: process.env.COSMOS_DB_ENDPOINT ?? '',
|
|
206
|
-
key: process.env.COSMOS_DB_KEY ?? ''
|
|
208
|
+
key: process.env.COSMOS_DB_KEY ?? '',
|
|
209
|
+
connectionPolicy: { connectionMode: ConnectionMode.Gateway, enableEndpointDiscovery: false }
|
|
207
210
|
});
|
|
208
211
|
const { database } = await cosmosClient.databases.createIfNotExists({ id: databaseId });
|
|
209
212
|
const { container } = await database.containers.createIfNotExists({
|
|
@@ -232,7 +235,8 @@ export async function cosmosUpdate(databaseId, collectionId, partitionKey, query
|
|
|
232
235
|
}
|
|
233
236
|
const cosmosClient = new CosmosClient({
|
|
234
237
|
endpoint: process.env.COSMOS_DB_ENDPOINT ?? '',
|
|
235
|
-
key: process.env.COSMOS_DB_KEY ?? ''
|
|
238
|
+
key: process.env.COSMOS_DB_KEY ?? '',
|
|
239
|
+
connectionPolicy: { connectionMode: ConnectionMode.Gateway, enableEndpointDiscovery: false }
|
|
236
240
|
});
|
|
237
241
|
const { database } = await cosmosClient.databases.createIfNotExists({ id: databaseId });
|
|
238
242
|
const { container } = await database.containers.createIfNotExists({
|
package/dist/llm/chain-store.js
CHANGED
|
@@ -238,7 +238,6 @@ Your translation here:
|
|
|
238
238
|
callbacks: [
|
|
239
239
|
{
|
|
240
240
|
handleLLMEnd: async (output) => {
|
|
241
|
-
console.log(output);
|
|
242
241
|
const usage = output?.llmOutput?.tokenUsage;
|
|
243
242
|
tokenUsages.push(ChainStore.getTokenUsage(chain._chainType(), chain.getModelName(), usage));
|
|
244
243
|
},
|
|
@@ -262,7 +261,7 @@ Your translation here:
|
|
|
262
261
|
*/
|
|
263
262
|
const AI_PREFIX = 'AI: ';
|
|
264
263
|
if (translationAnswerStr.includes(AI_PREFIX)) {
|
|
265
|
-
console.log(`
|
|
264
|
+
console.log(`CHAIN_STORE: Removing AI indicator from translation answer`);
|
|
266
265
|
translationAnswerStr = translationAnswerStr.substring(translationAnswerStr.indexOf(AI_PREFIX) + AI_PREFIX.length);
|
|
267
266
|
}
|
|
268
267
|
// Remove 'Your translation here:' if it is there.
|