File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ from typing import List , Optional , Dict , Literal
2
+ from typing_extensions import TypedDict
3
+
4
+
5
+ class EmbeddingUsage (TypedDict ):
6
+ prompt_tokens : int
7
+ total_tokens : int
8
+
9
+
10
+ class EmbeddingData (TypedDict ):
11
+ index : int
12
+ object : str
13
+ embedding : List [float ]
14
+
15
+
16
+ class Embedding (TypedDict ):
17
+ object : Literal ["list" ]
18
+ model : str
19
+ data : List [EmbeddingData ]
20
+ usage : EmbeddingUsage
21
+
22
+
23
+ class CompletionLogprobs (TypedDict ):
24
+ text_offset : List [int ]
25
+ token_logprobs : List [float ]
26
+ tokens : List [str ]
27
+ top_logprobs : List [Dict [str , float ]]
28
+
29
+
30
+ class CompletionChoice (TypedDict ):
31
+ text : str
32
+ index : int
33
+ logprobs : Optional [CompletionLogprobs ]
34
+ finish_reason : Optional [str ]
35
+
36
+
37
+ class CompletionUsage (TypedDict ):
38
+ prompt_tokens : int
39
+ completion_tokens : int
40
+ total_tokens : int
41
+
42
+
43
+ class CompletionChunk (TypedDict ):
44
+ id : str
45
+ object : Literal ["text_completion" ]
46
+ created : int
47
+ model : str
48
+ choices : List [CompletionChoice ]
49
+
50
+
51
+ class Completion (TypedDict ):
52
+ id : str
53
+ object : Literal ["text_completion" ]
54
+ created : int
55
+ model : str
56
+ choices : List [CompletionChoice ]
57
+ usage : CompletionUsage
You can’t perform that action at this time.
0 commit comments