nsarrazin commited on
Commit
2fadb30
·
1 Parent(s): 0790b8b

feat: add custom headers support to endpoint inference client

Browse files
src/lib/server/endpoints/inference-client/endpointInferenceClient.ts CHANGED
@@ -107,12 +107,13 @@ export const endpointInferenceClientParametersSchema = z.object({
107
  }),
108
  })
109
  .default({}),
 
110
  });
111
 
112
  export async function endpointInferenceClient(
113
  input: z.input<typeof endpointInferenceClientParametersSchema>
114
  ): Promise<Endpoint> {
115
- const { model, provider, modelName, baseURL, multimodal } =
116
  endpointInferenceClientParametersSchema.parse(input);
117
 
118
  if (!!provider && !!baseURL) {
@@ -255,6 +256,7 @@ export async function endpointInferenceClient(
255
  ...options?.headers,
256
  "X-Use-Cache": "false",
257
  "ChatUI-Conversation-ID": conversationId?.toString() ?? "",
 
258
  },
259
  });
260
  },
 
107
  }),
108
  })
109
  .default({}),
110
+ customHeaders: z.record(z.string(), z.string()).default({}),
111
  });
112
 
113
  export async function endpointInferenceClient(
114
  input: z.input<typeof endpointInferenceClientParametersSchema>
115
  ): Promise<Endpoint> {
116
+ const { model, provider, modelName, baseURL, multimodal, customHeaders } =
117
  endpointInferenceClientParametersSchema.parse(input);
118
 
119
  if (!!provider && !!baseURL) {
 
256
  ...options?.headers,
257
  "X-Use-Cache": "false",
258
  "ChatUI-Conversation-ID": conversationId?.toString() ?? "",
259
+ ...customHeaders,
260
  },
261
  });
262
  },