MCPcopy Index your code
hub / github.com/github/copilot-sdk / transformHttpExchange

Function transformHttpExchange

test/harness/replayingCapiProxy.ts:968–983  ·  view source on GitHub ↗
(
  requestBody: string,
  responseBody: string | undefined,
)

Source from the content-addressed store, hash-verified

966
967// Converts a single HTTP exchange (request + response) into a normalized conversation
968async function transformHttpExchange(
969 requestBody: string,
970 responseBody: string | undefined,
971): Promise<{ conversation: NormalizedConversation; model?: string }> {
972 const { request, response } = await parseHttpExchange(
973 requestBody,
974 responseBody,
975 );
976 const messages = request.messages.map(transformOpenAIRequestMessage);
977
978 if (response?.choices?.length) {
979 messages.push(...transformOpenAIResponseChoice(response.choices));
980 }
981
982 return { conversation: { messages }, model: request.model };
983}
984
985// Transforms a single OpenAI-style outbound request message into normalized form
986// We use this to look up whether we already have a cached response for it

Callers 1

transformHttpExchangesFunction · 0.85

Calls 3

parseHttpExchangeFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…