@core-ai/langfuse 0.10.0 → 0.10.2

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
@@ -4,6 +4,9 @@
4
4
 
5
5
  Langfuse middleware for `@core-ai/core-ai`.
6
6
 
7
+ - [Langfuse](https://langfuse.com/)
8
+ - [Langfuse docs](https://langfuse.com/docs)
9
+
7
10
  ## Installation
8
11
 
9
12
  ```bash
package/dist/index.js CHANGED
@@ -53,17 +53,14 @@ function createImageModelParameters(options) {
53
53
  });
54
54
  }
55
55
  function createChatUsageDetails(usage) {
56
+ const { cacheReadTokens, cacheWriteTokens } = usage.inputTokenDetails;
57
+ const reasoningTokens = usage.outputTokenDetails.reasoningTokens ?? 0;
56
58
  return {
57
- inputTokens: usage.inputTokens,
58
- outputTokens: usage.outputTokens,
59
- totalTokens: usage.inputTokens + usage.outputTokens,
60
- promptTokens: usage.inputTokens,
61
- completionTokens: usage.outputTokens,
62
- cacheReadInputTokens: usage.inputTokenDetails.cacheReadTokens,
63
- cacheWriteInputTokens: usage.inputTokenDetails.cacheWriteTokens,
64
- ...usage.outputTokenDetails.reasoningTokens !== void 0 ? {
65
- reasoningOutputTokens: usage.outputTokenDetails.reasoningTokens
66
- } : {}
59
+ input: usage.inputTokens - cacheReadTokens - cacheWriteTokens,
60
+ output: usage.outputTokens - reasoningTokens,
61
+ cache_read_input: cacheReadTokens,
62
+ cache_creation_input: cacheWriteTokens,
63
+ ...usage.outputTokenDetails.reasoningTokens !== void 0 ? { reasoning_output: usage.outputTokenDetails.reasoningTokens } : {}
67
64
  };
68
65
  }
69
66
  function createEmbeddingUsageDetails(usage) {
@@ -71,9 +68,7 @@ function createEmbeddingUsageDetails(usage) {
71
68
  return void 0;
72
69
  }
73
70
  return {
74
- inputTokens: usage.inputTokens,
75
- totalTokens: usage.inputTokens,
76
- promptTokens: usage.inputTokens
71
+ input: usage.inputTokens
77
72
  };
78
73
  }
79
74
  function createChatOutput(result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@core-ai/langfuse",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Langfuse middleware for @core-ai/core-ai",
5
5
  "license": "MIT",
6
6
  "author": "Omnifact (https://omnifact.ai)",
@@ -41,7 +41,7 @@
41
41
  "test:watch": "vitest"
42
42
  },
43
43
  "dependencies": {
44
- "@core-ai/core-ai": "^0.10.0"
44
+ "@core-ai/core-ai": "^0.10.2"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@langfuse/otel": "^5.1.0",