55import java .io .InputStream ;
66import java .util .Map ;
77
8+ /**
9+ * The type Config.
10+ */
811public class Config {
912
1013 private static Map <String , Map <String , Object >> params ;
1114
15+ /**
16+ * Instantiates a new Config.
17+ */
1218 public Config () {
1319 params = getParams ();
1420 }
1521
22+ /**
23+ * Chat chat config.
24+ *
25+ * @return the chat config
26+ */
1627 static ChatConfig chat () {
1728 return new ChatConfig (params .get ("chat" ));
1829 }
1930
31+ /**
32+ * The type Chat config.
33+ */
2034 static class ChatConfig {
2135
2236 private static Map <String , Object > chatParams ;
2337
38+ /**
39+ * Instantiates a new Chat config.
40+ *
41+ * @param chParams the ch params
42+ */
2443 public ChatConfig (Map <String , Object > chParams ) {
2544 chatParams = chParams ;
2645 }
2746
47+ /**
48+ * Model string.
49+ *
50+ * @return the string
51+ */
2852 public String model () {
2953 return (String ) chatParams .get ("model" );
3054 }
3155
56+ /**
57+ * Max tokens int.
58+ *
59+ * @return the int
60+ */
3261 public int maxTokens () {
3362 return (chatParams .get ("max_tokens" ) != null ) ? (int ) chatParams .get ("max_tokens" ) : 1500 ;
3463 }
3564
65+ /**
66+ * N int.
67+ *
68+ * @return the int
69+ */
3670 public int n () {
3771 return (chatParams .get ("n" ) != null ) ? (int ) chatParams .get ("n" ) : 1 ;
3872 }
3973
74+ /**
75+ * Temperature float.
76+ *
77+ * @return the float
78+ */
4079 public float temperature () {
4180
4281 return (float ) ((chatParams .get ("temperature" ) != null ) ? (double ) chatParams .get ("temperature" ) : 0.9 );
4382 }
4483
84+ /**
85+ * Top p byte.
86+ *
87+ * @return the byte
88+ */
4589 public byte topP (){
4690 return (byte ) ((chatParams .get ("top_p" ) != null ) ? (int ) chatParams .get ("top_p" ) : 1 );
4791 }
4892
93+ /**
94+ * Stream boolean.
95+ *
96+ * @return the boolean
97+ */
4998 public boolean stream () {
5099 return (chatParams .get ("stream" ) != null ) ? (boolean ) chatParams .get ("stream" ) : false ;
51100 }
52101
102+ /**
103+ * Stop string.
104+ *
105+ * @return the string
106+ */
53107 public String stop () {
54108 return (chatParams .get ("stop" ) != null ) ? (String ) chatParams .get ("stop" ) : null ;
55109 }
56110
111+ /**
112+ * User string.
113+ *
114+ * @return the string
115+ */
57116 public String user () {
58117 return (chatParams .get ("user" ) != null ) ? (String ) chatParams .get ("user" ) : null ;
59118 }
@@ -67,13 +126,22 @@ private Map<String, Map<String, Object>> getParams() {
67126 return new Yaml ().load (inputStream );
68127 }
69128
129+ /**
130+ * Api key string.
131+ *
132+ * @return the string
133+ */
70134 String apiKey () {
71135
72136 return (String ) params .get ("openai" ).get ("api-key" );
73137 }
74138
75139
76-
140+ /**
141+ * Test key string.
142+ *
143+ * @return the string
144+ */
77145 public String testKey () {
78146 return (String ) params .get ("openapi" ).get ("test-key" );
79147 }
0 commit comments