askexperts
Version:
AskExperts SDK: build and use AI experts - ask them questions and pay with bitcoin on an open protocol
61 lines (60 loc) • 1.5 kB
TypeScript
/**
* AskExpertsChatClient implementation
* Handles chat interactions with experts
*/
import { Expert } from "../common/types.js";
/**
* Options for the chat client
*/
export interface ChatClientOptions {
nwcString: string;
relays?: string[];
maxAmount?: string;
debug?: boolean;
stream?: boolean;
}
/**
* Message in OpenAI chat format
*/
export interface ChatMessage {
role: "user" | "assistant";
content: string;
}
/**
* Client for chatting with experts
*/
export declare class AskExpertsChatClient {
private expertPubkey;
private messageHistory;
private expert;
private options;
private client;
private maxAmountSats;
/**
* Creates a new AskExpertsChatClient
*
* @param expertPubkey The pubkey of the expert to chat with
* @param options Options for the chat client
*/
constructor(expertPubkey: string, options: ChatClientOptions);
/**
* Initialize properties that don't depend on the wallet
* @param options Client options
*/
private initializeProperties;
/**
* Initialize the chat client by fetching the expert profile
*/
initialize(): Promise<Expert>;
/**
* Process a message and get a response from the expert
*
* @param message The message to send to the expert
* @returns The expert's reply
*/
processMessage(message: string): Promise<string>;
/**
* Clean up resources
*/
[Symbol.dispose](): void;
}