World knowledge
WorldKnowledgeTool ¶
Bases: LlamaIndexTool
Adds factories for the World Knowledge tool.
Source code in libs/gptstonks-multiagents/gptstonks/multiagents/tools/world_knowledge.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
from_llamaindex_llm(llamaindex_llm, tool_description='Useful to extract complex insights from the information available on the Internet.', name='world_knowledge', use_openai_agent=False, return_direct=False, verbose=False, search_tool_description=None, wikipedia_tool_description=None, auto_multistep_query_engine_index_summary='Useful to search any information on the Internet.', auto_multistep_query_engine_qa_template=None, auto_multistep_query_engine_refine_template=None, auto_multistep_query_engine_stepdecompose_query_prompt=None) classmethod ¶
Initialize World Knowledge tool.
The World Knowledge tool can solve complex queries by applying multi-step reasoning. It has several tools available, which include:
- Search: to look up information on the Internet.
- Wikipedia: to look up information about places, people, etc.
- Request: to look up specific webpages on the Internet (not implemented).
In each step, the LLM can select any tool (or its own knowledge) to solve the target query. The final response is generated by combining the responses to each subquery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
llamaindex_llm | `llama_index.core.llms.llm.LLM` | LLM that will decompose the main query and answer the subqueries. | required |
name | `str` | name of the tool. | 'world_knowledge' |
return_direct | `bool` | whether or not the tool should return when the final answer is given. | False |
verbose | `bool` | whether or not the tool should write to stdout the intermediate information. | False |
search_tool_description | `str | None` | description of the search tool. Defaults to the one provided by LangChain. | None |
wikipedia_tool_description | `str | None` | description of the Wikipedia tool. Defaults to the one provided by LangChain. | None |
auto_multistep_query_engine_index_summary | `str` | summary for the auto multistep query engine index. Seen internally by LlamaIndex agent, important to set how the sub-questions are asked." | 'Useful to search any information on the Internet.' |
auto_multistep_query_engine_qa_template | `str | None` | template for QA in the auto multistep query engine. Defaults to the one provided by LlamaIndex. | None |
auto_multistep_query_engine_refine_template | `str | None` | template for refining queries in the auto multistep query engine. Defaults to the one provided by LlamaIndex. | None |
auto_multistep_query_engine_stepdecompose_query_prompt | `str | None` | prompt for decomposing steps in the auto multistep query engine. Defaults to the one provided by LlamaIndex. | None |
Returns:
| Type | Description |
|---|---|
LlamaIndexTool |
|
Source code in libs/gptstonks-multiagents/gptstonks/multiagents/tools/world_knowledge.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |