sherpa_ai package#
Subpackages#
- sherpa_ai.action_planner package
- sherpa_ai.actions package
- Submodules
- sherpa_ai.actions.answer_arithmetic module
- sherpa_ai.actions.arxiv_search module
- sherpa_ai.actions.base module
ActionArgument
ActionResource
AsyncBaseAction
BaseAction
BaseAction.name
BaseAction.args
BaseAction.usage
BaseAction.belief
BaseAction.output_key
BaseAction.Config
BaseAction.action_end()
BaseAction.action_start()
BaseAction.args
BaseAction.belief
BaseAction.execute()
BaseAction.input_validation()
BaseAction.model_config
BaseAction.name
BaseAction.output_key
BaseAction.usage
BaseRetrievalAction
BaseRetrievalAction.add_resources()
BaseRetrievalAction.current_task
BaseRetrievalAction.execute()
BaseRetrievalAction.model_config
BaseRetrievalAction.num_documents
BaseRetrievalAction.perform_refinement
BaseRetrievalAction.perform_reranking
BaseRetrievalAction.refine()
BaseRetrievalAction.refiner
BaseRetrievalAction.reranker
BaseRetrievalAction.reranking()
BaseRetrievalAction.resources
BaseRetrievalAction.search()
- sherpa_ai.actions.context_search module
- sherpa_ai.actions.deliberation module
- sherpa_ai.actions.google_search module
- sherpa_ai.actions.planning module
- sherpa_ai.actions.synthesize module
- Module contents
ArxivSearch
ArxivSearch.args
ArxivSearch.belief
ArxivSearch.current_task
ArxivSearch.description
ArxivSearch.llm
ArxivSearch.model_config
ArxivSearch.model_post_init()
ArxivSearch.name
ArxivSearch.num_documents
ArxivSearch.output_key
ArxivSearch.perform_refinement
ArxivSearch.perform_reranking
ArxivSearch.refine()
ArxivSearch.refiner
ArxivSearch.reranker
ArxivSearch.resources
ArxivSearch.role_description
ArxivSearch.search()
ArxivSearch.task
ArxivSearch.usage
Deliberation
EmptyAction
GoogleSearch
GoogleSearch.args
GoogleSearch.belief
GoogleSearch.config
GoogleSearch.current_task
GoogleSearch.description
GoogleSearch.llm
GoogleSearch.model_config
GoogleSearch.model_post_init()
GoogleSearch.name
GoogleSearch.num_documents
GoogleSearch.output_key
GoogleSearch.perform_refinement
GoogleSearch.perform_reranking
GoogleSearch.refiner
GoogleSearch.reranker
GoogleSearch.resources
GoogleSearch.role_description
GoogleSearch.search()
GoogleSearch.task
GoogleSearch.usage
SynthesizeOutput
TaskPlanning
- sherpa_ai.agents package
- Submodules
- sherpa_ai.agents.agent_pool module
- sherpa_ai.agents.base module
BaseAgent
BaseAgent.act()
BaseAgent.actions
BaseAgent.agent_finished()
BaseAgent.agent_preparation()
BaseAgent.async_act()
BaseAgent.async_run()
BaseAgent.async_send_event()
BaseAgent.belief
BaseAgent.create_actions()
BaseAgent.description
BaseAgent.do_synthesize_output
BaseAgent.feedback_agent_name
BaseAgent.global_regen_max
BaseAgent.llm
BaseAgent.model_config
BaseAgent.name
BaseAgent.num_runs
BaseAgent.observe()
BaseAgent.policy
BaseAgent.run()
BaseAgent.select_action()
BaseAgent.send_event()
BaseAgent.shared_memory
BaseAgent.synthesize_output()
BaseAgent.validate_output()
BaseAgent.validation_iterator()
BaseAgent.validation_steps
BaseAgent.validations
- sherpa_ai.agents.critic module
- sherpa_ai.agents.ml_engineer module
- sherpa_ai.agents.physicist module
- sherpa_ai.agents.planner module
- sherpa_ai.agents.qa_agent module
QAAgent
QAAgent.llm
QAAgent.name
QAAgent.description
QAAgent.shared_memory
QAAgent.belief
QAAgent.agent_config
QAAgent.num_runs
QAAgent.verbose_logger
QAAgent.actions
QAAgent.validation_steps
QAAgent.validations
QAAgent.citation_enabled
QAAgent.config
QAAgent.create_actions()
QAAgent.description
QAAgent.global_regen_max
QAAgent.model_config
QAAgent.name
QAAgent.num_runs
QAAgent.synthesize_output()
- sherpa_ai.agents.user module
- Module contents
AgentPool
Critic
Critic.actions
Critic.belief
Critic.create_actions()
Critic.description
Critic.do_synthesize_output
Critic.feedback_agent_name
Critic.get_detail_evaluation()
Critic.get_feedback()
Critic.get_importance_evaluation()
Critic.get_insight()
Critic.global_regen_max
Critic.llm
Critic.model_config
Critic.name
Critic.num_feedback
Critic.num_runs
Critic.policy
Critic.post_process()
Critic.ratio
Critic.shared_memory
Critic.synthesize_output()
Critic.validation_steps
Critic.validations
MLEngineer
MLEngineer.actions
MLEngineer.belief
MLEngineer.create_actions()
MLEngineer.description
MLEngineer.do_synthesize_output
MLEngineer.feedback_agent_name
MLEngineer.global_regen_max
MLEngineer.llm
MLEngineer.model_config
MLEngineer.name
MLEngineer.num_runs
MLEngineer.policy
MLEngineer.shared_memory
MLEngineer.synthesize_output()
MLEngineer.validation_steps
MLEngineer.validations
Physicist
Physicist.actions
Physicist.belief
Physicist.create_actions()
Physicist.description
Physicist.do_synthesize_output
Physicist.feedback_agent_name
Physicist.global_regen_max
Physicist.llm
Physicist.model_config
Physicist.name
Physicist.num_runs
Physicist.policy
Physicist.shared_memory
Physicist.synthesize_output()
Physicist.validation_steps
Physicist.validations
Planner
Planner.actions
Planner.agent_pool
Planner.belief
Planner.create_actions()
Planner.description
Planner.do_synthesize_output
Planner.feedback_agent_name
Planner.get_last_feedback()
Planner.get_last_plan()
Planner.global_regen_max
Planner.llm
Planner.model_config
Planner.name
Planner.num_runs
Planner.plan()
Planner.planning
Planner.policy
Planner.shared_memory
Planner.synthesize_output()
Planner.validation_steps
Planner.validations
QAAgent
QAAgent.llm
QAAgent.name
QAAgent.description
QAAgent.shared_memory
QAAgent.belief
QAAgent.agent_config
QAAgent.num_runs
QAAgent.verbose_logger
QAAgent.actions
QAAgent.validation_steps
QAAgent.validations
QAAgent.actions
QAAgent.belief
QAAgent.citation_enabled
QAAgent.config
QAAgent.create_actions()
QAAgent.description
QAAgent.do_synthesize_output
QAAgent.feedback_agent_name
QAAgent.global_regen_max
QAAgent.llm
QAAgent.model_config
QAAgent.name
QAAgent.num_runs
QAAgent.policy
QAAgent.shared_memory
QAAgent.synthesize_output()
QAAgent.validation_steps
QAAgent.validations
UserAgent
UserAgent.actions
UserAgent.belief
UserAgent.create_actions()
UserAgent.description
UserAgent.do_synthesize_output
UserAgent.feedback_agent_name
UserAgent.global_regen_max
UserAgent.llm
UserAgent.model_config
UserAgent.name
UserAgent.num_runs
UserAgent.policy
UserAgent.run()
UserAgent.shared_memory
UserAgent.synthesize_output()
UserAgent.validation_steps
UserAgent.validations
- sherpa_ai.config package
- sherpa_ai.database package
- Submodules
- sherpa_ai.database.user_usage_tracker module
UsageTracker
UserUsageTracker
UserUsageTracker.add_and_check_data()
UserUsageTracker.add_data()
UserUsageTracker.add_to_whitelist()
UserUsageTracker.check_if_reminded()
UserUsageTracker.check_usage()
UserUsageTracker.close_connection()
UserUsageTracker.create_table()
UserUsageTracker.download_from_s3()
UserUsageTracker.get_all_data()
UserUsageTracker.get_all_whitelisted_ids()
UserUsageTracker.get_data_since_last_reset()
UserUsageTracker.get_last_reset_info()
UserUsageTracker.get_sum_of_tokens_since_last_reset()
UserUsageTracker.get_whitelist_by_user_id()
UserUsageTracker.is_in_whitelist()
UserUsageTracker.percentage_used()
UserUsageTracker.remind_user_of_daily_token_limit()
UserUsageTracker.reset_usage()
UserUsageTracker.seconds_to_hms()
UserUsageTracker.upload_to_s3()
Whitelist
- Module contents
UserUsageTracker
UserUsageTracker.add_and_check_data()
UserUsageTracker.add_data()
UserUsageTracker.add_to_whitelist()
UserUsageTracker.check_if_reminded()
UserUsageTracker.check_usage()
UserUsageTracker.close_connection()
UserUsageTracker.create_table()
UserUsageTracker.download_from_s3()
UserUsageTracker.get_all_data()
UserUsageTracker.get_all_whitelisted_ids()
UserUsageTracker.get_data_since_last_reset()
UserUsageTracker.get_last_reset_info()
UserUsageTracker.get_sum_of_tokens_since_last_reset()
UserUsageTracker.get_whitelist_by_user_id()
UserUsageTracker.is_in_whitelist()
UserUsageTracker.percentage_used()
UserUsageTracker.remind_user_of_daily_token_limit()
UserUsageTracker.reset_usage()
UserUsageTracker.seconds_to_hms()
UserUsageTracker.upload_to_s3()
- sherpa_ai.error_handling package
- sherpa_ai.memory package
- Submodules
- sherpa_ai.memory.belief module
Belief
Belief.action_description
Belief.from_dict()
Belief.get()
Belief.get_action()
Belief.get_actions()
Belief.get_all_keys()
Belief.get_by_type()
Belief.get_context()
Belief.get_dict()
Belief.get_histories_excluding_types()
Belief.get_internal_history()
Belief.get_state()
Belief.get_state_obj()
Belief.has()
Belief.set()
Belief.set_actions()
Belief.set_current_task()
Belief.update()
Belief.update_internal()
- sherpa_ai.memory.shared_memory module
- Module contents
Belief
Belief.action_description
Belief.from_dict()
Belief.get()
Belief.get_action()
Belief.get_actions()
Belief.get_all_keys()
Belief.get_by_type()
Belief.get_context()
Belief.get_dict()
Belief.get_histories_excluding_types()
Belief.get_internal_history()
Belief.get_state()
Belief.get_state_obj()
Belief.has()
Belief.set()
Belief.set_actions()
Belief.set_current_task()
Belief.update()
Belief.update_internal()
SharedMemory
- sherpa_ai.models package
- Submodules
- sherpa_ai.models.chat_model_with_logging module
- sherpa_ai.models.sherpa_base_chat_model module
- sherpa_ai.models.sherpa_base_model module
- Module contents
SherpaChatOpenAI
SherpaChatOpenAI.cache
SherpaChatOpenAI.callback_manager
SherpaChatOpenAI.callbacks
SherpaChatOpenAI.custom_get_token_ids
SherpaChatOpenAI.default_headers
SherpaChatOpenAI.default_query
SherpaChatOpenAI.disable_streaming
SherpaChatOpenAI.extra_body
SherpaChatOpenAI.http_async_client
SherpaChatOpenAI.http_client
SherpaChatOpenAI.max_retries
SherpaChatOpenAI.max_tokens
SherpaChatOpenAI.metadata
SherpaChatOpenAI.model_kwargs
SherpaChatOpenAI.model_name
SherpaChatOpenAI.n
SherpaChatOpenAI.openai_api_base
SherpaChatOpenAI.openai_api_key
SherpaChatOpenAI.openai_organization
SherpaChatOpenAI.openai_proxy
SherpaChatOpenAI.rate_limiter
SherpaChatOpenAI.request_timeout
SherpaChatOpenAI.stop
SherpaChatOpenAI.stream_usage
SherpaChatOpenAI.streaming
SherpaChatOpenAI.tags
SherpaChatOpenAI.temperature
SherpaChatOpenAI.tiktoken_model_name
SherpaChatOpenAI.user_id
SherpaChatOpenAI.verbose
SherpaChatOpenAI.verbose_logger
SherpaOpenAI
SherpaOpenAI.cache
SherpaOpenAI.callback_manager
SherpaOpenAI.callbacks
SherpaOpenAI.custom_get_token_ids
SherpaOpenAI.default_headers
SherpaOpenAI.default_query
SherpaOpenAI.disable_streaming
SherpaOpenAI.extra_body
SherpaOpenAI.http_async_client
SherpaOpenAI.http_client
SherpaOpenAI.max_retries
SherpaOpenAI.max_tokens
SherpaOpenAI.metadata
SherpaOpenAI.model_kwargs
SherpaOpenAI.model_name
SherpaOpenAI.n
SherpaOpenAI.openai_api_base
SherpaOpenAI.openai_api_key
SherpaOpenAI.openai_organization
SherpaOpenAI.openai_proxy
SherpaOpenAI.rate_limiter
SherpaOpenAI.request_timeout
SherpaOpenAI.stop
SherpaOpenAI.stream_usage
SherpaOpenAI.streaming
SherpaOpenAI.tags
SherpaOpenAI.temperature
SherpaOpenAI.tiktoken_model_name
SherpaOpenAI.user_id
SherpaOpenAI.verbose
- sherpa_ai.output_parsers package
- Submodules
- sherpa_ai.output_parsers.base module
- sherpa_ai.output_parsers.citation_validation module
CitationValidation
CitationValidation.sequence_threshold
CitationValidation.jaccard_threshold
CitationValidation.token_overlap
CitationValidation.add_citation_to_sentence()
CitationValidation.add_citations()
CitationValidation.calculate_token_overlap()
CitationValidation.flatten_nested_list()
CitationValidation.format_sentence_with_citations()
CitationValidation.get_failure_message()
CitationValidation.jaccard_index()
CitationValidation.longest_common_subsequence()
CitationValidation.process_output()
CitationValidation.resources_from_belief()
CitationValidation.split_paragraph_into_sentences()
- sherpa_ai.output_parsers.link_parse module
- sherpa_ai.output_parsers.md_to_slack_parse module
- sherpa_ai.output_parsers.number_validation module
- sherpa_ai.output_parsers.validation_result module
- Module contents
CitationValidation
CitationValidation.sequence_threshold
CitationValidation.jaccard_threshold
CitationValidation.token_overlap
CitationValidation.add_citation_to_sentence()
CitationValidation.add_citations()
CitationValidation.calculate_token_overlap()
CitationValidation.flatten_nested_list()
CitationValidation.format_sentence_with_citations()
CitationValidation.get_failure_message()
CitationValidation.jaccard_index()
CitationValidation.longest_common_subsequence()
CitationValidation.process_output()
CitationValidation.resources_from_belief()
CitationValidation.split_paragraph_into_sentences()
EntityValidation
LinkParser
MDToSlackParse
NumberValidation
- sherpa_ai.verbose_loggers package
Submodules#
sherpa_ai.events module#
sherpa_ai.orchestrator module#
- class sherpa_ai.orchestrator.Orchestrator(config: ~sherpa_ai.orchestrator.OrchestratorConfig, agent_pool: ~sherpa_ai.agents.agent_pool.AgentPool = <sherpa_ai.agents.agent_pool.AgentPool object>)[source]#
Bases:
object
- save(shared_memory: SharedMemory, agents: List[BaseAgent])[source]#
- class sherpa_ai.orchestrator.OrchestratorConfig(*, llm_name: str = 'gpt-3.5-turbo', llm_temperature: float = 0.7, critic_rounds: int = 3)[source]#
Bases:
BaseModel
- critic_rounds: int#
- llm_name: str#
- llm_temperature: float#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
sherpa_ai.output_parser module#
- class sherpa_ai.output_parser.BaseTaskOutputParser(*args: Any, name: str | None = None)[source]#
Bases:
BaseOutputParser
- abstract parse(text: str) TaskAction [source]#
Return TaskAction
- class sherpa_ai.output_parser.TaskAction(name, args)[source]#
Bases:
NamedTuple
- args: Dict#
Alias for field number 1
- name: str#
Alias for field number 0
- class sherpa_ai.output_parser.TaskOutputParser(*args: Any, name: str | None = None)[source]#
Bases:
BaseTaskOutputParser
- parse(text: str) TaskAction [source]#
Return TaskAction
sherpa_ai.post_processors module#
Post-processors for outputs from the LLM.
sherpa_ai.prompt module#
sherpa_ai.prompt_generator module#
sherpa_ai.reflection module#
sherpa_ai.task_agent module#
sherpa_ai.tools module#
- class sherpa_ai.tools.ContextTool(*, name: str = 'Context Search', description: str = 'Access internal technical documentation for AI related projects, includingFixie, LangChain, GPT index, GPTCache, GPT4ALL, autoGPT, db-GPT, AgentGPT, sherpa.Only use this tool if you need information for these projects specifically.', args_schema: Type[BaseModel] | Type[BaseModel] | None = None, return_direct: bool = False, verbose: bool = False, callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None, callback_manager: BaseCallbackManager | None = None, tags: List[str] | None = None, metadata: Dict[str, Any] | None = None, handle_tool_error: bool | str | Callable[[ToolException], str] | None = False, handle_validation_error: bool | str | Callable[[ValidationError], str] | None = False, response_format: Literal['content', 'content_and_artifact'] = 'content', memory: VectorStoreRetriever)[source]#
Bases:
BaseTool
- memory: VectorStoreRetriever#
- class sherpa_ai.tools.LinkScraperTool(*, name: str = 'Link Scraper', description: str = 'Access the content of a link. Only use this tool when you need to extract information from a link.', args_schema: Type[BaseModel] | Type[BaseModel] | None = None, return_direct: bool = False, verbose: bool = False, callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None, callback_manager: BaseCallbackManager | None = None, tags: List[str] | None = None, metadata: Dict[str, Any] | None = None, handle_tool_error: bool | str | Callable[[ToolException], str] | None = False, handle_validation_error: bool | str | Callable[[ValidationError], str] | None = False, response_format: Literal['content', 'content_and_artifact'] = 'content', llm: Any = None)[source]#
Bases:
BaseTool
- llm: Any#
- class sherpa_ai.tools.SearchArxivTool(*, name: str = 'Arxiv Search', description: str = 'Access all the papers from Arxiv to search for domain-specific scientific publication.Only use this tool when you need information in the scientific paper.', args_schema: Type[BaseModel] | Type[BaseModel] | None = None, return_direct: bool = False, verbose: bool = False, callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None, callback_manager: BaseCallbackManager | None = None, tags: List[str] | None = None, metadata: Dict[str, Any] | None = None, handle_tool_error: bool | str | Callable[[ToolException], str] | None = False, handle_validation_error: bool | str | Callable[[ValidationError], str] | None = False, response_format: Literal['content', 'content_and_artifact'] = 'content')[source]#
Bases:
BaseTool
- class sherpa_ai.tools.SearchTool(*, name: str = 'Search', description: str = 'Access the internet to search for the information. Only use this tool when you cannot find the information using internal search.', args_schema: Type[BaseModel] | Type[BaseModel] | None = None, return_direct: bool = False, verbose: bool = False, callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None, callback_manager: BaseCallbackManager | None = None, tags: List[str] | None = None, metadata: Dict[str, Any] | None = None, handle_tool_error: bool | str | Callable[[ToolException], str] | None = False, handle_validation_error: bool | str | Callable[[ValidationError], str] | None = False, response_format: Literal['content', 'content_and_artifact'] = 'content', top_k: int = 10, config: AgentConfig = AgentConfig(verbose=True, gsite=[], do_reflect=False, use_task_agent=False, search_domains=[], invalid_domains=[]))[source]#
Bases:
BaseTool
- top_k: int#
- class sherpa_ai.tools.UserInputTool(*, name: str = 'UserInput', description: str = 'Access the user input for the task.You use this tool if you need more context and would like to ask clarifying questions to solve the task', args_schema: Type[BaseModel] | Type[BaseModel] | None = None, return_direct: bool = False, verbose: bool = False, callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None, callback_manager: BaseCallbackManager | None = None, tags: List[str] | None = None, metadata: Dict[str, Any] | None = None, handle_tool_error: bool | str | Callable[[ToolException], str] | None = False, handle_validation_error: bool | str | Callable[[ValidationError], str] | None = False, response_format: Literal['content', 'content_and_artifact'] = 'content')[source]#
Bases:
BaseTool
sherpa_ai.utils module#
- sherpa_ai.utils.check_url(url)[source]#
Performs an HTTP GET request on url to test its validity.
Returns True if GET succeeds, False otherwise.
- sherpa_ai.utils.chunk_and_summarize_file(text_data: str, question: str, file_name: str, file_format: str, llm, title: str = None)[source]#
- sherpa_ai.utils.combined_number_extractor(text: str)[source]#
Extracts unique numeric values from the given text by combining results from two different extraction methods.
Parameters: - text (str): The input text from which numeric values are to be extracted.
Returns: - set: A set containing unique numeric values extracted from the input text.
- sherpa_ai.utils.count_string_tokens(string: str, model_name: str) int [source]#
Returns the number of tokens in a text string.
- Parameters:
string (str) – The text string.
model_name (str) – The name of the encoding to use. (e.g., “gpt-3.5-turbo”)
- Returns:
The number of tokens in the text string.
- Return type:
int
- sherpa_ai.utils.extract_entities(text)[source]#
Extract entities of specific types NORP (Nationalities or Religious or Political Groups) ORG (Organization) GPE (Geopolitical Entity) LOC (Location) using spaCy.
Args: - text (str): Input text.
Returns: List[str]: List of extracted entities.
- sherpa_ai.utils.extract_numbers_from_text(text)[source]#
Returns a list, possibly empty, of the strings of digits within text
- sherpa_ai.utils.extract_numeric_entities(text: str | None, entity_types: List[str] = ['DATE', 'CARDINAL', 'QUANTITY', 'MONEY'])[source]#
Extracts numeric entities from the given text using spaCy and converts textualrepresentations of numbers to floats using the word_to_float function.
- Parameters:
text (str) – The input text from which numeric entities will be extracted.
entity_types (List[str]) – A list of spaCy entity types to consider for extraction. Default is [“DATE”, “CARDINAL”, “QUANTITY”, “MONEY”].
- Returns:
A list of numeric values extracted from the text.
- Return type:
List[str]
- sherpa_ai.utils.json_from_text(text: str)[source]#
Extract and parse JSON data from a text.
Args: - text (str): Input text containing JSON data.
Returns: dict: Parsed JSON data.
- sherpa_ai.utils.question_with_file_reconstructor(data: str, file_name: str, title: str | None, file_format: str, question: str)[source]#
- sherpa_ai.utils.show_commands_only(logs)[source]#
Modified version of log_formatter that only shows commands
- sherpa_ai.utils.string_comparison_with_jaccard_and_levenshtein(word1, word2, levenshtein_constant)[source]#
Calculate a combined similarity metric using Jaccard similarity and normalized Levenshtein distance.
Args: - word1 (str): First input string. - word2 (str): Second input string. - levenshtein_constant (float): Weight for the Levenshtein distance in the combined metric.
Returns: float: Combined similarity metric.
- sherpa_ai.utils.text_similarity(check_entity: List[str], source_entity: List[str])[source]#
Check if entities from a reference list are present in another list.
Args: - check_entity ([str]): List of entities to check. - source_entity ([str]): List of reference entities.
Returns: dict: Result of the check containing ‘entity_exist’ and ‘messages’.
- sherpa_ai.utils.text_similarity_by_llm(llm: BaseLanguageModel, source_entity: List[str], source, result, user_id=None, team_id=None)[source]#
Check if entities from a question are mentioned in some form inside the answer using a language model.
Args: - source_entity (List[str]): List of entities from the question. - source (str): Question text. - result (str): Answer text. - user_id (str): User ID (optional). - team_id (str): Team ID (optional).
Returns: dict: Result of the check containing ‘entity_exist’ and ‘messages’.
- sherpa_ai.utils.text_similarity_by_metrics(check_entity: List[str], source_entity: List[str])[source]#
Check entity similarity based on Jaccard and Levenshtein metrics.
Args: - check_entity (List[str]): List of entities to check. - source_entity (List[str]): List of reference entities.
Returns: dict: Result of the check containing ‘entity_exist’ and ‘messages’.
- sherpa_ai.utils.verify_numbers_against_source(text_to_test: str | None, source_text: str | None)[source]#
Verifies that all numbers in text_to_test exist in source_text. Returns True on success. Returns False and a feedback string on failure.
- sherpa_ai.utils.word_to_float(text)[source]#
Converts a textual representation of a number to a float.
Parameters: - text (str): The input text containing a textual representation of a number.
Returns: dict: A dictionary with keys:
‘success’ (bool): True if the conversion was successful, False otherwise.
‘data’ (float): The converted float value if ‘success’ is True.
‘message’ (str): An error message if ‘success’ is False.