@cellaware/utils 5.0.6 → 5.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/README.md CHANGED
@@ -26,6 +26,10 @@ Azure Cosmos database key.
26
26
 
27
27
  Connection string of Azure Storage account.
28
28
 
29
+ ### COMMUNICATION_SERVICES_CONNECTION_STRING
30
+
31
+ Connection string of Azure Communication Services account.
32
+
29
33
  ### GITHUB_TOKEN
30
34
 
31
35
  Token used for GitHub authorization.
@@ -0,0 +1,3 @@
1
+ import { EmailAttachment, EmailClient, EmailContent } from "@azure/communication-email";
2
+ export declare function initEmailClient(): EmailClient;
3
+ export declare function emailSend(client: EmailClient, senderAddress: string, recipients: string[], content: EmailContent, attachments?: EmailAttachment[]): Promise<import("@azure/core-lro").PollerLike<import("@azure/core-lro").PollOperationState<import("@azure/communication-email").EmailSendResponse>, import("@azure/communication-email").EmailSendResponse>>;
@@ -0,0 +1,20 @@
1
+ import { EmailClient } from "@azure/communication-email";
2
+ export function initEmailClient() {
3
+ return new EmailClient(process.env.COMMUNICATION_SERVICES_CONNECTION_STRING ?? '');
4
+ }
5
+ export async function emailSend(client, senderAddress, recipients, content, attachments) {
6
+ const message = {
7
+ senderAddress,
8
+ content,
9
+ recipients: {
10
+ to: recipients.map(address => {
11
+ return {
12
+ address,
13
+ displayName: "Recipient",
14
+ };
15
+ }),
16
+ },
17
+ attachments
18
+ };
19
+ return client.beginSend(message);
20
+ }
package/dist/llm/cost.js CHANGED
@@ -44,7 +44,7 @@ export function getLLMCostPerToken(modelName) {
44
44
  outputCost = 4.40;
45
45
  break;
46
46
  default:
47
- throw new Error(`LLM: Model '${modelName}' cost is not configured`);
47
+ throw new Error(`Model '${modelName}' cost is not configured`);
48
48
  }
49
49
  // OpenAI model costs are measured in millions of tokens -- therefore we need to divide each figure by 1,000,000 before returning.
50
50
  const unit = 1_000_000.0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "5.0.6",
3
+ "version": "5.1.0",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",
@@ -16,11 +16,12 @@
16
16
  "license": "UNLICENSED",
17
17
  "homepage": "https://cellaware.com",
18
18
  "dependencies": {
19
+ "@azure/communication-email": "^1.0.0",
19
20
  "@azure/cosmos": "^3.17.0",
20
21
  "@azure/functions": "^4.5.1",
21
22
  "@azure/storage-blob": "^12.16.0",
22
- "langchain": "^0.0.170",
23
- "dotenv": "^16.3.1"
23
+ "dotenv": "^16.3.1",
24
+ "langchain": "^0.0.170"
24
25
  },
25
26
  "devDependencies": {
26
27
  "typescript": "^5.3.2"