-
Notifications
You must be signed in to change notification settings - Fork 3
/
OpenAIClient.idl
71 lines (60 loc) · 2.13 KB
/
OpenAIClient.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import "Choice.idl";
import "CompletionRequest.idl";
import "PromptTemplate.idl";
namespace OpenAI
{
enum ChatRole
{
System,
User,
Assistant
};
runtimeclass ChatMessage
{
ChatMessage(ChatRole role, String content);
ChatRole Role{ get; };
String Content{ get; };
};
[default_interface]
runtimeclass ChatRequest
{
ChatRequest();
String Model;
Windows.Foundation.Collections.IVector<ChatMessage> Messages;
UInt32 MaxTokens;
Double Temperature;
Double TopP;
UInt8 NCompletions;
Boolean Stream;
}
[default_interface]
runtimeclass OpenAIClient
{
OpenAIClient();
static OpenAIClient CreateAzureOpenAIClient(Windows.Foundation.Uri endpoint, String deployment, String apiKey);
String ApiKey;
Windows.Foundation.Uri CompletionUri;
Boolean UseBearerTokenAuthorization;
Windows.Foundation.IAsyncOperation< Windows.Foundation.Collections.IVector<Choice> > GetCompletionAsync(String prompt, String model);
Windows.Foundation.IAsyncOperation< Windows.Foundation.Collections.IVector<Choice> > GetCompletionAsync(CompletionRequest request);
Windows.Foundation.Uri EmbeddingUri;
Windows.Foundation.IAsyncOperation< Windows.Foundation.Collections.IVector<Double> > GetEmbeddingAsync(String prompt);
PromptTemplate CreateTemplate(String prompt);
FewShotTemplate CreateFewShotTemplate(Windows.Foundation.Collections.IVectorView<String> parameters);
Windows.Foundation.IAsyncOperation< Windows.Foundation.Collections.IVector<Choice> > GetChatResponseAsync(ChatRequest request);
Boolean IsChatModel;
}
enum Similarity
{
Cosine,
L1,
L2,
Linf
};
[default_interface]
runtimeclass EmbeddingUtils
{
static Double EmbeddingDistance(Windows.Foundation.Collections.IVectorView<Double> v1, Windows.Foundation.Collections.IVectorView<Double> v2, Similarity similarity);
static Double EmbeddingDistance(Windows.Foundation.Collections.IVectorView<Double> v1, Windows.Foundation.Collections.IVectorView<Double> v2);
}
}