openlayer 0.1.2 → 0.1.4

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/index.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  import { RequestOptions } from 'openai/core';
2
2
  import { ChatCompletion, ChatCompletionChunk, ChatCompletionCreateParams, Completion, CompletionCreateParams } from 'openai/resources';
3
3
  import { Stream } from 'openai/streaming';
4
+ export interface ChatCompletionData {
5
+ input: string | string[] | number[] | number[][] | null;
6
+ latency: number;
7
+ output: string | null;
8
+ timestamp: number;
9
+ tokens?: number;
10
+ }
4
11
  type ConstructorProps = {
5
12
  openAiApiKey: string;
6
13
  openlayerApiKey?: string;
@@ -19,7 +26,7 @@ declare class OpenAIMonitor {
19
26
  constructor({ openAiApiKey, openlayerApiKey, openlayerInferencePipelineName, openlayerProjectName, openlayerServerUrl, }: ConstructorProps);
20
27
  private formatChatCompletionInput;
21
28
  private resolvedQuery;
22
- private uploadDataToOpenlayer;
29
+ uploadDataToOpenlayer: (data: ChatCompletionData) => Promise<void>;
23
30
  startMonitoring(): void;
24
31
  stopMonitoring(): void;
25
32
  createChatCompletion: (body: ChatCompletionCreateParams, options?: RequestOptions) => Promise<ChatCompletion | Stream<ChatCompletionChunk>>;
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ class OpenAIMonitor {
46
46
  timestampColumnName: 'timestamp',
47
47
  },
48
48
  rows: [
49
- Object.assign(Object.assign({}, data), { id: (0, uuid_1.v4)(), timestamp: data.timestamp / 1000 }),
49
+ Object.assign(Object.assign({}, data), { id: (0, uuid_1.v4)(), timestamp: Math.round(data.timestamp / 1000) }),
50
50
  ],
51
51
  }),
52
52
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openlayer",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "The Openlayer TypeScript client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",