MCPcopy Index your code
hub / github.com/TanStack/ai / callSummarizeAPI

Function callSummarizeAPI

testing/panel/tests/helpers.ts:273–295  ·  view source on GitHub ↗
(
  request: APIRequestContext,
  baseURL: string,
  options: SummarizeOptions,
)

Source from the content-addressed store, hash-verified

271 * Call the summarize API directly (non-streaming)
272 */
273export async function callSummarizeAPI(
274 request: APIRequestContext,
275 baseURL: string,
276 options: SummarizeOptions,
277): Promise<{ summary: string; provider: string; model: string }> {
278 const response = await request.post(`${baseURL}/api/summarize`, {
279 data: {
280 text: options.text,
281 provider: options.provider,
282 model: options.model,
283 maxLength: options.maxLength || 100,
284 style: options.style || 'concise',
285 stream: false,
286 },
287 })
288
289 if (!response.ok()) {
290 const errorBody = await response.text()
291 throw new Error(`Summarize API failed: ${response.status()} - ${errorBody}`)
292 }
293
294 return response.json()
295}
296
297/**
298 * Call the summarize API with streaming

Callers 1

Calls 3

jsonMethod · 0.80
textMethod · 0.65
statusMethod · 0.45

Tested by

no test coverage detected