@effect/ai-openai-compat 4.0.3 → 4.0.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.
@@ -115,17 +115,14 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
115
115
  options,
116
116
  toolNameMapper
117
117
  }) {
118
- const include = new Set();
119
- const capabilities = getModelCapabilities(config.model);
120
118
  const messages = yield* prepareMessages({
121
119
  config,
122
120
  options,
123
- capabilities,
124
- include,
125
121
  toolNameMapper
126
122
  });
127
123
  const {
128
124
  toolChoice,
125
+ toolCodecs,
129
126
  tools
130
127
  } = yield* prepareTools({
131
128
  config,
@@ -143,8 +140,6 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
143
140
  } = config;
144
141
  const request = {
145
142
  ...apiConfig,
146
- input: messages,
147
- include: include.size > 0 ? Array.from(include) : null,
148
143
  text: {
149
144
  verbosity: config.text?.verbosity ?? null,
150
145
  format: responseFormat
@@ -156,14 +151,20 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
156
151
  tool_choice: toolChoice
157
152
  } : undefined)
158
153
  };
159
- return toChatCompletionsRequest(request);
154
+ return {
155
+ request: toChatCompletionsRequest(request, messages),
156
+ toolCodecs
157
+ };
160
158
  });
161
159
  return yield* LanguageModel.make({
162
160
  codecTransformer: toCodecOpenAI,
163
161
  generateText: Effect.fnUntraced(function* (options) {
164
162
  const config = yield* makeConfig;
165
163
  const toolNameMapper = new Tool.NameMapper(options.tools);
166
- const request = yield* makeRequest({
164
+ const {
165
+ request,
166
+ toolCodecs
167
+ } = yield* makeRequest({
167
168
  config,
168
169
  options,
169
170
  toolNameMapper
@@ -175,13 +176,17 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
175
176
  options,
176
177
  rawResponse,
177
178
  response,
178
- toolNameMapper
179
+ toolNameMapper,
180
+ toolCodecs
179
181
  });
180
182
  }),
181
183
  streamText: Effect.fnUntraced(function* (options) {
182
184
  const config = yield* makeConfig;
183
185
  const toolNameMapper = new Tool.NameMapper(options.tools);
184
- const request = yield* makeRequest({
186
+ const {
187
+ request,
188
+ toolCodecs
189
+ } = yield* makeRequest({
185
190
  config,
186
191
  options,
187
192
  toolNameMapper
@@ -192,7 +197,8 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
192
197
  options,
193
198
  stream,
194
199
  response,
195
- toolNameMapper
200
+ toolNameMapper,
201
+ toolCodecs
196
202
  });
197
203
  }, (effect, options) => effect.pipe(Stream.unwrap, Stream.map(response => {
198
204
  annotateStreamResponse(options.span, response);
@@ -247,18 +253,8 @@ const getSystemMessageMode = model => model.startsWith("o") || model.startsWith(
247
253
  const prepareMessages = /*#__PURE__*/Effect.fnUntraced(function* ({
248
254
  config,
249
255
  options,
250
- capabilities,
251
- include,
252
256
  toolNameMapper
253
257
  }) {
254
- const hasConversation = Predicate.isNotNullish(config.conversation);
255
- // Handle Included Features
256
- if (config.top_logprobs !== undefined) {
257
- include.add("message.output_text.logprobs");
258
- }
259
- if (config.store === false && capabilities.isReasoningModel) {
260
- include.add("reasoning.encrypted_content");
261
- }
262
258
  const messages = [];
263
259
  for (const message of options.prompt.content) {
264
260
  switch (message.role) {
@@ -340,153 +336,64 @@ const prepareMessages = /*#__PURE__*/Effect.fnUntraced(function* ({
340
336
  }
341
337
  messages.push({
342
338
  role: "user",
343
- content
339
+ content: toChatMessageContent(content)
344
340
  });
345
341
  break;
346
342
  }
347
343
  case "assistant":
348
344
  {
349
- const reasoningMessages = Object.create(null);
345
+ let content = null;
346
+ let reasoning = "";
347
+ let reasoningField;
348
+ const toolCalls = [];
350
349
  for (const part of message.content) {
351
350
  switch (part.type) {
352
351
  case "text":
353
352
  {
354
- const id = getItemId(part);
355
- // When in conversation mode, skip items that already exist in the
356
- // conversation context to avoid "Duplicate item found" errors
357
- if (hasConversation && Predicate.isNotNull(id)) {
358
- break;
359
- }
360
- if (config.store === true && Predicate.isNotNull(id)) {
361
- messages.push({
362
- type: "item_reference",
363
- id
364
- });
365
- break;
366
- }
367
- messages.push({
368
- id: id,
369
- type: "message",
370
- role: "assistant",
371
- status: part.options.openai?.status ?? "completed",
372
- content: [{
373
- type: "output_text",
374
- text: part.text,
375
- annotations: part.options.openai?.annotations ?? [],
376
- logprobs: []
377
- }]
378
- });
353
+ content = (content ?? "") + part.text;
379
354
  break;
380
355
  }
381
356
  case "reasoning":
382
357
  {
383
- const id = getItemId(part);
384
- const encryptedContent = getEncryptedContent(part);
385
- if (hasConversation && Predicate.isNotNull(id)) {
386
- break;
387
- }
388
- if (Predicate.isNotNull(id)) {
389
- const message = reasoningMessages[id];
390
- if (config.store === true) {
391
- // Use item references to refer to reasoning (single reference)
392
- // when the first part is encountered
393
- if (Predicate.isUndefined(message)) {
394
- messages.push({
395
- type: "item_reference",
396
- id
397
- });
398
- // Store unused reasoning message to mark its id as used
399
- reasoningMessages[id] = {
400
- type: "reasoning",
401
- id,
402
- summary: []
403
- };
404
- }
405
- } else {
406
- const summaryParts = [];
407
- if (part.text.length > 0) {
408
- summaryParts.push({
409
- type: "summary_text",
410
- text: part.text
411
- });
412
- }
413
- if (Predicate.isUndefined(message)) {
414
- reasoningMessages[id] = {
415
- type: "reasoning",
416
- id,
417
- summary: summaryParts,
418
- encrypted_content: encryptedContent ?? null
419
- };
420
- messages.push(reasoningMessages[id]);
421
- } else {
422
- message.summary.push(...summaryParts);
423
- // Update encrypted content to enable setting it in the
424
- // last summary part
425
- if (Predicate.isNotNull(encryptedContent)) {
426
- message.encrypted_content = encryptedContent;
427
- }
428
- }
429
- }
430
- }
358
+ reasoning += part.text;
359
+ reasoningField ??= part.options.openai?.reasoningField ?? undefined;
431
360
  break;
432
361
  }
433
362
  case "tool-call":
434
363
  {
435
- const id = getItemId(part);
436
- const status = getStatus(part);
437
- if (hasConversation && Predicate.isNotNull(id)) {
438
- break;
439
- }
440
- if (config.store && Predicate.isNotNull(id)) {
441
- messages.push({
442
- type: "item_reference",
443
- id
444
- });
445
- break;
446
- }
447
364
  if (part.providerExecuted) {
448
365
  break;
449
366
  }
450
- const toolName = toolNameMapper.getProviderName(part.name);
451
367
  const extraContent = getExtraContent(part);
452
- messages.push({
453
- type: "function_call",
454
- name: toolName,
455
- call_id: part.id,
456
- arguments: JSON.stringify(part.params),
368
+ toolCalls.push({
369
+ id: part.id,
370
+ type: "function",
371
+ function: {
372
+ name: toolNameMapper.getProviderName(part.name),
373
+ arguments: JSON.stringify(part.params)
374
+ },
457
375
  ...(Predicate.isNotNull(extraContent) ? {
458
376
  extra_content: extraContent
459
- } : {}),
460
- ...(Predicate.isNotNull(id) ? {
461
- id
462
- } : {}),
463
- ...(Predicate.isNotNull(status) ? {
464
- status
465
- } : {})
377
+ } : undefined)
466
378
  });
467
379
  break;
468
380
  }
469
- // Assistant tool-result parts are always provider executed
470
- case "tool-result":
471
- {
472
- // Skip execution denied results - these have no corresponding
473
- // item in OpenAI's store
474
- if (Predicate.hasProperty(part.result, "type") && part.result.type === "execution-denied") {
475
- break;
476
- }
477
- if (hasConversation) {
478
- break;
479
- }
480
- if (config.store === true) {
481
- const id = getItemId(part) ?? part.id;
482
- messages.push({
483
- type: "item_reference",
484
- id
485
- });
486
- }
487
- }
488
381
  }
489
382
  }
383
+ // Text, reasoning and tool calls from one prompt message are sent as a
384
+ // single chat message so reasoning stays attached to its tool calls
385
+ if (content !== null || toolCalls.length > 0) {
386
+ messages.push({
387
+ role: "assistant",
388
+ content,
389
+ ...(reasoning.length > 0 ? {
390
+ [reasoningField ?? "reasoning_content"]: reasoning
391
+ } : undefined),
392
+ ...(toolCalls.length > 0 ? {
393
+ tool_calls: toolCalls
394
+ } : undefined)
395
+ });
396
+ }
490
397
  break;
491
398
  }
492
399
  case "tool":
@@ -495,14 +402,10 @@ const prepareMessages = /*#__PURE__*/Effect.fnUntraced(function* ({
495
402
  if (part.type === "tool-approval-response") {
496
403
  continue;
497
404
  }
498
- const status = getStatus(part);
499
405
  messages.push({
500
- type: "function_call_output",
501
- call_id: part.id,
502
- output: typeof part.result === "string" ? part.result : JSON.stringify(part.result),
503
- ...(Predicate.isNotNull(status) ? {
504
- status
505
- } : {})
406
+ role: "tool",
407
+ tool_call_id: part.id,
408
+ content: typeof part.result === "string" ? part.result : JSON.stringify(part.result)
506
409
  });
507
410
  }
508
411
  break;
@@ -530,7 +433,8 @@ const makeResponse = /*#__PURE__*/Effect.fnUntraced(function* ({
530
433
  options,
531
434
  rawResponse,
532
435
  response,
533
- toolNameMapper
436
+ toolNameMapper,
437
+ toolCodecs
534
438
  }) {
535
439
  let hasToolCalls = false;
536
440
  const parts = [];
@@ -545,11 +449,17 @@ const makeResponse = /*#__PURE__*/Effect.fnUntraced(function* ({
545
449
  const choice = rawResponse.choices[0];
546
450
  const message = choice?.message;
547
451
  if (message !== undefined) {
548
- const reasoning = message.reasoning ?? message.reasoning_content;
549
- if (Predicate.isNotNullish(reasoning) && reasoning.length > 0) {
452
+ const reasoningField = getResponseReasoningField(message);
453
+ const reasoning = reasoningField !== undefined ? message[reasoningField] : undefined;
454
+ if (reasoningField !== undefined && Predicate.isNotNullish(reasoning) && reasoning.length > 0) {
550
455
  parts.push({
551
456
  type: "reasoning",
552
- text: reasoning
457
+ text: reasoning,
458
+ metadata: {
459
+ openai: {
460
+ reasoningField
461
+ }
462
+ }
553
463
  });
554
464
  }
555
465
  if (message.content !== undefined && Predicate.isNotNull(message.content) && message.content.length > 0) {
@@ -574,7 +484,7 @@ const makeResponse = /*#__PURE__*/Effect.fnUntraced(function* ({
574
484
  })
575
485
  })
576
486
  });
577
- const params = yield* transformToolCallParams(options.tools, toolName, toolParams);
487
+ const params = yield* transformToolCallParams(options, toolName, toolParams, toolCodecs);
578
488
  hasToolCalls = true;
579
489
  parts.push({
580
490
  type: "tool-call",
@@ -612,7 +522,8 @@ const makeStreamResponse = /*#__PURE__*/Effect.fnUntraced(function* ({
612
522
  options,
613
523
  stream,
614
524
  response,
615
- toolNameMapper
525
+ toolNameMapper,
526
+ toolCodecs
616
527
  }) {
617
528
  let serviceTier = undefined;
618
529
  let usage = undefined;
@@ -662,7 +573,7 @@ const makeStreamResponse = /*#__PURE__*/Effect.fnUntraced(function* ({
662
573
  })
663
574
  })
664
575
  });
665
- const params = yield* transformToolCallParams(options.tools, toolCall.name, parsedParams);
576
+ const params = yield* transformToolCallParams(options, toolCall.name, parsedParams, toolCodecs);
666
577
  parts.push({
667
578
  type: "tool-params-end",
668
579
  id: toolCall.id
@@ -724,8 +635,9 @@ const makeStreamResponse = /*#__PURE__*/Effect.fnUntraced(function* ({
724
635
  if (Predicate.isUndefined(choice)) {
725
636
  return parts;
726
637
  }
727
- const reasoningDelta = choice.delta?.reasoning ?? choice.delta?.reasoning_content;
728
- if (Predicate.isNotNullish(reasoningDelta) && reasoningDelta.length > 0) {
638
+ const reasoningField = Predicate.isNotNullish(choice.delta) ? getResponseReasoningField(choice.delta) : undefined;
639
+ const reasoningDelta = reasoningField !== undefined ? choice.delta?.[reasoningField] : undefined;
640
+ if (reasoningField !== undefined && Predicate.isNotNullish(reasoningDelta) && reasoningDelta.length > 0) {
729
641
  if (!reasoningStarted) {
730
642
  reasoningStarted = true;
731
643
  parts.push({
@@ -733,7 +645,8 @@ const makeStreamResponse = /*#__PURE__*/Effect.fnUntraced(function* ({
733
645
  id: reasoningId,
734
646
  metadata: {
735
647
  openai: {
736
- ...makeItemIdMetadata(reasoningId)
648
+ ...makeItemIdMetadata(reasoningId),
649
+ reasoningField
737
650
  }
738
651
  }
739
652
  });
@@ -905,30 +818,25 @@ const tryJsonSchema = (schema, method) => Effect.try({
905
818
  }),
906
819
  catch: error => unsupportedSchemaError(error, method)
907
820
  });
908
- const tryToolJsonSchema = (tool, method) => Effect.try({
909
- try: () => Tool.getJsonSchema(tool, {
910
- transformer: toCodecOpenAI
911
- }),
912
- catch: error => unsupportedSchemaError(error, method)
913
- });
914
- const transformToolCallParams = /*#__PURE__*/Effect.fnUntraced(function* (tools, toolName, toolParams) {
915
- const tool = tools.find(tool => tool.name === toolName);
821
+ const transformToolCallParams = /*#__PURE__*/Effect.fnUntraced(function* (options, toolName, toolParams, toolCodecs) {
822
+ const tool = options.tools.find(tool => tool.name === toolName);
916
823
  if (Predicate.isUndefined(tool)) {
824
+ if (options.toolCallValidation === "deferred") {
825
+ return toolParams;
826
+ }
917
827
  return yield* AiError.make({
918
828
  module: "OpenAiLanguageModel",
919
829
  method: "makeResponse",
920
830
  reason: new AiError.ToolNotFoundError({
921
831
  toolName,
922
- availableTools: tools.map(tool => tool.name)
832
+ availableTools: options.tools.map(tool => tool.name)
923
833
  })
924
834
  });
925
835
  }
926
836
  if (Tool.isDynamic(tool) && tool.jsonSchema !== undefined) {
927
837
  return toolParams;
928
838
  }
929
- const {
930
- codec
931
- } = yield* tryCodecTransform(tool.parametersSchema, "makeResponse");
839
+ const codec = toolCodecs.get(tool) ?? (yield* tryCodecTransform(tool.parametersSchema, "makeResponse")).codec;
932
840
  // Normalize valid parameters; leave invalid ones for Toolkit.
933
841
  return yield* Schema.decodeEffect(codec)(toolParams).pipe(Effect.flatMap(decoded => Schema.encodeUnknownEffect(tool.parametersSchema)(decoded)), Effect.orElseSucceed(() => toolParams));
934
842
  });
@@ -937,11 +845,13 @@ const prepareTools = /*#__PURE__*/Effect.fnUntraced(function* ({
937
845
  options,
938
846
  toolNameMapper
939
847
  }) {
848
+ const toolCodecs = new Map();
940
849
  // Return immediately if no tools are in the toolkit
941
850
  if (options.tools.length === 0) {
942
851
  return {
943
852
  tools: undefined,
944
- toolChoice: undefined
853
+ toolChoice: undefined,
854
+ toolCodecs
945
855
  };
946
856
  }
947
857
  const tools = [];
@@ -960,7 +870,15 @@ const prepareTools = /*#__PURE__*/Effect.fnUntraced(function* ({
960
870
  for (const tool of allowedTools) {
961
871
  if (Tool.isUserDefined(tool) || Tool.isDynamic(tool)) {
962
872
  const strict = Tool.getStrictMode(tool) ?? config.strictJsonSchema ?? true;
963
- const parameters = yield* tryToolJsonSchema(tool, "prepareTools");
873
+ let parameters;
874
+ if (Tool.isDynamic(tool) && tool.jsonSchema !== undefined) {
875
+ parameters = tool.jsonSchema;
876
+ } else {
877
+ const prepared = yield* tryCodecTransform(tool.parametersSchema, "prepareTools");
878
+ parameters = prepared.jsonSchema;
879
+ // Reused to normalize this tool's calls in the response.
880
+ toolCodecs.set(tool, prepared.codec);
881
+ }
964
882
  tools.push({
965
883
  type: "function",
966
884
  name: tool.name,
@@ -999,11 +917,11 @@ const prepareTools = /*#__PURE__*/Effect.fnUntraced(function* ({
999
917
  }
1000
918
  return {
1001
919
  tools,
1002
- toolChoice
920
+ toolChoice,
921
+ toolCodecs
1003
922
  };
1004
923
  });
1005
- const toChatCompletionsRequest = payload => {
1006
- const messages = toChatMessages(payload.input);
924
+ const toChatCompletionsRequest = (payload, messages) => {
1007
925
  const responseFormat = toChatResponseFormat(payload.text?.format);
1008
926
  const tools = payload.tools !== undefined ? payload.tools.map(toChatTool).filter(tool => tool !== undefined) : [];
1009
927
  const toolChoice = toChatToolChoice(payload.tool_choice);
@@ -1150,98 +1068,6 @@ const toChatTool = tool => {
1150
1068
  }
1151
1069
  return undefined;
1152
1070
  };
1153
- const toChatMessages = input => {
1154
- if (Predicate.isUndefined(input)) {
1155
- return [];
1156
- }
1157
- if (typeof input === "string") {
1158
- return [{
1159
- role: "user",
1160
- content: input
1161
- }];
1162
- }
1163
- const messages = [];
1164
- for (const item of input) {
1165
- if (Predicate.hasProperty(item, "type") && item.type === "function_call") {
1166
- const previous = messages.at(-1);
1167
- const toolCall = toChatToolCall(item);
1168
- if (previous?.role === "assistant" && previous.tool_calls !== undefined) {
1169
- messages[messages.length - 1] = {
1170
- ...previous,
1171
- tool_calls: [...previous.tool_calls, toolCall]
1172
- };
1173
- } else {
1174
- messages.push({
1175
- role: "assistant",
1176
- content: null,
1177
- tool_calls: [toolCall]
1178
- });
1179
- }
1180
- } else {
1181
- messages.push(...toChatMessagesFromItem(item));
1182
- }
1183
- }
1184
- return messages;
1185
- };
1186
- const toChatMessagesFromItem = item => {
1187
- if (Predicate.hasProperty(item, "type") && item.type === "message") {
1188
- return [{
1189
- role: item.role,
1190
- content: toAssistantChatMessageContent(item.content)
1191
- }];
1192
- }
1193
- if (Predicate.hasProperty(item, "role")) {
1194
- return [{
1195
- role: item.role,
1196
- content: toChatMessageContent(item.content)
1197
- }];
1198
- }
1199
- switch (item.type) {
1200
- case "function_call":
1201
- {
1202
- return [{
1203
- role: "assistant",
1204
- content: null,
1205
- tool_calls: [toChatToolCall(item)]
1206
- }];
1207
- }
1208
- case "function_call_output":
1209
- {
1210
- return [{
1211
- role: "tool",
1212
- tool_call_id: item.call_id,
1213
- content: stringifyJson(item.output)
1214
- }];
1215
- }
1216
- default:
1217
- {
1218
- return [];
1219
- }
1220
- }
1221
- };
1222
- const toChatToolCall = item => ({
1223
- id: item.call_id,
1224
- type: "function",
1225
- function: {
1226
- name: item.name,
1227
- arguments: item.arguments
1228
- },
1229
- ...(item.extra_content !== undefined ? {
1230
- extra_content: item.extra_content
1231
- } : undefined)
1232
- });
1233
- const toAssistantChatMessageContent = content => {
1234
- let text = "";
1235
- for (const part of content) {
1236
- if (part.type === "output_text" && typeof part.text === "string") {
1237
- text += part.text;
1238
- }
1239
- if (part.type === "refusal" && typeof part.refusal === "string") {
1240
- text += part.refusal;
1241
- }
1242
- }
1243
- return text;
1244
- };
1245
1071
  const toChatMessageContent = content => {
1246
1072
  if (typeof content === "string") {
1247
1073
  return content;
@@ -1303,15 +1129,12 @@ const toChatMessageContent = content => {
1303
1129
  }
1304
1130
  return parts;
1305
1131
  };
1306
- const stringifyJson = value => typeof value === "string" ? value : JSON.stringify(value);
1307
1132
  // =============================================================================
1308
1133
  // Utilities
1309
1134
  // =============================================================================
1310
1135
  const isFileId = (data, config) => config.fileIdPrefixes != null && config.fileIdPrefixes.some(prefix => data.startsWith(prefix));
1311
- const getItemId = part => part.options.openai?.itemId ?? null;
1312
- const getStatus = part => part.options.openai?.status ?? null;
1313
- const getEncryptedContent = part => part.options.openai?.encryptedContent ?? null;
1314
1136
  const getExtraContent = part => part.options.openai?.extraContent ?? null;
1137
+ const getResponseReasoningField = message => Predicate.isNotNullish(message.reasoning) ? "reasoning" : Predicate.isNotNullish(message.reasoning_content) ? "reasoning_content" : undefined;
1315
1138
  const getImageDetail = part => part.options.openai?.imageDetail ?? "auto";
1316
1139
  const makeItemIdMetadata = itemId => itemId !== undefined ? {
1317
1140
  itemId
@@ -1353,24 +1176,6 @@ const prepareResponseFormat = /*#__PURE__*/Effect.fnUntraced(function* ({
1353
1176
  type: "text"
1354
1177
  };
1355
1178
  });
1356
- const getModelCapabilities = modelId => {
1357
- const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
1358
- const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
1359
- // Use allowlist approach: only known reasoning models should use 'developer' role
1360
- // This prevents issues with fine-tuned models, third-party models, and custom models
1361
- const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("codex-mini") || modelId.startsWith("computer-use-preview") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
1362
- // https://platform.openai.com/docs/guides/latest-model#gpt-5-1-parameter-compatibility
1363
- // GPT-5.1 and GPT-5.2 support temperature, topP, logProbs when reasoningEffort is none
1364
- const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2");
1365
- const systemMessageMode = isReasoningModel ? "developer" : "system";
1366
- return {
1367
- supportsFlexProcessing,
1368
- supportsPriorityProcessing,
1369
- isReasoningModel,
1370
- systemMessageMode,
1371
- supportsNonReasoningParameters
1372
- };
1373
- };
1374
1179
  const getUsage = usage => {
1375
1180
  if (Predicate.isNullish(usage)) {
1376
1181
  return {