• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rendezqueue / rendezllama / 21157153067

20 Jan 2026 02:13AM UTC coverage: 90.342% (+0.4%) from 89.931%
21157153067

push

github

grencez
Update localserv to support chat interface and CLI args

2142 of 2371 relevant lines covered (90.34%)

280.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.63
/src/language/inference_schema.cc
1
#include "src/language/inference_schema.hh"
2

3
#include <cstdio>
4
#include <string_view>
5

6
using rendezllama::inference::AdjustViaKind;
7

8
static FildeshSxprotoField penalize_with_fields[] = {
9
  {"window_length", FILL_FildeshSxprotoField_INT(0, INT_MAX)},
10
  {"repetition", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
11
  {"frequency", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
12
  {"presence", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
13
};
14

15
static FildeshSxprotoField xtc_fields[] = {
16
  {"probability", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
17
  {"threshold", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
18
};
19

20
static FildeshSxprotoField dry_fields[] = {
21
  {"multiplier", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
22
  {"base", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
23
  {"allowed_length", FILL_FildeshSxprotoField_INT(0, INT_MAX)},
24
  {"window_length", FILL_FildeshSxprotoField_INT(0, INT_MAX)},
25
};
26

27
static FildeshSxprotoField adjust_thru_manyof[] = {
28
  {"dry", FILL_FildeshSxprotoField_MESSAGE(dry_fields)},
29
  {"min_p", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
30
  {"penalize_with", FILL_FildeshSxprotoField_MESSAGE(penalize_with_fields)},
31
  {"temperature", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
32
  {"top_k", FILL_FildeshSxprotoField_INT(1, INT_MAX)},
33
  {"top_p", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
34
  {"typical_p", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
35
  {"xtc", FILL_FildeshSxprotoField_MESSAGE(xtc_fields)},
36
};
37

38
static FildeshSxprotoField adaptive_p_fields[] = {
39
  {"target", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
40
  {"decay", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
41
};
42

43
static FildeshSxprotoField mirostat_fields[] = {
44
  {"version", FILL_FildeshSxprotoField_INT(1, 2)},
45
  {"tau", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
46
  {"eta", FILL_DEFAULT_FildeshSxprotoField_FLOAT},
47
};
48

49
static FildeshSxprotoField void_message_fields[] = {
50
  {"none", FILL_DEFAULT_FildeshSxprotoField_STRING},
51
};
52

53
static FildeshSxprotoField pick_via_oneof[] = {
54
  {"adaptive_p", FILL_FildeshSxprotoField_MESSAGE(adaptive_p_fields)},
55
  {"determinism", FILL_FildeshSxprotoField_MESSAGE(void_message_fields)},
56
  {"greedy", FILL_DEFAULT_FildeshSxprotoField_ALIAS},
57
  {"mirostat", FILL_FildeshSxprotoField_MESSAGE(mirostat_fields)},
58
  {"probability", FILL_FildeshSxprotoField_MESSAGE(void_message_fields)},
59
};
60

61
static FildeshSxprotoField sampling_fields[] = {
62
  {"seed", FILL_FildeshSxprotoField_INT(0, INT_MAX)},
63
  {"adjust_thru", FILL_FildeshSxprotoField_MANYOF(adjust_thru_manyof)},
64
  {"pick_via", FILL_FildeshSxprotoField_LONEOF(pick_via_oneof)},
65
};
66

67
static FildeshSxprotoField infer_via_oneof[] = {
68
  {"sampling", FILL_FildeshSxprotoField_MESSAGE(sampling_fields)},
69
};
70

71
const FildeshSxprotoField* rendezllama::inference_sxproto_schema() {
15✔
72
  DECLARE_TOPLEVEL_FildeshSxprotoField(schema, infer_via_oneof);
15✔
73
  if (!schema->name) {
15✔
74
    lone_toplevel_initialization_FildeshSxprotoField(schema);
15✔
75
    schema->kind = FildeshSxprotoFieldKind_LONEOF;
15✔
76
  }
77
  return schema;
15✔
78
}
79

80
  bool
81
rendezllama::inference::populate_AdjustVia(
31✔
82
    rendezllama::inference::AdjustVia& adjust_via,
83
    FildeshSxpb* sxpb,
84
    FildeshSxpbIT it)
85
{
86
  const std::string_view name = name_at_FildeshSxpb(sxpb, it);
31✔
87
  if (name == "dry") {
31✔
88
    rendezllama::inference::Dry dry;
1✔
89
    lone_subfield_at_FildeshSxpb_to_float(&dry.multiplier, sxpb, it, "multiplier");
1✔
90
    lone_subfield_at_FildeshSxpb_to_float(&dry.base, sxpb, it, "base");
1✔
91
    lone_subfield_at_FildeshSxpb_to_unsigned(&dry.allowed_length, sxpb, it, "allowed_length");
1✔
92
    lone_subfield_at_FildeshSxpb_to_unsigned(&dry.window_length, sxpb, it, "window_length");
1✔
93
    adjust_via.emplace<AdjustViaKind::dry>(dry);
1✔
94
  }
95
  else if (name == "min_p") {
30✔
96
    adjust_via.emplace<AdjustViaKind::min_p>(
1✔
97
        float_value_at_FildeshSxpb(sxpb, it));
1✔
98
  }
99
  else if (name == "penalize_with") {
29✔
100
    rendezllama::inference::PenalizeWith penalize_with;
6✔
101
    lone_subfield_at_FildeshSxpb_to_float(&penalize_with.frequency, sxpb, it, "frequency");
6✔
102
    lone_subfield_at_FildeshSxpb_to_float(&penalize_with.presence, sxpb, it, "presence");
6✔
103
    lone_subfield_at_FildeshSxpb_to_float(&penalize_with.repetition, sxpb, it, "repetition");
6✔
104
    lone_subfield_at_FildeshSxpb_to_unsigned(&penalize_with.window_length, sxpb, it, "window_length");
6✔
105
    adjust_via.emplace<AdjustViaKind::penalize_with>(penalize_with);
6✔
106
  }
107
  else if (name == "temperature") {
23✔
108
    adjust_via.emplace<AdjustViaKind::temperature>(
11✔
109
        float_value_at_FildeshSxpb(sxpb, it));
11✔
110
  }
111
  else if (name == "top_k") {
12✔
112
    adjust_via.emplace<AdjustViaKind::top_k>(
2✔
113
        unsigned_value_at_FildeshSxpb(sxpb, it));
2✔
114
  }
115
  else if (name == "top_p") {
10✔
116
    adjust_via.emplace<AdjustViaKind::top_p>(
4✔
117
        float_value_at_FildeshSxpb(sxpb, it));
4✔
118
  }
119
  else if (name == "typical_p") {
6✔
120
    adjust_via.emplace<AdjustViaKind::typical_p>(
1✔
121
        float_value_at_FildeshSxpb(sxpb, it));
1✔
122
  }
123
  else if (name == "xtc") {
5✔
124
    rendezllama::inference::Xtc xtc;
1✔
125
    lone_subfield_at_FildeshSxpb_to_float(&xtc.probability, sxpb, it, "probability");
1✔
126
    lone_subfield_at_FildeshSxpb_to_float(&xtc.threshold, sxpb, it, "threshold");
1✔
127
    adjust_via.emplace<AdjustViaKind::xtc>(xtc);
1✔
128
  }
129
  else {
130
    return false;
131
  }
132
  return true;
133
}
134

135
  bool
136
rendezllama::inference::populate_PickVia(
10✔
137
    rendezllama::inference::PickVia& pick_via,
138
    const FildeshSxpb* sxpb,
139
    FildeshSxpbIT it)
140
{
141
  if (!nullish_FildeshSxpbIT(lookup_subfield_at_FildeshSxpb(sxpb, it, "probability"))) {
10✔
142
    rendezllama::inference::Probability probability;
3✔
143
    pick_via = probability;
3✔
144
    return true;
3✔
145
  }
146
  if (!nullish_FildeshSxpbIT(lookup_subfield_at_FildeshSxpb(sxpb, it, "determinism"))) {
7✔
147
    rendezllama::inference::Determinism determinism;
×
148
    pick_via = determinism;
×
149
    return true;
×
150
  }
151
  const FildeshSxpbIT adaptive_p_it = lookup_subfield_at_FildeshSxpb(sxpb, it, "adaptive_p");
7✔
152
  if (!nullish_FildeshSxpbIT(adaptive_p_it)) {
7✔
153
    rendezllama::inference::AdaptiveP adaptive_p;
1✔
154
    lone_subfield_at_FildeshSxpb_to_float(&adaptive_p.target, sxpb, adaptive_p_it, "target");
1✔
155
    lone_subfield_at_FildeshSxpb_to_float(&adaptive_p.decay, sxpb, adaptive_p_it, "decay");
1✔
156
    pick_via = adaptive_p;
1✔
157
    return true;
1✔
158
  }
159
  const FildeshSxpbIT mirostat_it = lookup_subfield_at_FildeshSxpb(sxpb, it, "mirostat");
6✔
160
  if (!nullish_FildeshSxpbIT(mirostat_it)) {
6✔
161
    rendezllama::inference::Mirostat mirostat;
6✔
162
    if (!lone_subfield_at_FildeshSxpb_to_unsigned(&mirostat.version, sxpb, mirostat_it, "version")) {
6✔
163
      mirostat.version = 2;
1✔
164
    }
165
    lone_subfield_at_FildeshSxpb_to_float(&mirostat.tau, sxpb, mirostat_it, "tau");
6✔
166
    lone_subfield_at_FildeshSxpb_to_float(&mirostat.eta, sxpb, mirostat_it, "eta");
6✔
167
    pick_via = mirostat;
6✔
168
    return true;
6✔
169
  }
170
  return false;
171
}
172

173
  bool
174
rendezllama::inference::populate_InferVia(
21✔
175
    InferVia& infer_via,
176
    FildeshSxpb* sxpb,
177
    FildeshSxpbIT it)
178
{
179
  if (nullish_FildeshSxpbIT(it)) {
21✔
180
    return false;
181
  }
182
  const FildeshSxpbIT sampling_it = lookup_subfield_at_FildeshSxpb(sxpb, it, "sampling");
16✔
183
  Sampling sampling;
16✔
184
  if (!nullish_FildeshSxpbIT(sampling_it)) {
16✔
185
    unsigned seed = 0;
16✔
186
    if (lone_subfield_at_FildeshSxpb_to_unsigned(&seed, sxpb, sampling_it, "seed")) {
16✔
187
      sampling.seed = static_cast<int>(INT_MAX & seed);
1✔
188
    }
189

190
    it = lookup_subfield_at_FildeshSxpb(sxpb, sampling_it, "adjust_thru");
16✔
191
    for (it = first_at_FildeshSxpb(sxpb, it); !nullish_FildeshSxpbIT(it);
47✔
192
         it = next_at_FildeshSxpb(sxpb, it)) {
31✔
193
      AdjustVia adjust_via;
31✔
194
      if (populate_AdjustVia(adjust_via, sxpb, it)) {
31✔
195
        sampling.adjust_thru.push_back(adjust_via);
27✔
196
      }
197
    }
198

199
    FildeshSxpbIT pick_it = lookup_subfield_at_FildeshSxpb(sxpb, sampling_it, "pick_via");
16✔
200
    if (!nullish_FildeshSxpbIT(pick_it)) {
16✔
201
      populate_PickVia(sampling.pick_via, sxpb, pick_it);
10✔
202
    }
203
    else {
204
      Probability probability;
6✔
205
      sampling.pick_via = probability;
6✔
206
    }
207

208
    infer_via = sampling;
16✔
209
    return true;
16✔
210
  }
211
  return false;
212
}
16✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc