Skip to content

Commit 28351df

Browse files
committed
feature(cohere): add clientName param to cohere endpoint
1 parent 01f4f3a commit 28351df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/server/endpoints/cohere/endpointCohere.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ export const endpointCohereParametersSchema = z.object({
1313
model: z.any(),
1414
type: z.literal("cohere"),
1515
apiKey: z.string().default(env.COHERE_API_TOKEN),
16+
clientName: z.string().optional(),
1617
raw: z.boolean().default(false),
1718
});
1819

1920
export async function endpointCohere(
2021
input: z.input<typeof endpointCohereParametersSchema>
2122
): Promise<Endpoint> {
22-
const { apiKey, model, raw } = endpointCohereParametersSchema.parse(input);
23+
const { apiKey, clientName, model, raw } = endpointCohereParametersSchema.parse(input);
2324

2425
let cohere: CohereClient;
2526

2627
try {
2728
cohere = new (await import("cohere-ai")).CohereClient({
2829
token: apiKey,
30+
clientName,
2931
});
3032
} catch (e) {
3133
throw new Error("Failed to import cohere-ai", { cause: e });

0 commit comments

Comments
 (0)