File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " rigging"
3- version = " 3.3.4 "
3+ version = " 3.3.5 "
44description = " LLM Interaction Framework"
55authors = [" Nick Landers <monoxgas@gmail.com>" ]
66license = " MIT"
Original file line number Diff line number Diff line change @@ -254,13 +254,17 @@ def _warn_on_input_truncation(
254254 # - https://github.com/ollama/ollama/issues/7987
255255 # - https://github.com/ollama/ollama/issues/4967
256256
257+ # Not perfect
258+ if "ollama" not in self .model .lower ():
259+ return
260+
257261 # We can't check with usage info
258262 if not response .usage :
259263 return
260264
261265 # Get a general view of how long we might expect the input prompt to
262- # We'll use a gracious 4 char per token estimate
263- input_tokens_estimate = int (sum (len (message .content ) for message in messages ) / 4 )
266+ # We'll use a gracious 10 char per token estimate
267+ input_tokens_estimate = int (sum (len (message .content ) for message in messages ) / 10 )
264268
265269 # Check if the response reports that accepted input tokens are less than this
266270 if response .usage .input_tokens < input_tokens_estimate :
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ def _attempt_parse_tool_calls_from_string(candidate_str: str) -> list[ToolCall]
104104def _render_tool_call_to_pythonic_string (tool_call : ToolCall ) -> str :
105105 """Renders a single ToolCall object to its pythonic string representation."""
106106 args_dict = json .loads (tool_call .function .arguments )
107- args_str = ", " .join (f"{ key } ={ json . dumps ( value ) } " for key , value in args_dict .items ())
107+ args_str = ", " .join (f"{ key } ={ value !r } " for key , value in args_dict .items ())
108108 return f"{ tool_call .function .name } ({ args_str } )"
109109
110110
You can’t perform that action at this time.
0 commit comments