Package com.tnsai.tools.search
Class SpecializedSearchTools
java.lang.Object
com.tnsai.tools.search.SpecializedSearchTools
Function-shape specialised search tools — function-method replacements for
the legacy
YahooFinanceTool and WolframAlphaTool
(#188 RFC, batch 4e — Search-category sweep finale).
Three typed @Tool methods:
| Method | Purpose | API key |
|---|---|---|
yahooFinanceLookup(java.lang.String) | Stock / ETF / crypto symbol lookup | none |
yahooFinanceNews(java.lang.String) | Financial-news search | none |
wolframAlpha(java.lang.String) | Computational answers (math, units, facts) | WOLFRAM_APP_ID |
Yahoo's free endpoint serves both lookup + news from one call; the two methods slice the same JSON response so the LLM can pick the slice it wants by name rather than parsing a combined blob.
- Since:
- 0.5.7 (Phase 2 batch 4e — built-in tool migration to function shape, see #188)
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor — picks WOLFRAM_APP_ID from env.SpecializedSearchTools(String wolframAppId) Explicit-key constructor (passnullto leave Wolfram unconfigured).SpecializedSearchTools(String wolframAppId, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests or shared HTTP/JSON instances. -
Method Summary
Modifier and TypeMethodDescriptionwolframAlpha(String query) yahooFinanceLookup(String query) yahooFinanceNews(String query)
-
Constructor Details
-
SpecializedSearchTools
public SpecializedSearchTools()Default constructor — picks WOLFRAM_APP_ID from env. -
SpecializedSearchTools
Explicit-key constructor (passnullto leave Wolfram unconfigured). -
SpecializedSearchTools
public SpecializedSearchTools(String wolframAppId, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests or shared HTTP/JSON instances.
-
-
Method Details
-
yahooFinanceLookup
@Tool(name="yahoo_finance_lookup", description="Look up stock / ETF / mutual-fund / crypto symbols on Yahoo Finance. Returns up to 5 matching symbols with ticker, name, instrument type, exchange, and the Yahoo Finance URL. No API key required. For news use yahoo_finance_news instead.", keywords={"finance","yahoo","stock","ticker","symbol","etf","crypto"}, idempotent=true) public String yahooFinanceLookup(@ToolParam(description="Symbol or company name to look up (e.g. \"AAPL\", \"Tesla\", \"BTC-USD\")") String query) throws IOException - Throws:
IOException
-
yahooFinanceNews
@Tool(name="yahoo_finance_news", description="Search Yahoo Finance news for articles related to a company, ticker, or financial topic. Returns up to 10 articles with title, publisher, publish date, related tickers, and direct URL. No API key required.", keywords={"finance","yahoo","news","stock","market","earnings"}, idempotent=true) public String yahooFinanceNews(@ToolParam(description="Search query (company name, ticker symbol, financial topic)") String query) throws IOException - Throws:
IOException
-
wolframAlpha
@Tool(name="wolfram_alpha", description="Compute answers using WolframAlpha\'s Short Answer API. Best for: math (\"integral of sin x\"), unit conversion (\"100 USD in EUR\"), scientific facts (\"speed of light in km/h\"), structured factual queries (\"population of Turkey 2023\"). Returns a single short text answer. Requires WOLFRAM_APP_ID \u2014 get one for free at https://developer.wolframalpha.com/.", keywords={"compute","wolfram","math","science","unit-conversion","facts"}, idempotent=true) public String wolframAlpha(@ToolParam(description="Plain-text question (math, science, unit conversion, factual query)") String query) throws IOException - Throws:
IOException
-