addsearch-js-client
Version:
AddSearch API JavaScript client
58 lines • 1.98 kB
TypeScript
import 'es6-promise/auto';
import { Settings } from './settings';
import { ApiFetchCallback } from './apifetch';
/**
* Source document from AI Answers response
*/
export interface AiAnswersSource {
id: string;
title: string;
url: string;
last_updated_date: string;
}
/**
* AI Answers streaming response
*/
export interface AiAnswersResponse {
conversation_id: string;
answer: string;
sources: AiAnswersSource[];
is_streaming_complete?: boolean;
error?: {
response: number;
message: string;
};
}
/**
* Sentiment value type for rating AI Answers
*/
export type SentimentValue = 'positive' | 'negative' | 'neutral';
/**
* Execute AI Answers query with streaming
*
* @param apiHostname - API hostname
* @param sitekey - Site key
* @param settings - Query settings
* @param cb - Callback function called progressively during streaming
*/
export declare const executeAiAnswersStreamingFetch: (apiHostname: string, sitekey: string, settings: Settings | null, cb: ApiFetchCallback<AiAnswersResponse>) => void;
/**
* Execute AI Answers query without streaming
*
* @param apiHostname - API hostname
* @param sitekey - Site key
* @param settings - Query settings
* @param cb - Callback function called once when complete
*/
export declare const executeAiAnswersNonStreamingFetch: (apiHostname: string, sitekey: string, settings: Settings | null, cb: ApiFetchCallback<AiAnswersResponse>) => void;
/**
* Submit a sentiment rating for an AI Answers conversation
*
* @param apiHostname - API hostname
* @param sitekey - Site key
* @param conversationId - Conversation ID to rate
* @param sentimentValue - Sentiment value ('positive', 'negative', or 'neutral')
* @returns Promise that resolves to true on success
*/
export declare const putSentimentClick: (apiHostname: string, sitekey: string, conversationId: string, sentimentValue: SentimentValue) => Promise<boolean>;
//# sourceMappingURL=ai-answers-api.d.ts.map