mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
Add new OpenAI models 0125 (#258)
This commit is contained in:
parent
29b93b1fd5
commit
48ef0834ca
11 changed files with 38 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "copilot",
|
||||
"name": "Copilot",
|
||||
"version": "2.4.12",
|
||||
"version": "2.4.13",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "A ChatGPT Copilot in Obsidian.",
|
||||
"author": "Logan Yang",
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "obsidian-copilot",
|
||||
"version": "2.4.12",
|
||||
"version": "2.4.13",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "obsidian-copilot",
|
||||
"version": "2.4.12",
|
||||
"version": "2.4.13",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"@huggingface/inference": "^2.6.4",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-copilot",
|
||||
"version": "2.4.12",
|
||||
"version": "2.4.13",
|
||||
"description": "ChatGPT integration for Obsidian",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export default class EmbeddingManager {
|
|||
// If openAIProxyBaseUrl is set, it overrides both chat and embedding models.
|
||||
const OpenAIEmbeddingsAPI = openAIProxyBaseUrl ?
|
||||
new ProxyOpenAIEmbeddings({
|
||||
modelName: this.langChainParams.embeddingModel,
|
||||
openAIApiKey,
|
||||
maxRetries: 3,
|
||||
maxConcurrency: 3,
|
||||
|
|
@ -42,6 +43,7 @@ export default class EmbeddingManager {
|
|||
openAIProxyBaseUrl,
|
||||
}):
|
||||
new OpenAIEmbeddings({
|
||||
modelName: this.langChainParams.embeddingModel,
|
||||
openAIApiKey,
|
||||
maxRetries: 3,
|
||||
maxConcurrency: 3,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ export interface LangChainParams {
|
|||
openRouterAiApiKey: string,
|
||||
model: string,
|
||||
modelDisplayName: string,
|
||||
embeddingModel: string,
|
||||
temperature: number,
|
||||
maxTokens: number,
|
||||
systemMessage: string,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export enum ChatModels {
|
|||
GPT_35_TURBO = 'gpt-3.5-turbo',
|
||||
GPT_35_TURBO_16K = 'gpt-3.5-turbo-16k',
|
||||
GPT_4 = 'gpt-4',
|
||||
GPT_4_TURBO = 'gpt-4-1106-preview',
|
||||
GPT_4_TURBO = 'gpt-4-turbo-preview',
|
||||
GPT_4_32K = 'gpt-4-32k',
|
||||
AZURE_GPT_35_TURBO = 'gpt-35-turbo',
|
||||
AZURE_GPT_35_TURBO_16K = 'gpt-35-turbo-16k',
|
||||
|
|
@ -108,10 +108,19 @@ export const EMBEDDING_PROVIDERS = [
|
|||
];
|
||||
|
||||
// Embedding Models
|
||||
export const ADA_V2 = 'text-embedding-ada-002';
|
||||
export const OPENAI_EMBEDDING_SMALL = 'text-embedding-3-small';
|
||||
export const OPENAI_EMBEDDING_LARGE = 'text-embedding-3-large';
|
||||
export const DISTILBERT_NLI = 'sentence-transformers/distilbert-base-nli-mean-tokens';
|
||||
export const INSTRUCTOR_XL = 'hkunlp/instructor-xl'; // Inference API is off for this
|
||||
export const MPNET_V2 = 'sentence-transformers/all-mpnet-base-v2'; // Inference API returns 400
|
||||
|
||||
export const OPENAI_EMBEDDING_MODELS = [
|
||||
ADA_V2,
|
||||
OPENAI_EMBEDDING_SMALL,
|
||||
OPENAI_EMBEDDING_LARGE,
|
||||
]
|
||||
|
||||
export const DEFAULT_SETTINGS: CopilotSettings = {
|
||||
openAIApiKey: '',
|
||||
huggingfaceApiKey: '',
|
||||
|
|
@ -127,6 +136,7 @@ export const DEFAULT_SETTINGS: CopilotSettings = {
|
|||
openRouterModel: 'cognitivecomputations/dolphin-mixtral-8x7b',
|
||||
defaultModel: ChatModels.GPT_4_TURBO,
|
||||
defaultModelDisplayName: ChatModelDisplayNames.GPT_4_TURBO,
|
||||
embeddingModel: OPENAI_EMBEDDING_SMALL,
|
||||
temperature: 0.1,
|
||||
maxTokens: 1000,
|
||||
contextTurns: 15,
|
||||
|
|
|
|||
|
|
@ -461,6 +461,7 @@ export default class CopilotPlugin extends Plugin {
|
|||
googleApiKey,
|
||||
openRouterAiApiKey,
|
||||
openRouterModel,
|
||||
embeddingModel,
|
||||
temperature,
|
||||
maxTokens,
|
||||
contextTurns,
|
||||
|
|
@ -487,6 +488,7 @@ export default class CopilotPlugin extends Plugin {
|
|||
lmStudioPort: lmStudioPort || DEFAULT_SETTINGS.lmStudioPort,
|
||||
model: this.settings.defaultModel,
|
||||
modelDisplayName: this.settings.defaultModelDisplayName,
|
||||
embeddingModel: embeddingModel || DEFAULT_SETTINGS.embeddingModel,
|
||||
temperature: Number(temperature),
|
||||
maxTokens: Number(maxTokens),
|
||||
systemMessage: this.settings.userSystemPrompt || DEFAULT_SYSTEM_PROMPT,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ export interface CopilotSettings {
|
|||
openRouterModel: string;
|
||||
defaultModel: string;
|
||||
defaultModelDisplayName: string;
|
||||
embeddingModel: string;
|
||||
temperature: number;
|
||||
maxTokens: number;
|
||||
contextTurns: number;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { EMBEDDING_PROVIDERS } from '@/constants';
|
||||
import { EMBEDDING_PROVIDERS, OPENAI_EMBEDDING_MODELS } from '@/constants';
|
||||
import React from 'react';
|
||||
import ApiSetting from './ApiSetting';
|
||||
import Collapsible from './Collapsible';
|
||||
|
|
@ -7,6 +7,8 @@ import { DropdownComponent, SliderComponent } from './SettingBlocks';
|
|||
interface QASettingsProps {
|
||||
embeddingProvider: string;
|
||||
setEmbeddingProvider: (value: string) => void;
|
||||
embeddingModel: string;
|
||||
setEmbeddingModel: (value: string) => void;
|
||||
ttlDays: number;
|
||||
setTtlDays: (value: number) => void;
|
||||
cohereApiKey: string;
|
||||
|
|
@ -18,6 +20,8 @@ interface QASettingsProps {
|
|||
const QASettings: React.FC<QASettingsProps> = ({
|
||||
embeddingProvider,
|
||||
setEmbeddingProvider,
|
||||
embeddingModel,
|
||||
setEmbeddingModel,
|
||||
ttlDays,
|
||||
setTtlDays,
|
||||
cohereApiKey,
|
||||
|
|
@ -44,6 +48,12 @@ const QASettings: React.FC<QASettingsProps> = ({
|
|||
onChange={setEmbeddingProvider}
|
||||
options={EMBEDDING_PROVIDERS}
|
||||
/>
|
||||
<DropdownComponent
|
||||
name="OpenAI Embedding Model"
|
||||
value={embeddingModel}
|
||||
onChange={setEmbeddingModel}
|
||||
options={OPENAI_EMBEDDING_MODELS}
|
||||
/>
|
||||
<SliderComponent
|
||||
name="TTL Days"
|
||||
description="The number of days to keep embeddings in the index"
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ export default function SettingsMain({ plugin, reloadPlugin }: SettingsMainProps
|
|||
|
||||
// QA settings
|
||||
const [embeddingProvider, setEmbeddingProvider] = useState(plugin.settings.embeddingProvider);
|
||||
const [embeddingModel, setEmbeddingModel] = useState(plugin.settings.embeddingModel);
|
||||
const [ttlDays, setTtlDays] = useState(plugin.settings.ttlDays);
|
||||
const [cohereApiKey, setCohereApiKey] = useState(plugin.settings.cohereApiKey);
|
||||
const [huggingfaceApiKey, setHuggingfaceApiKey] = useState(plugin.settings.huggingfaceApiKey);
|
||||
|
|
@ -68,6 +69,7 @@ export default function SettingsMain({ plugin, reloadPlugin }: SettingsMainProps
|
|||
|
||||
// QA settings
|
||||
plugin.settings.embeddingProvider = embeddingProvider;
|
||||
plugin.settings.embeddingModel = embeddingModel;
|
||||
plugin.settings.ttlDays = ttlDays;
|
||||
plugin.settings.cohereApiKey = cohereApiKey;
|
||||
plugin.settings.huggingfaceApiKey = huggingfaceApiKey;
|
||||
|
|
@ -186,6 +188,8 @@ export default function SettingsMain({ plugin, reloadPlugin }: SettingsMainProps
|
|||
<QASettings
|
||||
embeddingProvider={embeddingProvider}
|
||||
setEmbeddingProvider={setEmbeddingProvider}
|
||||
embeddingModel={embeddingModel}
|
||||
setEmbeddingModel={setEmbeddingModel}
|
||||
ttlDays={ttlDays}
|
||||
setTtlDays={setTtlDays}
|
||||
cohereApiKey={cohereApiKey}
|
||||
|
|
|
|||
|
|
@ -33,5 +33,6 @@
|
|||
"2.4.9": "0.15.0",
|
||||
"2.4.10": "0.15.0",
|
||||
"2.4.11": "0.15.0",
|
||||
"2.4.12": "0.15.0"
|
||||
"2.4.12": "0.15.0",
|
||||
"2.4.13": "0.15.0"
|
||||
}
|
||||
Loading…
Reference in a new issue