MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / hashRequest

Function hashRequest

app/src/server/utils/hashObject.ts:30–45  ·  view source on GitHub ↗
(
  modelId: string,
  reqPayload: z.infer<typeof chatCompletionInputReqPayload>,
)

Source from the content-addressed store, hash-verified

28}
29
30export function hashRequest(
31 modelId: string,
32 reqPayload: z.infer<typeof chatCompletionInputReqPayload>,
33): string {
34 const obj = {
35 modelId,
36 messages: reqPayload.messages,
37 function_call: reqPayload.function_call,
38 functions: reqPayload.functions,
39 tool_choice: reqPayload.tool_choice,
40 tools: reqPayload.tools,
41 max_tokens: reqPayload.max_tokens,
42 response_format: reqPayload.response_format,
43 };
44 return hashObject(obj as JsonValue);
45}
46
47export default function hashObject(obj: JsonValue): string {
48 // Sort object keys recursively

Calls 1

hashObjectFunction · 0.85

Tested by

no test coverage detected