1
1
import { cookies } from "next/headers" ;
2
2
import { NextRequest , NextResponse } from "next/server" ;
3
3
4
- import { createAnthropic } from "@ai-sdk/anthropic " ;
4
+ import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock " ;
5
5
import { searchClient } from "@algolia/client-search" ;
6
6
import { getEnv } from "@vercel/functions" ;
7
7
import { kv } from "@vercel/kv" ;
@@ -17,7 +17,7 @@ import {
17
17
import { COOKIE_FERN_TOKEN } from "@fern-docs/utils" ;
18
18
19
19
import { track } from "@/server/analytics/posthog" ;
20
- import { algoliaAppId , anthropicApiKey } from "@/server/env-variables" ;
20
+ import { algoliaAppId } from "@/server/env-variables" ;
21
21
import { getDocsDomainEdge } from "@/server/xfernhost/edge" ;
22
22
23
23
const DEPLOYMENT_ID = getEnv ( ) . VERCEL_DEPLOYMENT_ID ?? "development" ;
@@ -31,8 +31,12 @@ const BodySchema = z.object({
31
31
} ) ;
32
32
33
33
export async function POST ( req : NextRequest ) : Promise < Response > {
34
- const anthropic = createAnthropic ( { apiKey : anthropicApiKey ( ) } ) ;
35
- const languageModel = anthropic . languageModel ( "claude-3-5-haiku-latest" ) ;
34
+ const bedrock = createAmazonBedrock ( {
35
+ region : "us-east-1" ,
36
+ accessKeyId : process . env . AWS_ACCESS_KEY_ID ,
37
+ secretAccessKey : process . env . AWS_SECRET_ACCESS_KEY ,
38
+ } ) ;
39
+ const languageModel = bedrock ( "us.anthropic.claude-3-5-haiku-20241022-v1:0" ) ;
36
40
37
41
const start = Date . now ( ) ;
38
42
const domain = getDocsDomainEdge ( req ) ;
0 commit comments