1 1
import { AbstractPredictionsProvider } from '../types/Providers';
2 1
import { AmazonAIConvertPredictionsProvider } from './AmazonAIConvertPredictionsProvider';
3 1
import { AmazonAIInterpretPredictionsProvider } from './AmazonAIInterpretPredictionsProvider';
4 1
import { AmazonAIIdentifyPredictionsProvider } from './AmazonAIIdentifyPredictionsProvider';
5
import {
6
	TranslateTextInput,
7
	TextToSpeechInput,
8
	SpeechToTextInput,
9
	PredictionsOptions,
10
	IdentifyTextInput,
11
	IdentifyTextOutput,
12
	IdentifyLabelsInput,
13
	IdentifyLabelsOutput,
14
	IdentifyEntitiesInput,
15
	IdentifyEntitiesOutput,
16
	TranslateTextOutput,
17
	TextToSpeechOutput,
18
	SpeechToTextOutput,
19
	InterpretTextInput,
20
	InterpretTextOutput,
21
} from '../types';
22

23 1
export class AmazonAIPredictionsProvider extends AbstractPredictionsProvider {
24
	private convertProvider: AmazonAIConvertPredictionsProvider;
25
	private identifyProvider: AmazonAIIdentifyPredictionsProvider;
26
	private interpretProvider: AmazonAIInterpretPredictionsProvider;
27

28
	constructor() {
29 1
		super();
30 1
		this.convertProvider = new AmazonAIConvertPredictionsProvider();
31 1
		this.identifyProvider = new AmazonAIIdentifyPredictionsProvider();
32 1
		this.interpretProvider = new AmazonAIInterpretPredictionsProvider();
33
	}
34

35 1
	getCategory(): string {
36 1
		return 'Predictions';
37
	}
38

39 1
	getProviderName(): string {
40 1
		return 'AmazonAIPredictionsProvider';
41
	}
42

43 1
	configure(config: PredictionsOptions) {
44 1
		this.convertProvider.configure(config.convert);
45 1
		this.identifyProvider.configure(config.identify);
46 1
		this.interpretProvider.configure(config.interpret);
47 1
		return config;
48
	}
49

50 1
	interpret(input: InterpretTextInput): Promise<InterpretTextOutput> {
51 0
		return this.interpretProvider.interpret(input);
52
	}
53

54 1
	convert(
55
		input: TranslateTextInput | TextToSpeechInput | SpeechToTextInput
56
	): Promise<TextToSpeechOutput | TranslateTextOutput | SpeechToTextOutput> {
57 0
		return this.convertProvider.convert(input);
58
	}
59

60 1
	identify(
61
		input: IdentifyTextInput | IdentifyLabelsInput | IdentifyEntitiesInput
62
	): Promise<
63
		IdentifyTextOutput | IdentifyLabelsOutput | IdentifyEntitiesOutput
64
	> {
65 0
		return this.identifyProvider.identify(input);
66
	}
67 1
}
68

69
/**
70
 * @deprecated use named import
71
 */
72 1
export default AmazonAIPredictionsProvider;

Read our documentation on viewing source code .

Loading