Metaphor
MetaphorToolSpec #
Bases: BaseToolSpec
Metaphor tool spec.
Source code in llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
10 11 12 13 14 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 139 140 141 |
|
search #
search(query: str, num_results: Optional[int] = 10, include_domains: Optional[List[str]] = None, exclude_domains: Optional[List[str]] = None, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None) -> str
Metaphor allows you to use a natural language query to search the internet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
A natural language query phrased as an answer for what the link provides, ie: "This is the latest news about space:" |
required |
num_results |
Optional[int]
|
Number of results to return. Defaults to 10. |
10
|
include_domains |
Optional[List(str)]
|
A list of top level domains like ["wsj.com"] to limit the search to specific sites. |
None
|
exclude_domains |
Optional[List(str)]
|
Top level domains to exclude. |
None
|
start_published_date |
Optional[str]
|
A date string like "2020-06-15". Get the date from |
None
|
end_published_date |
Optional[str]
|
End date string |
None
|
Source code in llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
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 |
|
retrieve_documents #
retrieve_documents(ids: List[str]) -> List[Document]
Retrieve a list of document summaries returned by metaphor_search
, using the ID field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids |
List(str
|
the ids of the documents to retrieve |
required |
Source code in llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
64 65 66 67 68 69 70 71 72 |
|
find_similar #
find_similar(url: str, num_results: Optional[int] = 3, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None) -> str
Retrieve a list of similar documents to a given url.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
The web page to find similar results of |
required |
num_results |
Optional[int]
|
Number of results to return. Default 3. |
3
|
start_published_date |
Optional[str]
|
A date string like "2020-06-15" |
None
|
end_published_date |
Optional[str]
|
End date string |
None
|
Source code in llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
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 |
|
search_and_retrieve_documents #
search_and_retrieve_documents(query: str, num_results: Optional[int] = 10, include_domains: Optional[List[str]] = None, exclude_domains: Optional[List[str]] = None, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None) -> str
Combines the functionality of search
and retrieve_documents
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
the natural language query |
required |
num_results |
Optional[int]
|
Number of results. Defaults to 10. |
10
|
include_domains |
Optional[List(str)]
|
A list of top level domains to search, like ["wsj.com"] |
None
|
exclude_domains |
Optional[List(str)]
|
Top level domains to exclude. |
None
|
start_published_date |
Optional[str]
|
A date string like "2020-06-15". |
None
|
end_published_date |
Optional[str]
|
End date string |
None
|
Source code in llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
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 |
|
current_date #
current_date()
A function to return todays date. Call this before any other functions that take timestamps as an argument.
Source code in llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
136 137 138 139 140 141 |
|