tavily_dart

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

tavily dart

Tavily Dart Client #




Dart Client for the Tavily API (a search engine optimized for LLMs and RAG).
Features #

Fully type-safe, documented and tested
All platforms supported
Custom base URL, headers and query params support (e.g. HTTP proxies)
Custom HTTP client support (e.g. SOCKS5 proxies or advanced use cases)

Supported endpoints:

Search

Table of contents #

Usage

Authentication
Search


Advance Usage

Custom HTTP client
Using a proxy

HTTP proxy
SOCKS5 proxy




Acknowledgements
License

Usage #
Refer to the documentation for more information about the API.
Authentication #
The Tavily API uses API keys for authentication. Visit the Tavily console to retrieve the API key you'll use in your requests.

Remember that your API key is a secret!
Do not share it with others or expose it in any client-side code (browsers, apps). Production requests must be routed through your own backend server where your API key can be securely loaded from an environment variable or key management service.

final apiKey = Platform.environment['TAVILY_API_KEY'];
final client = TavilyClient();
copied to clipboard
Search #
Search for data based on a query.
Basic search:
final res = await client.search(
request: SearchRequest(
apiKey: apiKey,
query: 'Should I invest in Apple right now?',
),
);
print(res);
copied to clipboard
Advanced search:
final res = await client.search(
request: SearchRequest(
apiKey: apiKey,
query: 'Should I invest in Apple right now?',
searchDepth: SearchRequestSearchDepth.advanced,
),
);
print(res);
copied to clipboard
See the API documentation for more information on all supported search parameters.
Advance Usage #
Custom HTTP client #
You can always provide your own implementation of http.Client for further customization:
final client = TavilyClient(
client: MyHttpClient(),
);
copied to clipboard
Using a proxy #
HTTP proxy
You can use your own HTTP proxy by overriding the baseUrl and providing your required headers:
final client = TavilyClient(
baseUrl: 'https://my-proxy.com',
headers: {
'x-my-proxy-header': 'value',
},
);
copied to clipboard
If you need further customization, you can always provide your own http.Client.
SOCKS5 proxy
To use a SOCKS5 proxy, you can use the socks5_proxy package:
final baseHttpClient = HttpClient();
SocksTCPClient.assignToHttpClient(baseHttpClient, [
ProxySettings(InternetAddress.loopbackIPv4, 1080),
]);
final httpClient = IOClient(baseClient);

final client = TavilyClient(
client: httpClient,
);
copied to clipboard
Acknowledgements #
The generation of this client was made possible by the openapi_spec package.
License #
Tavily Dart Client is licensed under the MIT License.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.