makes claude3 compat model customizable via environment variable

This commit is contained in:
nai-degen 2024-03-04 14:17:29 -06:00
parent 36923686f6
commit 90ddcac55b
2 changed files with 6 additions and 5 deletions

View File

@ -17,6 +17,9 @@ import {
createOnProxyResHandler,
} from "./middleware/response";
const CLAUDE_3_COMPAT_MODEL =
process.env.CLAUDE_3_COMPAT_MODEL || "claude-3-sonnet-20240229";
let modelsCache: any = null;
let modelsCacheTime = 0;
@ -249,11 +252,7 @@ anthropicRouter.post(
createPreprocessorMiddleware(
{ inApi: "anthropic-text", outApi: "anthropic-chat", service: "anthropic" },
{
beforeTransform: [
(req) => {
req.body.model = "claude-3-sonnet-20240229";
},
],
beforeTransform: [(req) => void (req.body.model = CLAUDE_3_COMPAT_MODEL)],
}
),
anthropicProxy

View File

@ -12,6 +12,8 @@ const POZZED_RESPONSES = [
/respond as helpfully/i,
/be very careful to ensure/i,
/song lyrics, sections of books, or long excerpts/i,
/previous text not shown/i,
/reproducing copyrighted material/i,
];
type CompleteResponse = {