-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added claude api bot models extending langchain * Added @langchain/anthropic dependency * Added datastore config for claude api * Added claude api bots in all&api sections * Added vue component for claude api model settings * Enabled in settings panel for claude api bots * Added config for name display of bots * Refactored index.js added claude api logos , simplified display name Close #745
- Loading branch information
Showing
20 changed files
with
285 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ClaudeAPIBot from "./ClaudeAPIBot"; | ||
|
||
export default class ClaudeAPI20Bot extends ClaudeAPIBot { | ||
static _className = "ClaudeAPI20Bot"; | ||
static _logoFilename = "claudeapi-20-logo.png"; | ||
static _model = "claude-2.0"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ClaudeAPIBot from "./ClaudeAPIBot"; | ||
|
||
export default class ClaudeAPI21Bot extends ClaudeAPIBot { | ||
static _className = "ClaudeAPI21Bot"; | ||
static _logoFilename = "claudeapi-21-logo.png"; | ||
static _model = "claude-2.1"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import store from "@/store"; | ||
import LangChainBot from "../LangChainBot"; | ||
import { ChatAnthropic } from "@langchain/anthropic"; | ||
|
||
export default class ClaudeAPIBot extends LangChainBot { | ||
static _brandId = "claudeApi"; | ||
static _className = "ClaudeAPIBot"; | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
async _checkAvailability() { | ||
let available = false; | ||
|
||
if (store.state.claudeApi.apiKey) { | ||
this.setupModel(); | ||
available = true; | ||
} | ||
return available; | ||
} | ||
|
||
_setupModel() { | ||
const chatModel = new ChatAnthropic({ | ||
anthropicApiKey: store.state.claudeApi.apiKey, | ||
anthropicApiUrl: store.state.claudeApi.alterUrl | ||
? store.state.claudeApi.alterUrl | ||
: "", | ||
maxTokens: store.state.claudeApi.maxTokens, | ||
temperature: store.state.claudeApi.temperature, | ||
modelName: this.constructor._model ? this.constructor._model : "", | ||
streaming: true, | ||
}); | ||
|
||
return chatModel; | ||
} | ||
|
||
getPastRounds() { | ||
return store.state.claudeApi.pastRounds | ||
? store.state.claudeApiApi.pastRounds | ||
: 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ClaudeAPIBot from "./ClaudeAPIBot"; | ||
|
||
export default class ClaudeAPIHaikuBot extends ClaudeAPIBot { | ||
static _className = "ClaudeAPIHaikuBot"; | ||
static _logoFilename = "claudeapi-haiku-logo.png"; | ||
static _model = "claude-3-haiku-20240307"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ClaudeAPIBot from "./ClaudeAPIBot"; | ||
|
||
export default class ClaudeAPIInstant12Bot extends ClaudeAPIBot { | ||
static _className = "ClaudeAPIInstant12Bot"; | ||
static _logoFilename = "claudeapi-instant-12-logo.png"; | ||
static _model = "claude-instant-1.2"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ClaudeAPIBot from "./ClaudeAPIBot"; | ||
|
||
export default class ClaudeAPIOpusBot extends ClaudeAPIBot { | ||
static _className = "ClaudeAPIOpusBot"; | ||
static _logoFilename = "claudeapi-opus-logo.png"; | ||
static _model = "claude-3-opus-20240229"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ClaudeAPIBot from "./ClaudeAPIBot"; | ||
|
||
export default class ClaudeAPISonnetBot extends ClaudeAPIBot { | ||
static _className = "ClaudeAPISonnetBot"; | ||
static _logoFilename = "claudeapi-sonnet-logo.png"; | ||
static _model = "claude-3-sonnet-20240229"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<CommonBotSettings | ||
:settings="settings" | ||
:brand-id="brandId" | ||
mutation-type="setClaudeApi" | ||
:watcher="watcher" | ||
></CommonBotSettings> | ||
</template> | ||
|
||
<script> | ||
import _bots from "@/bots"; | ||
import Bot from "@/bots/anthropic/ClaudeAPIBot"; | ||
import CommonBotSettings from "@/components/BotSettings/CommonBotSettings.vue"; | ||
import { Type } from "./settings.const"; | ||
const settings = [ | ||
{ | ||
type: Type.Text, | ||
name: "apiKey", | ||
title: "claudeApi.apiKey", | ||
description: "settings.secretPrompt", | ||
placeholder: "sk-...", | ||
}, | ||
{ | ||
type: Type.Slider, | ||
name: "temperature", | ||
title: "openaiApi.temperature", | ||
description: "openaiApi.temperaturePrompt", | ||
min: 0, | ||
max: 1, | ||
step: 0.1, | ||
ticks: { | ||
0: "openaiApi.temperature0", | ||
1: "openaiApi.temperature2", | ||
}, | ||
}, | ||
{ | ||
type: Type.Text, | ||
name: "alterUrl", | ||
title: "openaiApi.alterUrl", | ||
description: "openaiApi.alterUrlPrompt", | ||
placeholder: "https://your.proxy.com/v1", | ||
}, | ||
]; | ||
export default { | ||
components: { | ||
CommonBotSettings, | ||
}, | ||
data() { | ||
return { | ||
settings: settings, | ||
brandId: Bot._brandId, | ||
}; | ||
}, | ||
methods: { | ||
watcher() { | ||
_bots.all | ||
.filter((bot) => bot instanceof Bot) | ||
.map((bot) => bot.setupModel()); | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.