2024-04-04 00:47:44 +00:00
|
|
|
import { Conversation } from './classes.conversation.js';
|
|
|
|
import * as plugins from './plugins.js';
|
2024-04-25 08:49:07 +00:00
|
|
|
import type { AnthropicProvider } from './provider.anthropic.js';
|
|
|
|
import type { OllamaProvider } from './provider.ollama.js';
|
|
|
|
import type { OpenAiProvider } from './provider.openai.js';
|
|
|
|
import type { PerplexityProvider } from './provider.perplexity.js';
|
2024-04-04 00:47:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
export interface ISmartAiOptions {
|
2024-04-25 08:49:07 +00:00
|
|
|
openaiToken?: string;
|
|
|
|
anthropicToken?: string;
|
|
|
|
perplexityToken?: string;
|
|
|
|
exposeCredentials?: plugins.smartexpose.ISmartExposeOptions;
|
2024-04-04 00:47:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export class SmartAi {
|
|
|
|
public options: ISmartAiOptions;
|
|
|
|
|
2024-04-25 08:49:07 +00:00
|
|
|
public openaiProvider: OpenAiProvider;
|
|
|
|
public anthropicProvider: AnthropicProvider;
|
|
|
|
public perplexityProvider: PerplexityProvider;
|
|
|
|
public ollamaProvider: OllamaProvider;
|
|
|
|
|
2024-04-04 00:47:44 +00:00
|
|
|
constructor(optionsArg: ISmartAiOptions) {
|
|
|
|
this.options = optionsArg;
|
|
|
|
}
|
2024-04-25 08:49:07 +00:00
|
|
|
|
|
|
|
public async start() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public async stop() {}
|
2024-04-04 00:47:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* creates an OpenAI conversation
|
|
|
|
*/
|
|
|
|
public async createOpenApiConversation() {
|
|
|
|
const conversation = await Conversation.createWithOpenAi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* creates an OpenAI conversation
|
|
|
|
*/
|
|
|
|
public async createAnthropicConversation() {
|
|
|
|
const conversation = await Conversation.createWithAnthropic(this);
|
|
|
|
}
|
|
|
|
}
|