Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/aiwaves-cn/agents
/ functions
Functions
388 in github.com/aiwaves-cn/agents
⨍
Functions
388
◇
Types & classes
90
↓ 1 callers
Method
add_state
(self, state)
src/agents/evaluation/trajectory.py:10
↓ 1 callers
Method
backward
Performs backward pass to evaluate the case and get suggestions for optimizing the SOP. Args: case (Case): The case to b
src/agents/optimization/sop_optimizer.py:125
↓ 1 callers
Method
case_forward
forward case to get the result and save it to the file. Args: case: the case to be forwarded solution_or_pat
src/agents/optimization/utils.py:73
↓ 1 callers
Function
chdir
(root)
src/agents/utils/execution.py:67
↓ 1 callers
Method
check_config
(config: dict)
src/agents/task/sop.py:96
↓ 1 callers
Function
check_correctness
Evaluates the functional correctness of a completion by running the test suite provided in the problem. :param completion_id: an optiona
src/agents/datasets/humaneval.py:59
↓ 1 callers
Method
check_if_new_prompt_legal
Check if the new prompt is legal. This function checks whether the new prompt (given as a JSON string) is a valid update to
src/agents/optimization/prompt_optimizer.py:330
↓ 1 callers
Method
check_sop_optim_op_list_legal
Checks the legality of the SOP optimization operations provided by the LLM. Args: optim_result (str): The optimization r
src/agents/optimization/sop_optimizer.py:263
↓ 1 callers
Method
chunk_elements
r"""Chunks elements by titles. Args: elements (List[Any]): List of Element objects to be chunked. chunk_type (str): T
src/agents/utils/unstructured_io.py:383
↓ 1 callers
Method
compile
get prompt from state depend on your role Return: system_prompt:system_prompt for agents's LLM last_prompt:last_promp
src/agents/agents/agent.py:283
↓ 1 callers
Function
count_files_in_directory
(directory)
src/agents/utils/files.py:6
↓ 1 callers
Function
create_tempdir
()
src/agents/utils/execution.py:35
↓ 1 callers
Function
delete_files_if_exceed_threshold
(directory, threshold)
src/agents/utils/files.py:28
↓ 1 callers
Function
delete_oldest_files
(directory, delete_count)
src/agents/utils/files.py:14
↓ 1 callers
Method
do_node_optim
Executes the node optimization based on the given method. Note: If an error occurs during optimization, an exception is raised inste
src/agents/optimization/node_optimizer.py:240
↓ 1 callers
Method
do_sop_optim
Performs SOP optimization based on the given operation. Args: solution (Solution): The current solution. op
src/agents/optimization/sop_optimizer.py:206
↓ 1 callers
Method
dump
(self, save_path)
src/agents/utils/config.py:37
↓ 1 callers
Method
early_stop
Achieved early stop in training Args: ave_score_list (list[float]): The score obtained for each case of the current step
src/agents/optimization/trainer.py:371
↓ 1 callers
Method
embed_list
r"""Generates embeddings for the given texts. Args: objs (List[str]): The texts for which to generate the embeddings.
src/agents/utils/embeddings.py:121
↓ 1 callers
Method
escape_special_chars_in_json_string
Escapes special characters in a JSON string. In the JSON strings provided by large models, there may be special characters t
src/agents/optimization/utils.py:232
↓ 1 callers
Function
estimate_pass_at_k
Estimates pass@k of each problem and returns them in an array.
src/agents/datasets/humaneval.py:31
↓ 1 callers
Function
estimator
Calculates 1 - comb(n - c, k) / comb(n, k).
src/agents/datasets/humaneval.py:40
↓ 1 callers
Function
extract
(text, type)
src/agents/datasets/creative_writing.py:22
↓ 1 callers
Function
f1_score
(prediction, ground_truth)
src/agents/datasets/hotpotqa.py:26
↓ 1 callers
Method
find_outermost_tags
Find the outermost tags in the given string. This function matches the outermost tags in the provided string using a greedy matching
src/agents/optimization/utils.py:272
↓ 1 callers
Method
finish
(self)
src/agents/tools/web_browse.py:29
↓ 1 callers
Method
func
(self)
src/agents/tools/tool.py:12
↓ 1 callers
Method
get_case_dict
Create a dictionary representing a case at a specific index. Args: idx (int): The index of the case. Returns:
src/agents/datasets/creative_writing.py:79
↓ 1 callers
Method
get_case_dict
Create a dictionary representing a case at a specific index, including the ground truth if available. Args: idx (int): The i
src/agents/datasets/hotpotqa.py:77
↓ 1 callers
Function
get_content_between_a_b
Args: start_tag (str): start_tag end_tag (str): end_tag text (str): complete sentence Returns: str: the con
src/agents/utils/text.py:1
↓ 1 callers
Function
get_content_between_a_b
(start_tag, end_tag, text)
src/agents/datasets/creative_writing.py:8
↓ 1 callers
Function
get_content_between_a_b
(start_tag, end_tag, text)
src/agents/datasets/humaneval.py:17
↓ 1 callers
Function
get_content_between_a_b
(start_tag, end_tag, text)
src/agents/datasets/math.py:10
↓ 1 callers
Method
get_dict_for_loss_calculation
Get information needed for backward and training processes. Args: keys (list): The list of keys for the required informa
src/agents/evaluation/case.py:95
↓ 1 callers
Method
get_memory
(self)
src/agents/agents/memory.py:194
↓ 1 callers
Method
get_memory_summary
(self)
src/agents/agents/memory.py:140
↓ 1 callers
Method
get_prompt_config_order
Gets the order of the prompt configuration based on the availability of ground truth and evaluation score. Returns: list
src/agents/optimization/loss.py:141
↓ 1 callers
Function
get_score
case跑完了之后加载保存下来的case获取分数,会获取路径下所有的case的分数,然后计算加权平均分数 Returns:
examples/math_dataset/get_score.py:5
↓ 1 callers
Method
get_step_optim_order
Get the optimizer to call for the current step There are four choices for the order of optimizers: order, random, up_to_down, and do
src/agents/optimization/trainer.py:175
↓ 1 callers
Method
get_stream
(self, response, log_path, messages)
src/agents/agents/llm.py:94
↓ 1 callers
Method
init_name_role_hash_for_nodes
(self, agent_team: AgentTeam)
src/agents/task/sop.py:183
↓ 1 callers
Method
init_node_prompts
(self)
src/agents/task/sop.py:194
↓ 1 callers
Method
load_from_json
Loads a State object from a JSON dictionary. Args: state_json (dict): The JSON dictionary containing the state data.
src/agents/evaluation/state.py:98
↓ 1 callers
Function
lower
(text)
src/agents/datasets/hotpotqa.py:20
↓ 1 callers
Method
next
Determine the next node and the agent that needs action based on the current situation Return : next_node(node) : the next no
src/agents/task/sop.py:394
↓ 1 callers
Method
node_eval
Evaluates the node and saves the result to the file. Args: case (Case): The case to be evaluated. solution (
src/agents/optimization/utils.py:155
↓ 1 callers
Method
observe
observe the environment and return the observation Return: observation(dict)
src/agents/agents/agent.py:113
↓ 1 callers
Method
optimize_node
Optimizes the configuration of each node in the solution based on the cases. Args: case_list (list[Case]): The list of c
src/agents/optimization/node_optimizer.py:175
↓ 1 callers
Method
optimize_prompt
Optimizes the agent's prompt to minimize loss. Args: case_list (list[Case]): A batch of cases. Returns:
src/agents/optimization/prompt_optimizer.py:212
↓ 1 callers
Method
optimize_single_node
Optimizes the configuration information of a single node. Args: case_list (list[Case]): The list of cases. n
src/agents/optimization/node_optimizer.py:201
↓ 1 callers
Method
parallel_backward
Performs parallel backward optimization for a list of cases. Args: case_list (list[Case]): The list of cases to be optim
src/agents/optimization/prompt_optimizer.py:190
↓ 1 callers
Method
parallel_calculate_loss
Calculates the loss for a list of cases in parallel. Args: case_list (list): The list of cases. parallel_max
src/agents/optimization/loss.py:114
↓ 1 callers
Method
parallel_execution
Parallelly execute a list of partial functions pre-filled with parameters. This method runs a list of partially filled functions in
src/agents/optimization/utils.py:340
↓ 1 callers
Method
parse_file_or_url
r"""Loads a file or a URL and parses its contents as unstructured data. Args: input_path (str): Path to the file or URL to be par
src/agents/utils/unstructured_io.py:61
↓ 1 callers
Method
process
r"""Processes content from a file or URL, divides it into chunks by using `Unstructured IO`, and stores their embeddings in the specified
src/agents/utils/retrievers/vector_retriever.py:36
↓ 1 callers
Method
query
r"""Query the results. Subclasses should implement this method according to their specific needs. Args: query (str): Quer
src/agents/utils/retrievers/base.py:32
↓ 1 callers
Method
query
r"""Executes a query in vector storage and compiles the retrieved results into a dictionary. Args: query (str): Query str
src/agents/utils/retrievers/vector_retriever.py:114
↓ 1 callers
Method
query
r"""Searches for similar vectors in the storage based on the provided query. Args: query (VectorDBQuery): The query object contai
src/agents/utils/storages/vectordb_storages/base.py:131
↓ 1 callers
Method
read
(self, *args, **kwargs)
src/agents/utils/execution.py:48
↓ 1 callers
Function
reliability_guard
This disables various destructive functions and prevents the generated code from interfering with the test (e.g. fork bomb, killing other pro
src/agents/utils/execution.py:81
↓ 1 callers
Function
remove_articles
(text)
src/agents/datasets/hotpotqa.py:10
↓ 1 callers
Function
remove_punc
(text)
src/agents/datasets/hotpotqa.py:16
↓ 1 callers
Method
retrieve
(self, query: str)
src/agents/knowledge_bases/knowledge_base.py:113
↓ 1 callers
Method
retrieve_from_file
( self, query: str, file_path: str, top_k: int = 1, similarity_thresho
src/agents/knowledge_bases/knowledge_base.py:123
↓ 1 callers
Method
roll_back
roll back to the last solution if the new solution is worse than the last solution If the score of the new solution on the current s
src/agents/optimization/trainer.py:414
↓ 1 callers
Method
route
Determine the role that needs action based on the current situation Return : next_agent_name(str) : the name of the next act
src/agents/task/sop.py:292
↓ 1 callers
Function
run_eval
()
examples/hotpotqa/run_eval.py:21
↓ 1 callers
Function
run_eval
()
examples/math_dataset/run_eval.py:25
↓ 1 callers
Function
run_eval
()
examples/creative_writing/run_eval.py:54
↓ 1 callers
Method
sample_case_list
Extract self.batch_size cases from the dataset. Args: sample_kind (str): The method for extracting cases from the datase
src/agents/optimization/trainer.py:334
↓ 1 callers
Method
save_step
Saves the final optimization results. Args: step_save_path (str): The path to save the step information. opt
src/agents/optimization/prompt_optimizer.py:314
↓ 1 callers
Function
setup_logging
Initialize the logging configuration. This function sets up logging to both a file and the console. Log messages are saved to a file wit
src/agents/optimization/trainer.py:472
↓ 1 callers
Method
step
return actions by current state and environment Return: action(Action)
src/agents/agents/agent.py:144
↓ 1 callers
Function
swallow_io
()
src/agents/utils/execution.py:26
↓ 1 callers
Function
time_limit
(seconds: float)
src/agents/utils/execution.py:13
↓ 1 callers
Method
to_list
(self)
src/agents/evaluation/trajectory.py:23
↓ 1 callers
Method
transit
Determine the next node based on the current situation Return : next_node(node) : the next node
src/agents/task/sop.py:205
↓ 1 callers
Method
try_optim_prompt
Checks each prompt for validity and updates the solution if valid. Args: case_list (list[Case]): The list of cases.
src/agents/optimization/prompt_optimizer.py:251
↓ 1 callers
Method
try_optim_with_llm_result
Attempts to optimize the solution using the given LLM result. Args: solution (Solution): The current solution.
src/agents/optimization/sop_optimizer.py:158
↓ 1 callers
Method
update
(self, config: dict)
src/agents/task/node.py:141
↓ 1 callers
Method
update_nodes_from_case
(self, case_padding: dict)
src/agents/task/sop.py:198
↓ 1 callers
Method
update_prompt
Updates the prompt in the solution. Args: solution (Solution): The solution to be updated. node_name (str):
src/agents/optimization/prompt_optimizer.py:296
↓ 1 callers
Method
validate_dict
Validates the optimization method list. Args: optim_method_list (list): The list of optimization methods. Retur
src/agents/optimization/node_optimizer.py:319
↓ 1 callers
Function
white_space_fix
(text)
src/agents/datasets/hotpotqa.py:13
Method
__del__
r"""Deletes the collection if :obj:`del_collection` is set to :obj:`True`.
src/agents/utils/storages/vectordb_storages/qdrant.py:95
Method
__getitem__
Retrieve an item by its index. Args: idx (int): The index of the item to retrieve. Returns: str: The item a
src/agents/datasets/creative_writing.py:67
Method
__getitem__
Retrieve a programming prompt by its index. Args: idx (int): The index of the prompt. Returns: str:
src/agents/datasets/humaneval.py:142
Method
__getitem__
Retrieve a question by its index. Args: idx (int): The index of the question. Returns: str: The question te
src/agents/datasets/hotpotqa.py:65
Method
__getitem__
Abstract method to get an item by index. Args: idx (int): The index of the item. Returns: The item at the s
src/agents/datasets/base.py:61
Method
__getitem__
Retrieve a question by its index. Args: idx (int): The index of the question. Returns: str: The question te
src/agents/datasets/software_dev.py:20
Method
__getitem__
Retrieve a math problem by its index. Args: idx (int): The index of the math problem. Returns: str: The mat
src/agents/datasets/math.py:77
Method
__init__
(self)
src/agents/tools/math.py:39
Method
__init__
(self)
src/agents/tools/math.py:65
Method
__init__
(self, api_key, TIME_FORMAT="%Y-%m-%d")
src/agents/tools/weather.py:9
Method
__init__
(self)
src/agents/tools/web_crawl.py:13
Method
__init__
(self, instruction: str, plan: str = "", mode: str = "react")
src/agents/tools/web_browse.py:9
Method
__init__
(self, api_key, location, default_target_language="zh-cn")
src/agents/tools/translate.py:142
Method
__init__
:param engine: The name of the search engine used :param api: Pass in a dictionary, such as {"bing":"key1", "google":"key2", ...}, of
src/agents/tools/web_search.py:13
Method
__init__
(self, description, name, parameters)
src/agents/tools/tool.py:5
Method
__init__
(self, model: str = "gpt-4", api_key: str = None, api_base: str = None)
src/agents/tools/code_interpreter.py:9
← previous
next →
101–200 of 388, ranked by callers