Skip to content

Commit 173733e

Browse files
Merge branch 'dev'
2 parents f65e4c9 + 36daaf1 commit 173733e

7 files changed

Lines changed: 96 additions & 95 deletions

File tree

DocToolsLLM/DocToolsLLM.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
class DocToolsLLM_class:
7979
"This docstring is dynamically replaced by the content of DocToolsLLM/docs/USAGE.md"
8080

81-
VERSION: str = "0.35"
81+
VERSION: str = "0.36"
8282

8383
#@optional_typecheck
8484
@typechecked
@@ -1282,7 +1282,7 @@ async def eval(inputs):
12821282
assert len(out.generations) == 1, f"Query eval llm produced more than 1 evaluations: '{out.generations}'"
12831283
outputs.append(out.generations[0].text)
12841284
finish_reason = out.generations[0].generation_info["finish_reason"]
1285-
assert finish_reason == "stop", f"unexpected finish_reason: '{finish}'"
1285+
assert finish_reason == "stop", f"unexpected finish_reason: '{finish_reason}'"
12861286
new_p += out.llm_output["token_usage"]["prompt_tokens"]
12871287
new_c += out.llm_output["token_usage"]["completion_tokens"]
12881288
assert outputs, "No generations found by query eval llm"

DocToolsLLM/utils/llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def load_llm(
8484
if not private and backend == "openai" and api_base is None and llm_cache is not False:
8585
red("Using ChatOpenAI instead of litellm because calling openai server anyway and the caching has a bug on langchain side :( The caching works on ChatOpenAI though. More at https://github.com/langchain-ai/langchain/issues/22389")
8686
max_tokens = litellm.get_model_info(modelname)["max_tokens"]
87-
if max_tokens not in extra_model_args:
87+
if "max_tokens" not in extra_model_args:
8888
extra_model_args["max_tokens"] = max_tokens
8989
llm = ChatOpenAI(
9090
model_name=modelname.split("/")[1],
@@ -96,7 +96,7 @@ def load_llm(
9696
else:
9797
red("A bug on langchain's side forces DocToolsLLM to disable the LLM caching. More at https://github.com/langchain-ai/langchain/issues/22389")
9898
max_tokens = litellm.get_model_info(modelname)["max_tokens"]
99-
if max_tokens not in extra_model_args:
99+
if "max_tokens" not in extra_model_args:
100100
extra_model_args["max_tokens"] = max_tokens
101101
if llm_cache is not False:
102102
red(f"Reminder: caching is disabled for non openai models until langchain approves the fix.")

DocToolsLLM/utils/misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ def get_splitter(
297297
max_tokens = 4096
298298
try:
299299
max_tokens = litellm.get_model_info(modelname)["max_input_tokens"]
300+
# max_tokens = litellm.get_model_info(modelname)["max_tokens"]
300301

301302
# don't use overly large chunks anyway
302303
max_tokens = min(max_tokens, int(2.5 * litellm.get_model_info(modelname)["max_tokens"]))

bumpver.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpver]
2-
current_version = "0.35"
2+
current_version = "0.36"
33
version_pattern = "MAJOR.MINOR"
44
commit_message = "bump version {old_version} -> {new_version}"
55
tag_message = "{new_version}"

completion.cli.bash

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -95,167 +95,167 @@ _complete-DocToolsLLM()
9595
lastcommand=$(get_lastcommand)
9696

9797
opts=""
98-
GLOBAL_OPTIONS="--dollar-limit --no-llm-cache --query --top-k --load-embeds-from --llms-api-bases --embed-kwargs --query-eval-modelname --debug --task --query-retrievers --embed-model --chat-memory --summary-language --import-mode --save-embeds-as --query-eval-check-number --private --notification-callback --filetype --query-relevancy --query-condense-question --file-loader-parallel-backend --summary-n-recursion --modelname --DIY-rolling-window-embedding --llm-verbosity"
98+
GLOBAL_OPTIONS="--debug --llm-verbosity --load-embeds-from --query-retrievers --notification-callback --query-eval-check-number --embed-model --DIY-rolling-window-embedding --llms-api-bases --chat-memory --filetype --query-condense-question --summary-n-recursion --query-eval-modelname --import-mode --save-embeds-as --query-relevancy --no-llm-cache --query --file-loader-parallel-backend --summary-language --embed-kwargs --task --dollar-limit --private --modelname --top-k"
9999

100100

101101
case "${lastcommand}" in
102102

103-
center)
103+
translate)
104104

105105
if is_prev_global; then
106106
opts="${GLOBAL_OPTIONS}"
107107
else
108-
opts="--fillchar --width ${GLOBAL_OPTIONS}"
108+
opts="--table ${GLOBAL_OPTIONS}"
109109
fi
110110
opts=$(filter_options $opts)
111111
;;
112112

113-
ljust)
113+
removeprefix)
114114

115115
if is_prev_global; then
116116
opts="${GLOBAL_OPTIONS}"
117117
else
118-
opts="--fillchar --width ${GLOBAL_OPTIONS}"
118+
opts="--prefix ${GLOBAL_OPTIONS}"
119119
fi
120120
opts=$(filter_options $opts)
121121
;;
122122

123-
prepare-query-task)
123+
removesuffix)
124124

125125
if is_prev_global; then
126126
opts="${GLOBAL_OPTIONS}"
127127
else
128-
opts="--self ${GLOBAL_OPTIONS}"
128+
opts="--suffix ${GLOBAL_OPTIONS}"
129129
fi
130130
opts=$(filter_options $opts)
131131
;;
132132

133-
expandtabs)
133+
replace)
134134

135135
if is_prev_global; then
136136
opts="${GLOBAL_OPTIONS}"
137137
else
138-
opts="--tabsize ${GLOBAL_OPTIONS}"
138+
opts="--count --new --old ${GLOBAL_OPTIONS}"
139139
fi
140140
opts=$(filter_options $opts)
141141
;;
142142

143-
encode)
143+
split)
144144

145145
if is_prev_global; then
146146
opts="${GLOBAL_OPTIONS}"
147147
else
148-
opts="--encoding --errors ${GLOBAL_OPTIONS}"
148+
opts="--maxsplit --sep ${GLOBAL_OPTIONS}"
149149
fi
150150
opts=$(filter_options $opts)
151151
;;
152152

153-
rstrip)
153+
join)
154154

155155
if is_prev_global; then
156156
opts="${GLOBAL_OPTIONS}"
157157
else
158-
opts="--chars ${GLOBAL_OPTIONS}"
158+
opts="--iterable ${GLOBAL_OPTIONS}"
159159
fi
160160
opts=$(filter_options $opts)
161161
;;
162162

163-
removesuffix)
163+
VERSION)
164164

165165
if is_prev_global; then
166166
opts="${GLOBAL_OPTIONS}"
167167
else
168-
opts="--suffix ${GLOBAL_OPTIONS}"
168+
opts="capitalize casefold center count encode endswith expandtabs find format format-map index isalnum isalpha isascii isdecimal isdigit isidentifier islower isnumeric isprintable isspace istitle isupper join ljust lower lstrip maketrans partition removeprefix removesuffix replace rfind rindex rjust rpartition rsplit rstrip split splitlines startswith strip swapcase title translate upper zfill ${GLOBAL_OPTIONS}"
169169
fi
170170
opts=$(filter_options $opts)
171171
;;
172172

173-
rpartition)
173+
zfill)
174174

175175
if is_prev_global; then
176176
opts="${GLOBAL_OPTIONS}"
177177
else
178-
opts="--sep ${GLOBAL_OPTIONS}"
178+
opts="--width ${GLOBAL_OPTIONS}"
179179
fi
180180
opts=$(filter_options $opts)
181181
;;
182182

183-
strip)
183+
rpartition)
184184

185185
if is_prev_global; then
186186
opts="${GLOBAL_OPTIONS}"
187187
else
188-
opts="--chars ${GLOBAL_OPTIONS}"
188+
opts="--sep ${GLOBAL_OPTIONS}"
189189
fi
190190
opts=$(filter_options $opts)
191191
;;
192192

193-
partition)
193+
strip)
194194

195195
if is_prev_global; then
196196
opts="${GLOBAL_OPTIONS}"
197197
else
198-
opts="--sep ${GLOBAL_OPTIONS}"
198+
opts="--chars ${GLOBAL_OPTIONS}"
199199
fi
200200
opts=$(filter_options $opts)
201201
;;
202202

203-
translate)
203+
lstrip)
204204

205205
if is_prev_global; then
206206
opts="${GLOBAL_OPTIONS}"
207207
else
208-
opts="--table ${GLOBAL_OPTIONS}"
208+
opts="--chars ${GLOBAL_OPTIONS}"
209209
fi
210210
opts=$(filter_options $opts)
211211
;;
212212

213-
lstrip)
213+
ljust)
214214

215215
if is_prev_global; then
216216
opts="${GLOBAL_OPTIONS}"
217217
else
218-
opts="--chars ${GLOBAL_OPTIONS}"
218+
opts="--fillchar --width ${GLOBAL_OPTIONS}"
219219
fi
220220
opts=$(filter_options $opts)
221221
;;
222222

223-
rjust)
223+
expandtabs)
224224

225225
if is_prev_global; then
226226
opts="${GLOBAL_OPTIONS}"
227227
else
228-
opts="--fillchar --width ${GLOBAL_OPTIONS}"
228+
opts="--tabsize ${GLOBAL_OPTIONS}"
229229
fi
230230
opts=$(filter_options $opts)
231231
;;
232232

233-
join)
233+
rstrip)
234234

235235
if is_prev_global; then
236236
opts="${GLOBAL_OPTIONS}"
237237
else
238-
opts="--iterable ${GLOBAL_OPTIONS}"
238+
opts="--chars ${GLOBAL_OPTIONS}"
239239
fi
240240
opts=$(filter_options $opts)
241241
;;
242242

243-
rsplit)
243+
prepare-query-task)
244244

245245
if is_prev_global; then
246246
opts="${GLOBAL_OPTIONS}"
247247
else
248-
opts="--maxsplit --sep ${GLOBAL_OPTIONS}"
248+
opts="--self ${GLOBAL_OPTIONS}"
249249
fi
250250
opts=$(filter_options $opts)
251251
;;
252252

253-
replace)
253+
rsplit)
254254

255255
if is_prev_global; then
256256
opts="${GLOBAL_OPTIONS}"
257257
else
258-
opts="--count --new --old ${GLOBAL_OPTIONS}"
258+
opts="--maxsplit --sep ${GLOBAL_OPTIONS}"
259259
fi
260260
opts=$(filter_options $opts)
261261
;;
@@ -266,52 +266,52 @@ _complete-DocToolsLLM()
266266
opts=$(filter_options $opts)
267267
;;
268268

269-
split)
269+
encode)
270270

271271
if is_prev_global; then
272272
opts="${GLOBAL_OPTIONS}"
273273
else
274-
opts="--maxsplit --sep ${GLOBAL_OPTIONS}"
274+
opts="--encoding --errors ${GLOBAL_OPTIONS}"
275275
fi
276276
opts=$(filter_options $opts)
277277
;;
278278

279-
splitlines)
279+
rjust)
280280

281281
if is_prev_global; then
282282
opts="${GLOBAL_OPTIONS}"
283283
else
284-
opts="--keepends ${GLOBAL_OPTIONS}"
284+
opts="--fillchar --width ${GLOBAL_OPTIONS}"
285285
fi
286286
opts=$(filter_options $opts)
287287
;;
288288

289-
removeprefix)
289+
partition)
290290

291291
if is_prev_global; then
292292
opts="${GLOBAL_OPTIONS}"
293293
else
294-
opts="--prefix ${GLOBAL_OPTIONS}"
294+
opts="--sep ${GLOBAL_OPTIONS}"
295295
fi
296296
opts=$(filter_options $opts)
297297
;;
298298

299-
VERSION)
299+
splitlines)
300300

301301
if is_prev_global; then
302302
opts="${GLOBAL_OPTIONS}"
303303
else
304-
opts="capitalize casefold center count encode endswith expandtabs find format format-map index isalnum isalpha isascii isdecimal isdigit isidentifier islower isnumeric isprintable isspace istitle isupper join ljust lower lstrip maketrans partition removeprefix removesuffix replace rfind rindex rjust rpartition rsplit rstrip split splitlines startswith strip swapcase title translate upper zfill ${GLOBAL_OPTIONS}"
304+
opts="--keepends ${GLOBAL_OPTIONS}"
305305
fi
306306
opts=$(filter_options $opts)
307307
;;
308308

309-
zfill)
309+
center)
310310

311311
if is_prev_global; then
312312
opts="${GLOBAL_OPTIONS}"
313313
else
314-
opts="--width ${GLOBAL_OPTIONS}"
314+
opts="--fillchar --width ${GLOBAL_OPTIONS}"
315315
fi
316316
opts=$(filter_options $opts)
317317
;;

0 commit comments

Comments
 (0)