(payload: EmbeddingRequest)
| 3 | import { state } from "~/lib/state" |
| 4 | |
| 5 | export const createEmbeddings = async (payload: EmbeddingRequest) => { |
| 6 | if (!state.copilotToken) throw new Error("Copilot token not found") |
| 7 | |
| 8 | const response = await fetch(`${copilotBaseUrl(state)}/embeddings`, { |
| 9 | method: "POST", |
| 10 | headers: copilotHeaders(state), |
| 11 | body: JSON.stringify(payload), |
| 12 | }) |
| 13 | |
| 14 | if (!response.ok) throw new HTTPError("Failed to create embeddings", response) |
| 15 | |
| 16 | return (await response.json()) as EmbeddingResponse |
| 17 | } |
| 18 | |
| 19 | export interface EmbeddingRequest { |
| 20 | input: string | Array<string> |
no test coverage detected
searching dependent graphs…