llama-index-tools-flashdata 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- llama_index_tools_flashdata-0.1.0/.gitignore +7 -0
- llama_index_tools_flashdata-0.1.0/LICENSE +21 -0
- llama_index_tools_flashdata-0.1.0/PKG-INFO +170 -0
- llama_index_tools_flashdata-0.1.0/PUBLISHING.md +36 -0
- llama_index_tools_flashdata-0.1.0/README.md +151 -0
- llama_index_tools_flashdata-0.1.0/capabilities.json +171 -0
- llama_index_tools_flashdata-0.1.0/contract-provenance.json +26 -0
- llama_index_tools_flashdata-0.1.0/examples/google_images.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/google_news.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/google_places.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/google_search.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/google_shopping.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/google_videos.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_captions.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_channel.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_download.py +29 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_metadata.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_search.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_search_extended.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_suggestions.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_trainability.py +15 -0
- llama_index_tools_flashdata-0.1.0/examples/youtube_transcript.py +15 -0
- llama_index_tools_flashdata-0.1.0/guides/google_images.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/google_news.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/google_places.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/google_search.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/google_shopping.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/google_videos.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_captions.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_channel.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_download.md +34 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_metadata.md +37 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_search.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_search_extended.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_suggestions.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_trainability.md +35 -0
- llama_index_tools_flashdata-0.1.0/guides/youtube_transcript.md +35 -0
- llama_index_tools_flashdata-0.1.0/pyproject.toml +37 -0
- llama_index_tools_flashdata-0.1.0/scripts/verify_install.py +32 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/__init__.py +7 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/_catalog.py +59 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/_client.py +152 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/_execution.py +83 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/_inputs.py +205 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/_storage.py +108 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/reader.py +110 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/storage.schema.json +87 -0
- llama_index_tools_flashdata-0.1.0/src/llama_index/tools/flashdata/tools.py +65 -0
- llama_index_tools_flashdata-0.1.0/tests/response-fixtures.json +358 -0
- llama_index_tools_flashdata-0.1.0/tests/test_integration.py +340 -0
- llama_index_tools_flashdata-0.1.0/uv.lock +3096 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FlashData contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: llama-index-tools-flashdata
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Google and YouTube search tools and citation-aware readers for LlamaIndex
|
|
5
|
+
Project-URL: Homepage, https://flashdata.dev
|
|
6
|
+
Project-URL: Documentation, https://github.com/rocosen/flashdata-mcp/tree/main/packages/llamaindex
|
|
7
|
+
Project-URL: Source, https://github.com/rocosen/flashdata-mcp
|
|
8
|
+
Project-URL: Issues, https://github.com/rocosen/flashdata-mcp/issues
|
|
9
|
+
Author: FlashData
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agent,google-search,llamaindex,rag,youtube-transcript
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Requires-Dist: httpx<1,>=0.28.1
|
|
15
|
+
Requires-Dist: jsonschema<5,>=4.23
|
|
16
|
+
Requires-Dist: llama-index-core<0.15,>=0.14.25
|
|
17
|
+
Requires-Dist: pydantic<3,>=2.7.4
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# FlashData tools and readers for LlamaIndex
|
|
21
|
+
|
|
22
|
+
Give a research agent current Google and YouTube results, or load existing video
|
|
23
|
+
captions into a RAG pipeline with timestamps and source links. Choose the needed
|
|
24
|
+
sources when building your application. The package supplies 17 native
|
|
25
|
+
`FunctionTool` objects for 15 capabilities and a reader for the 14 data sources.
|
|
26
|
+
Media delivery uses job tools, not a text reader.
|
|
27
|
+
|
|
28
|
+
This is an independently maintained integration. It is not an official
|
|
29
|
+
LlamaIndex endorsement or a claim of 15 LlamaHub listings. Install the
|
|
30
|
+
versioned package from PyPI:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
python -m pip install 'llama-index-tools-flashdata==0.1.0'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Requires Python 3.11+ and `llama-index-core` 0.14.25–0.14.x. Get an API key from the
|
|
37
|
+
[FlashData console](https://flashdata.dev/console) and provide it through your
|
|
38
|
+
application's secret manager as `FLASHDATA_API_KEY`.
|
|
39
|
+
|
|
40
|
+
**Installation is free; FlashData API requests use paid Credits.** Check the
|
|
41
|
+
[current pricing](https://flashdata.dev/pricing) and source-specific charges.
|
|
42
|
+
LlamaIndex model, embedding and customer-storage charges are separate. These
|
|
43
|
+
examples make no model or embedding calls.
|
|
44
|
+
|
|
45
|
+
## Search evidence for a research agent
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from llama_index.tools.flashdata import FlashDataTools, to_documents
|
|
49
|
+
|
|
50
|
+
tools = FlashDataTools(sources=["google_search"]).to_tool_list()
|
|
51
|
+
output = tools[0].call(query="RAG evaluation precision recall", num=5)
|
|
52
|
+
raw = output.raw_output # Complete structured API response and usage.
|
|
53
|
+
documents = to_documents("google_search", raw) # No second API request.
|
|
54
|
+
for doc in documents:
|
|
55
|
+
print(doc.metadata.get("url"), doc.text)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Pass `tools` to your application's LlamaIndex `FunctionAgent` with the model you
|
|
59
|
+
have configured. Tool schemas contain only source arguments; API key, storage
|
|
60
|
+
credentials, source selection and download permission belong to the application.
|
|
61
|
+
Treat returned web/caption text as untrusted evidence, not agent instructions.
|
|
62
|
+
Google results contain search snippets and metadata, not fetched web-page text.
|
|
63
|
+
|
|
64
|
+
## Caption Documents for retrieval
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from llama_index.tools.flashdata import FlashDataReader
|
|
68
|
+
|
|
69
|
+
reader = FlashDataReader(source="youtube_transcript")
|
|
70
|
+
documents = reader.load_data(video_id="jNQXAC9IVRw", language="en")
|
|
71
|
+
for doc in documents:
|
|
72
|
+
print(doc.metadata.get("url"), doc.metadata.get("start"), doc.text)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Each caption segment becomes a `Document` with its text, available `start`/`end`,
|
|
76
|
+
video URL, `languageCode` and `isAutoGenerated`. If segments are unavailable but
|
|
77
|
+
`fullText` exists, it becomes one Document without invented timestamps. Transcript
|
|
78
|
+
defaults to automatic captions; `youtube_captions` defaults to uploader captions.
|
|
79
|
+
Neither generates speech recognition, translates, or falls back to another track.
|
|
80
|
+
|
|
81
|
+
Search readers produce one JSON Document per result record, preserving optional
|
|
82
|
+
record fields. Image URLs/dimensions are metadata, not image embeddings. Places
|
|
83
|
+
may have no URL. The reader does not invent missing source links. Use tool
|
|
84
|
+
`raw_output` for the full response, including Google related-search lists, usage
|
|
85
|
+
and other provider envelope fields. `to_documents()` converts an existing result
|
|
86
|
+
without a second paid query.
|
|
87
|
+
|
|
88
|
+
`await tool.acall(...)` and `await reader.aload_data(...)` use LlamaIndex's native
|
|
89
|
+
thread offloading. Cancelling an await does not cancel an accepted paid job;
|
|
90
|
+
check FlashData Jobs before resubmitting.
|
|
91
|
+
|
|
92
|
+
## All capabilities
|
|
93
|
+
|
|
94
|
+
See the task guides below for inputs, outputs, a runnable example and limitations.
|
|
95
|
+
|
|
96
|
+
| Task | Source | Guide |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| Collect web evidence for a research agent | `google_search` | [Google Search](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_search.md) |
|
|
99
|
+
| Build a news evidence feed for an agent | `google_news` | [Google News](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_news.md) |
|
|
100
|
+
| Prepare an image reference shortlist | `google_images` | [Google Images](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_images.md) |
|
|
101
|
+
| Ground a product comparison with search snapshots | `google_shopping` | [Google Shopping](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_shopping.md) |
|
|
102
|
+
| Find video references across websites | `google_videos` | [Google Videos](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_videos.md) |
|
|
103
|
+
| Collect local options for a planning assistant | `google_places` | [Google Places](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_places.md) |
|
|
104
|
+
| Discover videos before building a caption collection | `youtube_search` | [YouTube Search](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_search.md) |
|
|
105
|
+
| Create a larger video research candidate set | `youtube_search_extended` | [YouTube Extended Search](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_search_extended.md) |
|
|
106
|
+
| Inspect chapters before choosing retrieval material | `youtube_metadata` | [YouTube Metadata](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_metadata.md) |
|
|
107
|
+
| Load timestamped automatic captions for RAG | `youtube_transcript` | [YouTube Transcript](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_transcript.md) |
|
|
108
|
+
| Build a collection from uploader captions | `youtube_captions` | [YouTube Captions](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_captions.md) |
|
|
109
|
+
| Record license-label metadata during dataset review | `youtube_trainability` | [YouTube License Metadata](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_trainability.md) |
|
|
110
|
+
| Snapshot a channel for research triage | `youtube_channel` | [YouTube Channel](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_channel.md) |
|
|
111
|
+
| Explore query phrasing before a video search | `youtube_suggestions` | [YouTube Autocomplete](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_suggestions.md) |
|
|
112
|
+
| Deliver approved media for a downstream workflow | `youtube_download` | [YouTube Download to Cloud Storage](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_download.md) |
|
|
113
|
+
|
|
114
|
+
## Media delivery lifecycle
|
|
115
|
+
|
|
116
|
+
Configure `FLASHDATA_DOWNLOAD_STORAGE` as a secret JSON destination. Supported
|
|
117
|
+
providers are S3, S3-compatible, GCS, Azure, OSS, COS, BOS and TOS. Use fields from
|
|
118
|
+
the [download contract](https://flashdata.dev/docs/sources/youtube_download);
|
|
119
|
+
the packaged `storage.schema.json` describes the credential structure. Bucket
|
|
120
|
+
names belong in `storage_url`; optional folders belong in `object_prefix`.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from llama_index.tools.flashdata import FlashDataTools
|
|
124
|
+
|
|
125
|
+
# Only enable after authorizing this paid write to your own destination.
|
|
126
|
+
submit, status, result = FlashDataTools(
|
|
127
|
+
sources=["youtube_download"], allow_download=True
|
|
128
|
+
).to_tool_list()
|
|
129
|
+
receipt = submit.call(video_id="jNQXAC9IVRw", download_type="audio", output_format="m4a").raw_output
|
|
130
|
+
job_id = receipt["id"] # Persist before any follow-up; never resubmit to poll.
|
|
131
|
+
state = status.call(job_id=job_id).raw_output
|
|
132
|
+
# Later, read result with the same ID. Pending jobs return status, not an error.
|
|
133
|
+
delivery = result.call(job_id=job_id).raw_output
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Download submission is disabled by default. You can use status/result tools
|
|
137
|
+
without enabling it or supplying destination credentials. Completed result JSON
|
|
138
|
+
expires after 24 hours; media retention depends on your storage. Supply only
|
|
139
|
+
content you are entitled to download and use. Storage authorization is not a
|
|
140
|
+
training license.
|
|
141
|
+
|
|
142
|
+
## Failure handling
|
|
143
|
+
|
|
144
|
+
Calls are single-attempt, bounded to 120 seconds (15-second connection timeout)
|
|
145
|
+
and 20 MiB. Failed/ambiguous POSTs are never automatically retried. A timeout can
|
|
146
|
+
mean the paid job was accepted: check the FlashData Jobs console before another
|
|
147
|
+
submission. Missing credits, unauthorized sources and unavailable captions are
|
|
148
|
+
errors, not successful empty results or reasons to silently change source.
|
|
149
|
+
|
|
150
|
+
Job reads verify the ID and `youtube_download` source. Download status/receipt
|
|
151
|
+
outputs exclude storage parameters. Result JSON is fetched only from the trusted
|
|
152
|
+
HTTPS origin returned by FlashData authentication; the API key is not sent there.
|
|
153
|
+
Redirects are not followed automatically. Raw HTTP errors and credentials are
|
|
154
|
+
not included in `FlashDataError` messages.
|
|
155
|
+
|
|
156
|
+
## Local verification
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
uv sync --frozen
|
|
160
|
+
uv run --frozen pytest -q
|
|
161
|
+
uv run --frozen python -m build
|
|
162
|
+
uv run --frozen twine check dist/*
|
|
163
|
+
uv run --frozen python scripts/verify_install.py
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Tests disable network sockets and exercise real LlamaIndex tools/readers against
|
|
167
|
+
HTTP fixtures. They do not establish live API, model, storage-write or public
|
|
168
|
+
directory acceptance. Shared parameter and HTTP contracts come from the reviewed
|
|
169
|
+
FlashData Haystack adapter; `contract-provenance.json` records exact origins and
|
|
170
|
+
differences. No Haystack runtime dependency is needed.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Publishing the independent package
|
|
2
|
+
|
|
3
|
+
The build, tests and source installation are separate from PyPI publication
|
|
4
|
+
and official LlamaIndex directory admission. Confirm the actual project/version
|
|
5
|
+
status on PyPI before registering a publisher or dispatching a release.
|
|
6
|
+
|
|
7
|
+
Use the existing `flashdata-dev` PyPI account. The initial release requires
|
|
8
|
+
owner approval of this project-specific Trusted Publisher; check for an existing
|
|
9
|
+
binding before adding it:
|
|
10
|
+
|
|
11
|
+
| Field | Value |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| PyPI project | `llama-index-tools-flashdata` |
|
|
14
|
+
| GitHub owner | `rocosen` |
|
|
15
|
+
| Repository | `flashdata-mcp` |
|
|
16
|
+
| Workflow filename | `llamaindex-publish.yml` |
|
|
17
|
+
| GitHub environment | `pypi-llamaindex` |
|
|
18
|
+
|
|
19
|
+
Confirm the project is still available before registering. Configure the GitHub
|
|
20
|
+
environment under this repository with deployment restricted to tags matching
|
|
21
|
+
`llamaindex-v*`. The checked-in workflow does not configure either platform.
|
|
22
|
+
|
|
23
|
+
The workflow runs only by explicit manual dispatch on a `llamaindex-vVERSION`
|
|
24
|
+
tag matching `pyproject.toml`. A normal push, pull request or tag creation does
|
|
25
|
+
not publish the package. It rebuilds, tests and checks the distributions before
|
|
26
|
+
the OIDC publish job. No long-lived PyPI token is required.
|
|
27
|
+
|
|
28
|
+
Prepare the release README and absolute task-guide links before building,
|
|
29
|
+
because the uploaded distribution contains the PyPI project description. After
|
|
30
|
+
publication, read back the exact version and artifact hashes and install it in a
|
|
31
|
+
fresh environment before marking the release complete. PyPI publication is one
|
|
32
|
+
shared package, not 15 official LlamaIndex/LlamaHub entries.
|
|
33
|
+
|
|
34
|
+
LlamaIndex no longer accepts new integration packages in its monorepo. Do not
|
|
35
|
+
submit this `pyproject.toml` there. Documentation contributions remain possible,
|
|
36
|
+
but independent listing admission must be established separately.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# FlashData tools and readers for LlamaIndex
|
|
2
|
+
|
|
3
|
+
Give a research agent current Google and YouTube results, or load existing video
|
|
4
|
+
captions into a RAG pipeline with timestamps and source links. Choose the needed
|
|
5
|
+
sources when building your application. The package supplies 17 native
|
|
6
|
+
`FunctionTool` objects for 15 capabilities and a reader for the 14 data sources.
|
|
7
|
+
Media delivery uses job tools, not a text reader.
|
|
8
|
+
|
|
9
|
+
This is an independently maintained integration. It is not an official
|
|
10
|
+
LlamaIndex endorsement or a claim of 15 LlamaHub listings. Install the
|
|
11
|
+
versioned package from PyPI:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
python -m pip install 'llama-index-tools-flashdata==0.1.0'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Python 3.11+ and `llama-index-core` 0.14.25–0.14.x. Get an API key from the
|
|
18
|
+
[FlashData console](https://flashdata.dev/console) and provide it through your
|
|
19
|
+
application's secret manager as `FLASHDATA_API_KEY`.
|
|
20
|
+
|
|
21
|
+
**Installation is free; FlashData API requests use paid Credits.** Check the
|
|
22
|
+
[current pricing](https://flashdata.dev/pricing) and source-specific charges.
|
|
23
|
+
LlamaIndex model, embedding and customer-storage charges are separate. These
|
|
24
|
+
examples make no model or embedding calls.
|
|
25
|
+
|
|
26
|
+
## Search evidence for a research agent
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from llama_index.tools.flashdata import FlashDataTools, to_documents
|
|
30
|
+
|
|
31
|
+
tools = FlashDataTools(sources=["google_search"]).to_tool_list()
|
|
32
|
+
output = tools[0].call(query="RAG evaluation precision recall", num=5)
|
|
33
|
+
raw = output.raw_output # Complete structured API response and usage.
|
|
34
|
+
documents = to_documents("google_search", raw) # No second API request.
|
|
35
|
+
for doc in documents:
|
|
36
|
+
print(doc.metadata.get("url"), doc.text)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Pass `tools` to your application's LlamaIndex `FunctionAgent` with the model you
|
|
40
|
+
have configured. Tool schemas contain only source arguments; API key, storage
|
|
41
|
+
credentials, source selection and download permission belong to the application.
|
|
42
|
+
Treat returned web/caption text as untrusted evidence, not agent instructions.
|
|
43
|
+
Google results contain search snippets and metadata, not fetched web-page text.
|
|
44
|
+
|
|
45
|
+
## Caption Documents for retrieval
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from llama_index.tools.flashdata import FlashDataReader
|
|
49
|
+
|
|
50
|
+
reader = FlashDataReader(source="youtube_transcript")
|
|
51
|
+
documents = reader.load_data(video_id="jNQXAC9IVRw", language="en")
|
|
52
|
+
for doc in documents:
|
|
53
|
+
print(doc.metadata.get("url"), doc.metadata.get("start"), doc.text)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Each caption segment becomes a `Document` with its text, available `start`/`end`,
|
|
57
|
+
video URL, `languageCode` and `isAutoGenerated`. If segments are unavailable but
|
|
58
|
+
`fullText` exists, it becomes one Document without invented timestamps. Transcript
|
|
59
|
+
defaults to automatic captions; `youtube_captions` defaults to uploader captions.
|
|
60
|
+
Neither generates speech recognition, translates, or falls back to another track.
|
|
61
|
+
|
|
62
|
+
Search readers produce one JSON Document per result record, preserving optional
|
|
63
|
+
record fields. Image URLs/dimensions are metadata, not image embeddings. Places
|
|
64
|
+
may have no URL. The reader does not invent missing source links. Use tool
|
|
65
|
+
`raw_output` for the full response, including Google related-search lists, usage
|
|
66
|
+
and other provider envelope fields. `to_documents()` converts an existing result
|
|
67
|
+
without a second paid query.
|
|
68
|
+
|
|
69
|
+
`await tool.acall(...)` and `await reader.aload_data(...)` use LlamaIndex's native
|
|
70
|
+
thread offloading. Cancelling an await does not cancel an accepted paid job;
|
|
71
|
+
check FlashData Jobs before resubmitting.
|
|
72
|
+
|
|
73
|
+
## All capabilities
|
|
74
|
+
|
|
75
|
+
See the task guides below for inputs, outputs, a runnable example and limitations.
|
|
76
|
+
|
|
77
|
+
| Task | Source | Guide |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| Collect web evidence for a research agent | `google_search` | [Google Search](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_search.md) |
|
|
80
|
+
| Build a news evidence feed for an agent | `google_news` | [Google News](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_news.md) |
|
|
81
|
+
| Prepare an image reference shortlist | `google_images` | [Google Images](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_images.md) |
|
|
82
|
+
| Ground a product comparison with search snapshots | `google_shopping` | [Google Shopping](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_shopping.md) |
|
|
83
|
+
| Find video references across websites | `google_videos` | [Google Videos](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_videos.md) |
|
|
84
|
+
| Collect local options for a planning assistant | `google_places` | [Google Places](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/google_places.md) |
|
|
85
|
+
| Discover videos before building a caption collection | `youtube_search` | [YouTube Search](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_search.md) |
|
|
86
|
+
| Create a larger video research candidate set | `youtube_search_extended` | [YouTube Extended Search](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_search_extended.md) |
|
|
87
|
+
| Inspect chapters before choosing retrieval material | `youtube_metadata` | [YouTube Metadata](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_metadata.md) |
|
|
88
|
+
| Load timestamped automatic captions for RAG | `youtube_transcript` | [YouTube Transcript](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_transcript.md) |
|
|
89
|
+
| Build a collection from uploader captions | `youtube_captions` | [YouTube Captions](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_captions.md) |
|
|
90
|
+
| Record license-label metadata during dataset review | `youtube_trainability` | [YouTube License Metadata](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_trainability.md) |
|
|
91
|
+
| Snapshot a channel for research triage | `youtube_channel` | [YouTube Channel](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_channel.md) |
|
|
92
|
+
| Explore query phrasing before a video search | `youtube_suggestions` | [YouTube Autocomplete](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_suggestions.md) |
|
|
93
|
+
| Deliver approved media for a downstream workflow | `youtube_download` | [YouTube Download to Cloud Storage](https://github.com/rocosen/flashdata-mcp/blob/llamaindex-v0.1.0/packages/llamaindex/guides/youtube_download.md) |
|
|
94
|
+
|
|
95
|
+
## Media delivery lifecycle
|
|
96
|
+
|
|
97
|
+
Configure `FLASHDATA_DOWNLOAD_STORAGE` as a secret JSON destination. Supported
|
|
98
|
+
providers are S3, S3-compatible, GCS, Azure, OSS, COS, BOS and TOS. Use fields from
|
|
99
|
+
the [download contract](https://flashdata.dev/docs/sources/youtube_download);
|
|
100
|
+
the packaged `storage.schema.json` describes the credential structure. Bucket
|
|
101
|
+
names belong in `storage_url`; optional folders belong in `object_prefix`.
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from llama_index.tools.flashdata import FlashDataTools
|
|
105
|
+
|
|
106
|
+
# Only enable after authorizing this paid write to your own destination.
|
|
107
|
+
submit, status, result = FlashDataTools(
|
|
108
|
+
sources=["youtube_download"], allow_download=True
|
|
109
|
+
).to_tool_list()
|
|
110
|
+
receipt = submit.call(video_id="jNQXAC9IVRw", download_type="audio", output_format="m4a").raw_output
|
|
111
|
+
job_id = receipt["id"] # Persist before any follow-up; never resubmit to poll.
|
|
112
|
+
state = status.call(job_id=job_id).raw_output
|
|
113
|
+
# Later, read result with the same ID. Pending jobs return status, not an error.
|
|
114
|
+
delivery = result.call(job_id=job_id).raw_output
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Download submission is disabled by default. You can use status/result tools
|
|
118
|
+
without enabling it or supplying destination credentials. Completed result JSON
|
|
119
|
+
expires after 24 hours; media retention depends on your storage. Supply only
|
|
120
|
+
content you are entitled to download and use. Storage authorization is not a
|
|
121
|
+
training license.
|
|
122
|
+
|
|
123
|
+
## Failure handling
|
|
124
|
+
|
|
125
|
+
Calls are single-attempt, bounded to 120 seconds (15-second connection timeout)
|
|
126
|
+
and 20 MiB. Failed/ambiguous POSTs are never automatically retried. A timeout can
|
|
127
|
+
mean the paid job was accepted: check the FlashData Jobs console before another
|
|
128
|
+
submission. Missing credits, unauthorized sources and unavailable captions are
|
|
129
|
+
errors, not successful empty results or reasons to silently change source.
|
|
130
|
+
|
|
131
|
+
Job reads verify the ID and `youtube_download` source. Download status/receipt
|
|
132
|
+
outputs exclude storage parameters. Result JSON is fetched only from the trusted
|
|
133
|
+
HTTPS origin returned by FlashData authentication; the API key is not sent there.
|
|
134
|
+
Redirects are not followed automatically. Raw HTTP errors and credentials are
|
|
135
|
+
not included in `FlashDataError` messages.
|
|
136
|
+
|
|
137
|
+
## Local verification
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
uv sync --frozen
|
|
141
|
+
uv run --frozen pytest -q
|
|
142
|
+
uv run --frozen python -m build
|
|
143
|
+
uv run --frozen twine check dist/*
|
|
144
|
+
uv run --frozen python scripts/verify_install.py
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Tests disable network sockets and exercise real LlamaIndex tools/readers against
|
|
148
|
+
HTTP fixtures. They do not establish live API, model, storage-write or public
|
|
149
|
+
directory acceptance. Shared parameter and HTTP contracts come from the reviewed
|
|
150
|
+
FlashData Haystack adapter; `contract-provenance.json` records exact origins and
|
|
151
|
+
differences. No Haystack runtime dependency is needed.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"source": "google_search",
|
|
4
|
+
"name": "Google Search",
|
|
5
|
+
"sample": {
|
|
6
|
+
"query": "retrieval augmented generation evaluation",
|
|
7
|
+
"num": 5
|
|
8
|
+
},
|
|
9
|
+
"inputs": "query; optional gl, hl, location, num/page 1–100, tbs, autocorrect",
|
|
10
|
+
"outputs": "results[].organic: title, link, snippet, position; usage.credits",
|
|
11
|
+
"limits": "Search snippets are not fetched page content. Omitted count and locale are not filled in by the SDK."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"source": "google_news",
|
|
15
|
+
"name": "Google News",
|
|
16
|
+
"sample": {
|
|
17
|
+
"query": "reusable rockets",
|
|
18
|
+
"num": 5
|
|
19
|
+
},
|
|
20
|
+
"inputs": "query; optional Google search parameters",
|
|
21
|
+
"outputs": "results[].news: titles, links and available dates/snippets; usage.credits",
|
|
22
|
+
"limits": "Returns news search results, not article full text."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"source": "google_images",
|
|
26
|
+
"name": "Google Images",
|
|
27
|
+
"sample": {
|
|
28
|
+
"query": "rooftop solar installation",
|
|
29
|
+
"num": 5
|
|
30
|
+
},
|
|
31
|
+
"inputs": "query; optional Google search parameters",
|
|
32
|
+
"outputs": "results[].images: image/source URLs and available dimensions; usage.credits",
|
|
33
|
+
"limits": "Does not download images or establish image reuse rights."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"source": "google_shopping",
|
|
37
|
+
"name": "Google Shopping",
|
|
38
|
+
"sample": {
|
|
39
|
+
"query": "USB microphone",
|
|
40
|
+
"num": 5
|
|
41
|
+
},
|
|
42
|
+
"inputs": "query; optional Google search parameters",
|
|
43
|
+
"outputs": "results[].shopping: title, link, price and available merchant/rating fields; usage.credits",
|
|
44
|
+
"limits": "Prices are search snapshots; inventory and checkout price are not guaranteed."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"source": "google_videos",
|
|
48
|
+
"name": "Google Videos",
|
|
49
|
+
"sample": {
|
|
50
|
+
"query": "database indexing tutorial",
|
|
51
|
+
"num": 5
|
|
52
|
+
},
|
|
53
|
+
"inputs": "query; optional Google search parameters",
|
|
54
|
+
"outputs": "results[].videos: video titles, links and available metadata; usage.credits",
|
|
55
|
+
"limits": "Search discovers videos; it does not return video files or transcripts."
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"source": "google_places",
|
|
59
|
+
"name": "Google Places",
|
|
60
|
+
"sample": {
|
|
61
|
+
"query": "coworking Singapore",
|
|
62
|
+
"num": 5
|
|
63
|
+
},
|
|
64
|
+
"inputs": "query; optional location and other Google search parameters",
|
|
65
|
+
"outputs": "results[].places: names and available addresses, ratings and contact fields; usage.credits",
|
|
66
|
+
"limits": "Contact details may be missing; verify current hours and availability with the business."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"source": "youtube_search",
|
|
70
|
+
"name": "YouTube Search",
|
|
71
|
+
"sample": {
|
|
72
|
+
"query": "RAG evaluation tutorials",
|
|
73
|
+
"max_results": 5
|
|
74
|
+
},
|
|
75
|
+
"inputs": "query; max_results 1–20 (default 10); optional filters",
|
|
76
|
+
"outputs": "results[].results: video search records; totalResults and query; usage.credits",
|
|
77
|
+
"limits": "The requested count is a ceiling, not a guaranteed result count."
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"source": "youtube_search_extended",
|
|
81
|
+
"name": "YouTube Extended Search",
|
|
82
|
+
"sample": {
|
|
83
|
+
"query": "retrieval evaluation tutorials",
|
|
84
|
+
"max_results": 50
|
|
85
|
+
},
|
|
86
|
+
"inputs": "query; max_results 1–700 (default 20); optional filters",
|
|
87
|
+
"outputs": "results[].results: video search records; totalResults and query; usage.credits",
|
|
88
|
+
"limits": "This is a distinct source with a separate higher rate than standard search. Requested count is not guaranteed."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"source": "youtube_metadata",
|
|
92
|
+
"name": "YouTube Metadata",
|
|
93
|
+
"sample": {
|
|
94
|
+
"video_id": "dQw4w9WgXcQ",
|
|
95
|
+
"include_formats": false,
|
|
96
|
+
"include_chapters": true
|
|
97
|
+
},
|
|
98
|
+
"inputs": "video_id (11 characters); include_formats/include_chapters (default true)",
|
|
99
|
+
"outputs": "results[]: videoId, title, channel, duration and other available metadata; usage.credits",
|
|
100
|
+
"limits": "Metadata is not media download. Chapters and optional fields may be absent."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"source": "youtube_transcript",
|
|
104
|
+
"name": "YouTube Transcript",
|
|
105
|
+
"sample": {
|
|
106
|
+
"video_id": "dQw4w9WgXcQ",
|
|
107
|
+
"language": "en",
|
|
108
|
+
"auto": true
|
|
109
|
+
},
|
|
110
|
+
"inputs": "video_id; language (default en); auto (default true)",
|
|
111
|
+
"outputs": "results[]: videoId, languageCode, isAutoGenerated, segments, fullText; usage.credits",
|
|
112
|
+
"limits": "Reads an existing track. No ASR, translation, or automatic fallback to uploader captions."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"source": "youtube_captions",
|
|
116
|
+
"name": "YouTube Captions",
|
|
117
|
+
"sample": {
|
|
118
|
+
"video_id": "dQw4w9WgXcQ",
|
|
119
|
+
"language": "en",
|
|
120
|
+
"auto": false
|
|
121
|
+
},
|
|
122
|
+
"inputs": "video_id; language (default en); auto (default false)",
|
|
123
|
+
"outputs": "results[]: videoId, languageCode, isAutoGenerated, segments, fullText; usage.credits",
|
|
124
|
+
"limits": "Defaults to uploader captions. No ASR, translation, or automatic fallback to generated captions."
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"source": "youtube_trainability",
|
|
128
|
+
"name": "YouTube License Metadata",
|
|
129
|
+
"sample": {
|
|
130
|
+
"video_id": "dQw4w9WgXcQ"
|
|
131
|
+
},
|
|
132
|
+
"inputs": "video_id (11 characters)",
|
|
133
|
+
"outputs": "results[]: videoId and license-label indicator permitted, with available kind/etag; usage.credits",
|
|
134
|
+
"limits": "permitted is a license-label signal, not legal training permission or creator third-party training settings."
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"source": "youtube_channel",
|
|
138
|
+
"name": "YouTube Channel",
|
|
139
|
+
"sample": {
|
|
140
|
+
"handle": "@GoogleDevelopers",
|
|
141
|
+
"video_limit": 5
|
|
142
|
+
},
|
|
143
|
+
"inputs": "handle; video_limit 1–100 (default 20)",
|
|
144
|
+
"outputs": "results[]: channelId, channelHandle, name, channelUrl, statistics, videos; usage.credits",
|
|
145
|
+
"limits": "A recent-video snapshot is not the complete channel archive."
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"source": "youtube_suggestions",
|
|
149
|
+
"name": "YouTube Autocomplete",
|
|
150
|
+
"sample": {
|
|
151
|
+
"query": "vector database",
|
|
152
|
+
"language": "en",
|
|
153
|
+
"region": "US"
|
|
154
|
+
},
|
|
155
|
+
"inputs": "query; language (default en); region (default US, two letters)",
|
|
156
|
+
"outputs": "results: autocomplete suggestion strings; usage.credits",
|
|
157
|
+
"limits": "Suggestions are not keyword volume or popularity measurements."
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"source": "youtube_download",
|
|
161
|
+
"name": "YouTube Download to Cloud Storage",
|
|
162
|
+
"sample": {
|
|
163
|
+
"video_id": "dQw4w9WgXcQ",
|
|
164
|
+
"download_type": "audio",
|
|
165
|
+
"output_format": "m4a"
|
|
166
|
+
},
|
|
167
|
+
"inputs": "submit: video_id, optional format/quality/clip fields; reads: job_id. Storage comes from FLASHDATA_DOWNLOAD_STORAGE.",
|
|
168
|
+
"outputs": "submit: id/status receipt; reads: job lifecycle; completed result: output JSON delivery manifest",
|
|
169
|
+
"limits": "Paid asynchronous job. Requires customer storage. Save the receipt; never submit again to poll. Result JSON expires after 24 hours; media retention depends on storage."
|
|
170
|
+
}
|
|
171
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"base_commit": "3e22639dd247412380ae5e097d5261202a63df1e",
|
|
3
|
+
"note": "Reuse Haystack contract. Only HTTP user-agent/docstring and removal of unused legacy Google defaults differ.",
|
|
4
|
+
"files": {
|
|
5
|
+
"_client.py": {
|
|
6
|
+
"source": "packages/haystack/src/flashdata_haystack/_client.py",
|
|
7
|
+
"source_sha256": "d5abddeb4ecd0944da6226085821fafacd71349d16eea65d5ddb47bb469088e3",
|
|
8
|
+
"sha256": "54e4fb65e8319e65016f3c7d2e3aa4e1f137fdad0c76bdda6e0e700010157ef1"
|
|
9
|
+
},
|
|
10
|
+
"_inputs.py": {
|
|
11
|
+
"source": "packages/haystack/src/flashdata_haystack/_inputs.py",
|
|
12
|
+
"source_sha256": "b55ea6429ffdaa765adfedb8d985dd2771847d987d97e967bc532b74710518d6",
|
|
13
|
+
"sha256": "df9057e47cdb9a017326cd379053a386aa4bbb8862d6a723be91322444451ff1"
|
|
14
|
+
},
|
|
15
|
+
"_storage.py": {
|
|
16
|
+
"source": "packages/haystack/src/flashdata_haystack/_storage.py",
|
|
17
|
+
"source_sha256": "88e24e19c3844ca3c4e07645e11b011b70e244e106d4416e7b12b5bff2c29724",
|
|
18
|
+
"sha256": "88e24e19c3844ca3c4e07645e11b011b70e244e106d4416e7b12b5bff2c29724"
|
|
19
|
+
},
|
|
20
|
+
"storage.schema.json": {
|
|
21
|
+
"source": "packages/haystack/src/flashdata_haystack/storage.schema.json",
|
|
22
|
+
"source_sha256": "a690171fc7d129ec18aa2239effafaadf78b490e292aa2196de581d63cdb88f6",
|
|
23
|
+
"sha256": "a690171fc7d129ec18aa2239effafaadf78b490e292aa2196de581d63cdb88f6"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Prepare an image reference shortlist. Running this example makes one paid FlashData request."""
|
|
2
|
+
|
|
3
|
+
from llama_index.tools.flashdata import FlashDataTools, to_documents
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
tool = FlashDataTools(sources=["google_images"]).to_tool_list()[0]
|
|
8
|
+
output = tool.call(query="rooftop solar installation", num=5)
|
|
9
|
+
print(output.raw_output)
|
|
10
|
+
for document in to_documents("google_images", output.raw_output):
|
|
11
|
+
print(document.metadata, document.text)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Build a news evidence feed for an agent. Running this example makes one paid FlashData request."""
|
|
2
|
+
|
|
3
|
+
from llama_index.tools.flashdata import FlashDataTools, to_documents
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
tool = FlashDataTools(sources=["google_news"]).to_tool_list()[0]
|
|
8
|
+
output = tool.call(query="reusable rockets", num=5)
|
|
9
|
+
print(output.raw_output)
|
|
10
|
+
for document in to_documents("google_news", output.raw_output):
|
|
11
|
+
print(document.metadata, document.text)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Collect local options for a planning assistant. Running this example makes one paid FlashData request."""
|
|
2
|
+
|
|
3
|
+
from llama_index.tools.flashdata import FlashDataTools, to_documents
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
tool = FlashDataTools(sources=["google_places"]).to_tool_list()[0]
|
|
8
|
+
output = tool.call(query="coworking Singapore", num=5)
|
|
9
|
+
print(output.raw_output)
|
|
10
|
+
for document in to_documents("google_places", output.raw_output):
|
|
11
|
+
print(document.metadata, document.text)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Collect web evidence for a research agent. Running this example makes one paid FlashData request."""
|
|
2
|
+
|
|
3
|
+
from llama_index.tools.flashdata import FlashDataTools, to_documents
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
tool = FlashDataTools(sources=["google_search"]).to_tool_list()[0]
|
|
8
|
+
output = tool.call(query="retrieval augmented generation evaluation", num=5)
|
|
9
|
+
print(output.raw_output)
|
|
10
|
+
for document in to_documents("google_search", output.raw_output):
|
|
11
|
+
print(document.metadata, document.text)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
main()
|