Spaces:
Sleeping
Sleeping
Download src/routes/messages/utils.ts from imspsycho/copilot-api: direct link, hf CLI and curl.
- Browser
- Download file 459 Bytes
-
https://huggingface.co/spaces/imspsycho/copilot-api/resolve/main/src/routes/messages/utils.ts
- Command line
-
hf download hf://spaces/imspsycho/copilot-api/src/routes/messages/utils.ts
-
curl -L -o utils.ts https://huggingface.co/spaces/imspsycho/copilot-api/resolve/main/src/routes/messages/utils.ts
459 Bytes
| import { type AnthropicResponse } from "./anthropic-types" | |
| export function mapOpenAIStopReasonToAnthropic( | |
| finishReason: "stop" | "length" | "tool_calls" | "content_filter" | null, | |
| ): AnthropicResponse["stop_reason"] { | |
| if (finishReason === null) { | |
| return null | |
| } | |
| const stopReasonMap = { | |
| stop: "end_turn", | |
| length: "max_tokens", | |
| tool_calls: "tool_use", | |
| content_filter: "end_turn", | |
| } as const | |
| return stopReasonMap[finishReason] | |
| } | |