LLM for Unity  v2.5.1
Create characters in Unity with LLMs!
Loading...
Searching...
No Matches
LLMInterface.cs
Go to the documentation of this file.
1
3using System;
4using System.Collections.Generic;
5
7namespace LLMUnity
8{
9 [Serializable]
10 public struct ChatRequest
11 {
12 public string prompt;
13 public int id_slot;
14 public float temperature;
15 public int top_k;
16 public float top_p;
17 public float min_p;
18 public int n_predict;
19 public int n_keep;
20 public bool stream;
21 public List<string> stop;
22 public float tfs_z;
23 public float typical_p;
24 public float repeat_penalty;
25 public int repeat_last_n;
26 public bool penalize_nl;
27 public float presence_penalty;
28 public float frequency_penalty;
29 public string penalty_prompt;
30 public int mirostat;
31 public float mirostat_tau;
32 public float mirostat_eta;
33 // EXCLUDE grammars from JsonUtility serialization, serialise them manually
34 [NonSerialized] public string grammar;
35 [NonSerialized] public string json_schema;
36 public int seed;
37 public bool ignore_eos;
38 public Dictionary<int, string> logit_bias;
39 public int n_probs;
40 public bool cache_prompt;
41 public List<ChatMessage> messages;
42 }
43
44 [Serializable]
45 public struct GrammarWrapper
46 {
47 public string grammar;
48 }
49
50 [Serializable]
51 public struct SystemPromptRequest
52 {
53 public string prompt;
54 public string system_prompt;
55 public int n_predict;
56 }
57
58 [Serializable]
59 public struct ChatResult
60 {
61 public int id_slot;
62 public string content;
63 public bool stop;
64 public string generation_settings;
65 public string model;
66 public string prompt;
67 public bool stopped_eos;
68 public bool stopped_limit;
69 public bool stopped_word;
70 public string stopping_word;
71 public string timings;
72 public int tokens_cached;
73 public int tokens_evaluated;
74 public bool truncated;
75 public bool cache_prompt;
76 public bool system_prompt;
77 }
78
79 [Serializable]
80 public struct MultiChatResult
81 {
82 public List<ChatResult> data;
83 }
84
85 [Serializable]
86 public struct ChatMessage
87 {
88 public string role;
89 public string content;
90 }
91
92 [Serializable]
93 public struct TokenizeRequest
94 {
95 public string content;
96 }
97
98 [Serializable]
99 public struct TokenizeResult
100 {
101 public List<int> tokens;
102 }
103
104 [Serializable]
105 public struct EmbeddingsResult
106 {
107 public List<float> embedding;
108 }
109
110 [Serializable]
111 public struct LoraWeightRequest
112 {
113 public int id;
114 public float scale;
115 }
116
117 [Serializable]
118 public struct LoraWeightRequestList
119 {
120 public List<LoraWeightRequest> loraWeights;
121 }
122
123 [Serializable]
124 public struct LoraWeightResult
125 {
126 public int id;
127 public string path;
128 public float scale;
129 }
130
131 [Serializable]
132 public struct LoraWeightResultList
133 {
134 public List<LoraWeightResult> loraWeights;
135 }
136
137 [Serializable]
138 public struct TemplateResult
139 {
140 public string template;
141 }
142
143 [Serializable]
144 public struct SlotRequest
145 {
146 public int id_slot;
147 public string action;
148 public string filepath;
149 }
150
151 [Serializable]
152 public struct SlotResult
153 {
154 public int id_slot;
155 public string filename;
156 }
157}