@zodic/shared 0.0.46 → 0.0.47

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/api/index.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  BatchInputItem,
4
4
  BatchProcessingResult,
5
5
  BatchResponse,
6
+ ChatGPTBatchResponse,
6
7
  ChatGPTFileUploadResponse,
7
8
  ChatMessages,
8
9
  NatalChartInterpretation,
@@ -61,7 +62,7 @@ export const Api = (env: BackendBindings) => ({
61
62
  },
62
63
  batch: async (
63
64
  batchItems: BatchInputItem[]
64
- ): Promise<BatchProcessingResult[]> => {
65
+ ): Promise<ChatGPTBatchResponse> => {
65
66
  console.log('Preparing to send ChatGPT batch request.');
66
67
 
67
68
  const uploadEndpoint = 'https://api.openai.com/v1/files';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -11,7 +11,8 @@
11
11
  "migrate-latest": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1) --remote --yes",
12
12
  "db:generate": "drizzle-kit generate",
13
13
  "db:up": "drizzle-kit up",
14
- "pub": "npm run db:generate && npm run db:up && npm run migrate-latest && npm publish",
14
+ "pub:db": "npm run db:generate && npm run db:up && npm run migrate-latest && npm version patch && npm publish",
15
+ "pub": "npm version patch && npm publish",
15
16
  "reset-db": "wrangler d1 execute DB --command \"DROP TABLE IF EXISTS migrations;\" && npm run db:up && npm run migrate-latest"
16
17
  },
17
18
  "devDependencies": {
@@ -159,6 +159,44 @@ export type BatchResponse = {
159
159
  error?: any;
160
160
  };
161
161
 
162
+ export type ChatGPTBatchResponse = {
163
+ id: string; // Unique batch ID
164
+ object: string; // Object type (e.g., "batch")
165
+ endpoint: string; // Endpoint associated with the batch (e.g., "/v1/chat/completions")
166
+ errors: null | string; // Errors, if any
167
+ input_file_id: string; // ID of the input file
168
+ completion_window: string; // Time window for completions (e.g., "24h")
169
+ status:
170
+ | "validating"
171
+ | "in_progress"
172
+ | "finalizing"
173
+ | "completed"
174
+ | "failed"
175
+ | "expired"
176
+ | "cancelling"
177
+ | "cancelled"; // Current status of the batch
178
+ output_file_id: string | null; // ID of the output file, if available
179
+ error_file_id: string | null; // ID of the error file, if available
180
+ created_at: number; // Timestamp when the batch was created
181
+ in_progress_at: number | null; // Timestamp when processing started
182
+ expires_at: number | null; // Expiration timestamp
183
+ finalizing_at: number | null; // Timestamp when finalization started
184
+ completed_at: number | null; // Timestamp when the batch completed
185
+ failed_at: number | null; // Timestamp when the batch failed
186
+ expired_at: number | null; // Timestamp when the batch expired
187
+ cancelling_at: number | null; // Timestamp when cancellation started
188
+ cancelled_at: number | null; // Timestamp when the batch was cancelled
189
+ request_counts: {
190
+ total: number; // Total requests in the batch
191
+ completed: number; // Number of completed requests
192
+ failed: number; // Number of failed requests
193
+ };
194
+ metadata: {
195
+ customer_id: string; // Customer ID associated with the batch
196
+ batch_description: string; // Description of the batch
197
+ };
198
+ };
199
+
162
200
  export type BatchProcessingResult = {
163
201
  id: string;
164
202
  status: 'completed' | 'failed';