Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Nardien/agent-distillation
/ functions
Functions
494 in github.com/Nardien/agent-distillation
⨍
Functions
494
◇
Types & classes
93
↳
Endpoints
1
↓ 109 callers
Method
append
(self, text)
src/smolagents/local_python_executor.py:136
↓ 63 callers
Function
evaluate_ast
Evaluate an abstract syntax tree using the content of the variables stored in a state and only evaluating a given set of functions. This
src/smolagents/local_python_executor.py:1359
↓ 30 callers
Method
log
Logs a message to the console. Args: level (LogLevel, optional): Defaults to LogLevel.INFO.
src/smolagents/monitoring.py:92
↓ 13 callers
Method
search
(self, query: str, num: int = None, return_score: bool = False)
search/retriever_server.py:149
↓ 10 callers
Method
run
Run the agent for the given task. Args: task (`str`): Task to perform. stream (`bool`): Whether to run in a
src/smolagents/agents.py:276
↓ 9 callers
Method
__init__
( self, flatten_messages_as_text: bool = False, tool_name_key: str = "name", t
src/smolagents/models.py:262
↓ 9 callers
Method
decode
Uses the `post_processor` to decode the model output.
src/smolagents/tools.py:1068
↓ 9 callers
Function
populate_template
(template: str, variables: Dict[str, Any])
src/smolagents/agents.py:84
↓ 8 callers
Function
_is_package_available
(package_name: str)
src/smolagents/utils.py:42
↓ 8 callers
Method
to_messages
(self, summary_mode: bool = False, **kwargs)
src/smolagents/memory.py:185
↓ 7 callers
Method
_prepare_completion_kwargs
Prepare parameters required for model invocation, handling parameter priorities. Parameter priority from high to low: 1. Exp
src/smolagents/models.py:276
↓ 6 callers
Method
dict
(self)
src/smolagents/memory.py:31
↓ 6 callers
Function
set_value
( target: ast.AST, value: Any, state: Dict[str, Any], static_tools: Dict[str, Callable], c
src/smolagents/local_python_executor.py:761
↓ 6 callers
Function
truncate_content
(content: str, max_length: int = MAX_LENGTH_TRUNCATE_CONTENT)
src/smolagents/utils.py:236
↓ 5 callers
Method
__init__
(self, provider: str = "serpapi")
src/smolagents/default_tools.py:139
↓ 5 callers
Method
encode
(self, query_list: List[str], is_query=True)
search/retriever_server.py:85
↓ 5 callers
Method
encode
Uses the `pre_processor` to prepare the inputs for the `model`.
src/smolagents/tools.py:1053
↓ 5 callers
Method
from_dict
(cls, model_dictionary: Dict[str, Any])
src/smolagents/models.py:398
↓ 5 callers
Function
get_source
Get the source code of a class or callable object (e.g.: function, method). First attempts to get the source code using `inspect.getsource`. I
src/smolagents/utils.py:385
↓ 5 callers
Method
log_markdown
(self, content: str, title: Optional[str] = None, level=LogLevel.INFO, style=YELLOW_HEX)
src/smolagents/monitoring.py:106
↓ 5 callers
Method
postprocess_message
Sometimes APIs fail to properly parse a tool call: this function tries to parse.
src/smolagents/models.py:861
↓ 5 callers
Function
remove_tool_call_from_messages
(messages: List[Dict[str, str]])
src/smolagents/models.py:246
↓ 5 callers
Function
tool
Convert a function into an instance of a dynamically created Tool subclass. Args: tool_function (`Callable`): Function to convert in
src/smolagents/tools.py:866
↓ 5 callers
Method
write_memory_to_messages
Reads past llm_outputs, actions, and observations or errors from the memory into a series of messages that can be used as input to th
src/smolagents/agents.py:515
↓ 4 callers
Function
get_clean_message_list
Subsequent messages with the same role will be concatenated to a single message. output_message_list is a list of messages that will be used
src/smolagents/models.py:175
↓ 4 callers
Function
get_tool_call_from_text
(text: str, tool_name_key: str, tool_arguments_key: str)
src/smolagents/models.py:230
↓ 4 callers
Method
log_error
(self, error_message: str)
src/smolagents/monitoring.py:103
↓ 4 callers
Method
run_code_raise_errors
(self, code: str, return_final_answer: bool = False)
src/smolagents/remote_executors.py:52
↓ 4 callers
Function
symbolic_equal
(a, b)
exps_research/unified_framework/math_utils/qwen_math_parser.py:834
↓ 4 callers
Function
symbolic_equal
(a, b)
exps_research/unified_framework/math_utils/qwen_math_grader.py:285
↓ 4 callers
Function
symbolic_equal
(a, b)
exps_research/unified_framework/processors/qwen_math_parser.py:834
↓ 4 callers
Method
to_dict
Convert the agent to a dictionary representation. Returns: `dict`: Dictionary representation of the agent.
src/smolagents/agents.py:1606
↓ 4 callers
Method
to_string
(self)
src/smolagents/agent_types.py:54
↓ 4 callers
Method
update_cost
Update total cost and check threshold Args: cost: Cost to add (in USD) Returns:
exps_research/unified_framework/processors/cost_tracker.py:41
↓ 3 callers
Method
__init__
(self, value)
src/smolagents/agent_types.py:42
↓ 3 callers
Method
_handle_comprehension_generators
Helper method to handle generators in all types of comprehensions
src/smolagents/tool_validation.py:86
↓ 3 callers
Method
_write_file
Writes content to a file with UTF-8 encoding.
src/smolagents/tools.py:293
↓ 3 callers
Function
append_result
Append result to output file in thread-safe manner Args: result: Result dictionary to append output_file: Path to output
exps_research/unified_framework/utils.py:127
↓ 3 callers
Method
get_token_counts
(self)
src/smolagents/models.py:330
↓ 3 callers
Function
get_tool_json_schema
(tool: Tool)
src/smolagents/models.py:146
↓ 3 callers
Function
handle_agent_output_types
(output, output_type=None)
src/smolagents/agent_types.py:262
↓ 3 callers
Function
load_docs
(corpus, doc_idxs)
search/retriever_server.py:43
↓ 3 callers
Method
log_rule
(self, title: str, level: int = LogLevel.INFO)
src/smolagents/monitoring.py:144
↓ 3 callers
Function
make_init_file
(folder: str | Path)
src/smolagents/utils.py:449
↓ 3 callers
Function
math_equal
Exact match of math if and only if: 1. numerical equal: both can convert to float and are equal 2. symbolic equal: both can convert to sy
exps_research/unified_framework/math_utils/qwen_math_grader.py:73
↓ 3 callers
Function
parse_digits
(num)
exps_research/unified_framework/math_utils/qwen_math_parser.py:600
↓ 3 callers
Function
parse_digits
(num)
exps_research/unified_framework/math_utils/qwen_math_grader.py:39
↓ 3 callers
Function
parse_digits
(num)
exps_research/unified_framework/processors/qwen_math_parser.py:600
↓ 3 callers
Function
preprocess_sft_dataset
(solution_type, datapath)
exps_research/train_utils/preprocess.py:98
↓ 3 callers
Method
process_entry
Process a single experiment entry Args: entry: Dictionary containing a question/problem model: Model
exps_research/unified_framework/processors/base.py:113
↓ 3 callers
Function
remove_last_user_message
( messages )
exps_research/train_utils/preprocess.py:148
↓ 3 callers
Function
run_experiment
Run an experiment with the unified framework - supports both agent and reasoning modes
exps_research/unified_framework/run_experiment.py:28
↓ 3 callers
Function
strip_string
(string, skip_unit=False)
exps_research/unified_framework/math_utils/qwen_math_parser.py:238
↓ 3 callers
Method
to_dict
Returns a dictionary representing the tool
src/smolagents/tools.py:202
↓ 3 callers
Method
to_raw
(self)
src/smolagents/agent_types.py:48
↓ 2 callers
Method
__init__
( self, retrieval_method: str = "bm25", retrieval_topk: int = 10, index_path
search/retriever_server.py:298
↓ 2 callers
Function
_convert_type_hints_to_json_schema
(func: Callable, error_on_missing_type_hints: bool = True)
src/smolagents/_function_type_hints_utils.py:276
↓ 2 callers
Method
_get_gradio_app_code
Get the Gradio app code.
src/smolagents/tools.py:375
↓ 2 callers
Method
_get_requirements
Get the requirements.
src/smolagents/tools.py:388
↓ 2 callers
Method
_get_tool_code
Get the tool's code.
src/smolagents/tools.py:371
↓ 2 callers
Function
_parse
(s)
exps_research/unified_framework/math_utils/qwen_math_parser.py:835
↓ 2 callers
Function
_parse
(s)
exps_research/unified_framework/math_utils/qwen_math_grader.py:286
↓ 2 callers
Function
_parse
(s)
exps_research/unified_framework/processors/qwen_math_parser.py:835
↓ 2 callers
Method
_run
( self, task: str, max_steps: int, images: List["PIL.Image.Image"] | None = None )
src/smolagents/agents.py:356
↓ 2 callers
Function
calculate_cost
Calculate cost based on model pricing Args: input_tokens: Number of input tokens output_tokens: Number of output tokens
exps_research/unified_framework/utils.py:18
↓ 2 callers
Method
calculate_cost
Calculate the total cost of API calls based on token usage. Returns: dict: Dictionary containing cost information including:
src/smolagents/agents.py:1077
↓ 2 callers
Function
check_module_authorized
(module_name, authorized_imports)
src/smolagents/local_python_executor.py:1234
↓ 2 callers
Function
choice_answer_clean
(pred: str)
exps_research/unified_framework/math_utils/qwen_math_parser.py:393
↓ 2 callers
Function
choice_answer_clean
(pred: str)
exps_research/unified_framework/processors/qwen_math_parser.py:393
↓ 2 callers
Function
clean_messages
(messages)
exps_research/train_utils/preprocess.py:155
↓ 2 callers
Method
cleanup
Clean up resources.
src/smolagents/remote_executors.py:339
↓ 2 callers
Method
create_client
(self)
src/smolagents/models.py:1232
↓ 2 callers
Method
create_model
Create a model instance for this worker Args: worker_id: ID of the worker thread/process use_local_m
exps_research/unified_framework/processors/base.py:127
↓ 2 callers
Function
encode_image_base64
(image)
src/smolagents/utils.py:439
↓ 2 callers
Function
escape_code_brackets
Escapes square brackets in code segments while preserving Rich styling tags.
src/smolagents/utils.py:65
↓ 2 callers
Function
estimate_len
(node, state)
src/smolagents/local_python_executor.py:205
↓ 2 callers
Function
filter_agent_trajectories
(result_path, do_save=True)
exps_research/unified_framework/filter_agent_training_data.py:14
↓ 2 callers
Function
fix_final_answer_code
Sometimes an LLM can try to assign a variable to final_answer, which would break the final_answer() tool. This function fixes this behaviour
src/smolagents/local_python_executor.py:340
↓ 2 callers
Method
from_code
(cls, tool_code: str, **kwargs)
src/smolagents/tools.py:448
↓ 2 callers
Method
from_hf_api
(cls, message, raw)
src/smolagents/models.py:96
↓ 2 callers
Method
from_hub
Loads a tool defined on the Hub. <Tip warning={true}> Loading a tool from the Hub means that you'll download the tool and e
src/smolagents/tools.py:393
↓ 2 callers
Function
get_dict_from_nested_dataclasses
(obj, ignore_key=None)
src/smolagents/models.py:46
↓ 2 callers
Function
get_method_source
Get source code for a method, including bound methods.
src/smolagents/utils.py:264
↓ 2 callers
Function
get_safe_module
Creates a safe copy of a module or returns the original if it's a function
src/smolagents/local_python_executor.py:1196
↓ 2 callers
Function
get_step_footnote_content
Get a footnote string for a step log with duration and token information
src/smolagents/gradio_ui.py:27
↓ 2 callers
Function
handle_agent_input_types
(*args, **kwargs)
src/smolagents/agent_types.py:256
↓ 2 callers
Method
initialize_system_prompt
To be implemented in child classes
src/smolagents/agents.py:511
↓ 2 callers
Method
install_packages
(self, additional_imports: List[str])
src/smolagents/remote_executors.py:88
↓ 2 callers
Function
instance_to_source
Convert an instance to its class source code representation.
src/smolagents/utils.py:294
↓ 2 callers
Function
is_digit
(num)
exps_research/unified_framework/math_utils/qwen_math_parser.py:616
↓ 2 callers
Function
is_digit
(num)
exps_research/unified_framework/math_utils/qwen_math_grader.py:55
↓ 2 callers
Function
is_digit
(num)
exps_research/unified_framework/processors/qwen_math_parser.py:616
↓ 2 callers
Function
load_corpus
(corpus_path: str)
search/retriever_server.py:27
↓ 2 callers
Function
load_dataset
Load dataset from file Args: file_path: Path to dataset file Returns: List of examples
exps_research/unified_framework/utils.py:56
↓ 2 callers
Function
load_file_from_path
Load a file from the given path. Args: file_path (str): Path to the file. Returns: dataset (list): loaded d
exps_research/train_utils/preprocess.py:105
↓ 2 callers
Function
load_model
(model_type: str, model_id: str, api_base: str | None = None, api_key: str | None = None)
src/smolagents/cli.py:82
↓ 2 callers
Method
log_messages
(self, messages: List)
src/smolagents/monitoring.py:166
↓ 2 callers
Method
log_task
(self, content: str, subtitle: str, title: Optional[str] = None, level: int = LogLevel.INFO)
src/smolagents/monitoring.py:154
↓ 2 callers
Function
make_json_serializable
Recursive function to make objects JSON serializable
src/smolagents/utils.py:127
↓ 2 callers
Function
memoized_canonical_form
Compute a canonical form for a mathematical expression using sympy. Uses a shared cache across processes for memoization. Args:
exps_research/unified_framework/math_utils/group.py:28
next →
1–100 of 494, ranked by callers