@@ -2,39 +2,137 @@ package infrastructure
22
33object MockStorage {
44
5- fun completionSuccessResult (text : String ) = " {\" id\" :\" 1\" ,\" object\" :\" text_completion\" ," +
6- " \" created\" :1675532539,\" model\" :\" text-davinci-003\" ," +
7- " \" choices\" :[{\" text\" :\"\n\n $text \" ,\" index\" :0,\" logprobs\" :null," +
8- " \" finish_reason\" :\" stop\" }],\" usage\" :{\" prompt_tokens\" :8,\" completion_tokens\" :9," +
9- " \" total_tokens\" :17}}"
5+ fun completionSuccessResult (text : String ) = """
6+ {
7+ "id": "1",
8+ "object": "text_completion",
9+ "created": 1675532539,
10+ "model": "text-davinci-003",
11+ "choices": [
12+ {
13+ "text": "\n\n$text ",
14+ "index": 0,
15+ "logprobs": null,
16+ "finish_reason": "stop"
17+ }
18+ ],
19+ "usage": {
20+ "prompt_tokens": 8,
21+ "completion_tokens": 9,
22+ "total_tokens": 17
23+ }
24+ }
25+ """
1026
11- fun chatCompletionsSuccessResult (text : String ) = " {\" id\" :\" 1\" ,\" object\" :\" chat.completion\" ," +
12- " \" created\" :1678144798,\" model\" :\" gpt-3.5-turbo-0301\" ," +
13- " \" usage\" :{\" prompt_tokens\" :13,\" completion_tokens\" :12,\" total_tokens\" :25}," +
14- " \" choices\" :[{\" message\" :{\" role\" :\" assistant\" ,\" content\" :\" $text \" }," +
15- " \" finish_reason\" :\" stop\" ,\" index\" :0}]}"
27+ fun chatCompletionsSuccessResult (text : String ) = """
28+ {
29+ "id": "1",
30+ "object": "chat.completion",
31+ "created": 1678144798,
32+ "model": "gpt-3.5-turbo-0301",
33+ "usage": {
34+ "prompt_tokens": 13,
35+ "completion_tokens": 12,
36+ "total_tokens": 25
37+ },
38+ "choices": [
39+ {
40+ "message": {
41+ "role": "assistant",
42+ "content": "$text "
43+ },
44+ "finish_reason": "stop",
45+ "index": 0
46+ }
47+ ]
48+ }
49+ """
1650
17- fun imageGenerationsSuccessResult (text : String ) =
18- " {\" created\" :1678805561,\" data\" :[{\" url\" :\" $text \" }]}"
51+ fun imageGenerationsSuccessResult (text : String ) = """
52+ {
53+ "created": 1678805561,
54+ "data": [
55+ {
56+ "url": "$text "
57+ }
58+ ]
59+ }
60+ """
1961
20- fun editsSuccessResult (text : String ) = " {\" object\" :\" edit\" ,\" created\" :1679072839," +
21- " \" choices\" :[{\" text\" :\" $text \" ,\" index\" :0}]," +
22- " \" usage\" :{\" prompt_tokens\" :25,\" completion_tokens\" :28,\" total_tokens\" :53}}"
62+ fun editsSuccessResult (text : String ) = """
63+ {
64+ "object": "edit",
65+ "created": 1679072839,
66+ "choices": [
67+ {
68+ "text": "$text ",
69+ "index": 0
70+ }
71+ ],
72+ "usage": {
73+ "prompt_tokens": 25,
74+ "completion_tokens": 28,
75+ "total_tokens": 53
76+ }
77+ }
78+ """
2379
24- fun listModelsSuccessResult (id : String ) =
25- " {\" object\" :\" list\" ,\" data\" :[{\" id\" :\" $id \" ,\" object\" :\" model\" ," +
26- " \" created\" :1649358449,\" owned_by\" :\" openai\" ,\" permission\" :" +
27- " [{\" id\" :\" modelperm-49FUp5v084tBB49tC4z8LPH5\" ,\" object\" :\" model_permission\" ," +
28- " \" created\" :1669085501,\" allow_create_engine\" :false,\" allow_sampling\" :true," +
29- " \" allow_logprobs\" :true,\" allow_search_indices\" :false,\" allow_view\" :true," +
30- " \" allow_fine_tuning\" :false,\" organization\" :\" *\" ,\" group\" :null,\" is_blocking" +
31- " \" :false}],\" root\" :\" $id \" ,\" parent\" :null}]}"
80+ fun listModelsSuccessResult (id : String ) = """
81+ {
82+ "object": "list",
83+ "data": [
84+ {
85+ "id": "$id ",
86+ "object": "model",
87+ "created": 1649358449,
88+ "owned_by": "openai",
89+ "permission": [
90+ {
91+ "id": "modelperm-49FUp5v084tBB49tC4z8LPH5",
92+ "object": "model_permission",
93+ "created": 1669085501,
94+ "allow_create_engine": false,
95+ "allow_sampling": true,
96+ "allow_logprobs": true,
97+ "allow_search_indices": false,
98+ "allow_view": true,
99+ "allow_fine_tuning": false,
100+ "organization": "*",
101+ "group": null,
102+ "is_blocking": false
103+ }
104+ ],
105+ "root": "$id ",
106+ "parent": null
107+ }
108+ ]
109+ }
110+ """
32111
33- fun modelSuccessResult (id : String ) = " {\" id\" :\" $id \" ,\" object\" :\" model\" ," +
34- " \" created\" :1649358449,\" owned_by\" :\" openai\" ," +
35- " \" permission\" :[{\" id\" :\" modelperm-49FUp5v084tBB49tC4z8LPH5\" ," +
36- " \" object\" :\" model_permission\" ,\" created\" :1669085501,\" allow_create_engine\" :false," +
37- " \" allow_sampling\" :true,\" allow_logprobs\" :true,\" allow_search_indices\" :false," +
38- " \" allow_view\" :true,\" allow_fine_tuning\" :false,\" organization\" :\" *\" ,\" group\" :null," +
39- " \" is_blocking\" :false}],\" root\" :\" $id \" ,\" parent\" :null}"
112+ fun modelSuccessResult (id : String ) = """
113+ {
114+ "id": "$id ",
115+ "object": "model",
116+ "created": 1649358449,
117+ "owned_by": "openai",
118+ "permission": [
119+ {
120+ "id": "modelperm-49FUp5v084tBB49tC4z8LPH5",
121+ "object": "model_permission",
122+ "created": 1669085501,
123+ "allow_create_engine": false,
124+ "allow_sampling": true,
125+ "allow_logprobs": true,
126+ "allow_search_indices": false,
127+ "allow_view": true,
128+ "allow_fine_tuning": false,
129+ "organization": "*",
130+ "group": null,
131+ "is_blocking": false
132+ }
133+ ],
134+ "root": "$id ",
135+ "parent": null
136+ }
137+ """
40138}
0 commit comments