fmp-ai-tools 0.0.4 → 0.0.6

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # FMP AI Tools
2
2
 
3
- AI tools for Financial Modeling Prep (FMP) Node API - compatible with Vercel AI SDK, Langchain, OpenAI, and more.
3
+ AI tools for Financial Modeling Prep (FMP) Node API - compatible with Vercel AI SDK, OpenAI Agents, and more.
4
4
 
5
5
  This package provides pre-built AI tools that can be used with various AI frameworks. For direct API access, use the `fmp-node-api` package.
6
6
 
@@ -14,6 +14,18 @@ pnpm add fmp-ai-tools
14
14
  yarn add fmp-ai-tools
15
15
  ```
16
16
 
17
+ ## Version Compatibility
18
+
19
+ ### OpenAI Agents Compatibility
20
+
21
+ **⚠️ Important**: This package requires `@openai/agents` version `^0.0.17` or higher due to breaking changes in the API.
22
+
23
+ If you're using an older version, you'll encounter errors like:
24
+
25
+ ```
26
+ Zod field uses .optional() without .nullable() which is not supported by the API
27
+ ```
28
+
17
29
  ## Quick Start
18
30
 
19
31
  ### Vercel AI SDK (Recommended)
@@ -37,6 +49,29 @@ export async function POST(req: Request) {
37
49
  }
38
50
  ```
39
51
 
52
+ ### OpenAI Agents
53
+
54
+ ```typescript
55
+ import { Agent } from '@openai/agents';
56
+ import { fmpTools } from 'fmp-ai-tools/openai';
57
+
58
+ const agent = new Agent({
59
+ name: 'Financial Analyst',
60
+ instructions: 'You are a financial analyst with access to real-time market data.',
61
+ tools: fmpTools,
62
+ });
63
+
64
+ const result = await agent.run({
65
+ messages: [
66
+ {
67
+ role: 'user',
68
+ content:
69
+ 'Get the current stock quote for Apple (AAPL) and show me their latest balance sheet',
70
+ },
71
+ ],
72
+ });
73
+ ```
74
+
40
75
  ## Configuration
41
76
 
42
77
  **Important**: You must set your FMP API key as an environment variable for the tools to work:
@@ -47,6 +82,45 @@ FMP_API_KEY=your_api_key_here
47
82
 
48
83
  The tools internally use the `fmp-node-api` library, which reads this environment variable to authenticate with the Financial Modeling Prep API.
49
84
 
85
+ ### Debugging and Logging
86
+
87
+ **⚠️ Development Only**: These logging features are intended for debugging and development, not production use.
88
+
89
+ Two logging modes controlled by environment variables:
90
+
91
+ #### Full Logging Mode
92
+
93
+ ```bash
94
+ FMP_TOOLS_LOG_API_RESULTS=true
95
+ ```
96
+
97
+ Logs: tool name, input parameters, result summary with token count, execution time.
98
+
99
+ #### Data-Only Logging Mode
100
+
101
+ ```bash
102
+ FMP_TOOLS_LOG_DATA_ONLY=true
103
+ ```
104
+
105
+ Logs: result summary and formatted JSON response data.
106
+
107
+ #### Example Output
108
+
109
+ **Full Logging:**
110
+
111
+ ```
112
+ 🔧 getStockQuote: object (~28 tokens)
113
+ ⏱️ Execution Time: 245ms
114
+ ```
115
+
116
+ **Data-Only Logging:**
117
+
118
+ ```
119
+ 📤 Result: { "symbol": "AAPL", "price": 150.25, ... }
120
+ ```
121
+
122
+ **Note**: Both modes are disabled by default. Use only during development.
123
+
50
124
  ## Available Tools
51
125
 
52
126
  ### Quote Tools
@@ -112,9 +186,9 @@ The tools internally use the `fmp-node-api` library, which reads this environmen
112
186
 
113
187
  ## Using Individual Tools
114
188
 
115
- You can import and use specific tool categories or individual tools:
189
+ You can import and use specific tool categories or individual tools from either provider:
116
190
 
117
- ### Import Specific Categories
191
+ ### Import Specific Categories (Vercel AI)
118
192
 
119
193
  ```typescript
120
194
  import { quoteTools, financialTools, marketTools } from 'fmp-ai-tools/vercel-ai';
@@ -133,7 +207,33 @@ const result = streamText({
133
207
  });
134
208
  ```
135
209
 
136
- ### Example Tool Usage
210
+ ### Import Specific Categories (OpenAI)
211
+
212
+ ```typescript
213
+ import { quoteTools, financialTools, marketTools } from 'fmp-ai-tools/openai';
214
+
215
+ // Use only quote and financial tools
216
+ const selectedTools = [...quoteTools, ...financialTools];
217
+
218
+ // Use with OpenAI Agents
219
+ const agent = new Agent({
220
+ name: 'Financial Analyst',
221
+ instructions: 'You are a financial analyst with access to real-time market data.',
222
+ tools: selectedTools,
223
+ });
224
+ ```
225
+
226
+ ### Import Individual Tools
227
+
228
+ ```typescript
229
+ // Vercel AI SDK
230
+ import { getStockQuote, getCompanyProfile } from 'fmp-ai-tools/vercel-ai';
231
+
232
+ // OpenAI Agents
233
+ import { getStockQuote, getCompanyProfile } from 'fmp-ai-tools/openai';
234
+ ```
235
+
236
+ ## Example Tool Usage
137
237
 
138
238
  Here are some example prompts you can use with the tools:
139
239
 
@@ -0,0 +1,56 @@
1
+ import * as _openai_agents from '@openai/agents';
2
+ import { Tool } from '@openai/agents';
3
+
4
+ declare const getCompanyProfile: _openai_agents.FunctionTool<unknown, any, string>;
5
+
6
+ declare const getEarningsCalendar: _openai_agents.FunctionTool<unknown, any, string>;
7
+ declare const getEconomicCalendar: _openai_agents.FunctionTool<unknown, any, string>;
8
+
9
+ declare const getTreasuryRates: _openai_agents.FunctionTool<unknown, any, string>;
10
+ declare const getEconomicIndicators: _openai_agents.FunctionTool<unknown, any, string>;
11
+
12
+ declare const getETFHoldings: _openai_agents.FunctionTool<unknown, any, string>;
13
+ declare const getETFProfile: _openai_agents.FunctionTool<unknown, any, string>;
14
+
15
+ declare const getBalanceSheet: _openai_agents.FunctionTool<unknown, any, string>;
16
+ declare const getIncomeStatement: _openai_agents.FunctionTool<unknown, any, string>;
17
+ declare const getCashFlowStatement: _openai_agents.FunctionTool<unknown, any, string>;
18
+ declare const getFinancialRatios: _openai_agents.FunctionTool<unknown, any, string>;
19
+
20
+ declare const getInsiderTrading: _openai_agents.FunctionTool<unknown, any, string>;
21
+
22
+ declare const getInstitutionalHolders: _openai_agents.FunctionTool<unknown, any, string>;
23
+
24
+ declare const getMarketPerformance: _openai_agents.FunctionTool<unknown, any, string>;
25
+ declare const getSectorPerformance: _openai_agents.FunctionTool<unknown, any, string>;
26
+ declare const getGainers: _openai_agents.FunctionTool<unknown, any, string>;
27
+ declare const getLosers: _openai_agents.FunctionTool<unknown, any, string>;
28
+ declare const getMostActive: _openai_agents.FunctionTool<unknown, any, string>;
29
+
30
+ declare const getStockQuote: _openai_agents.FunctionTool<unknown, any, string>;
31
+
32
+ declare const getSenateTrading: _openai_agents.FunctionTool<unknown, any, string>;
33
+ declare const getHouseTrading: _openai_agents.FunctionTool<unknown, any, string>;
34
+ declare const getSenateTradingByName: _openai_agents.FunctionTool<unknown, any, string>;
35
+ declare const getHouseTradingByName: _openai_agents.FunctionTool<unknown, any, string>;
36
+ declare const getSenateTradingRSSFeed: _openai_agents.FunctionTool<unknown, any, string>;
37
+ declare const getHouseTradingRSSFeed: _openai_agents.FunctionTool<unknown, any, string>;
38
+
39
+ declare const getMarketCap: _openai_agents.FunctionTool<unknown, any, string>;
40
+ declare const getStockSplits: _openai_agents.FunctionTool<unknown, any, string>;
41
+ declare const getDividendHistory: _openai_agents.FunctionTool<unknown, any, string>;
42
+
43
+ declare const companyTools: Tool<unknown>[];
44
+ declare const calendarTools: Tool<unknown>[];
45
+ declare const economicTools: Tool<unknown>[];
46
+ declare const etfTools: Tool<unknown>[];
47
+ declare const financialTools: Tool<unknown>[];
48
+ declare const insiderTools: Tool<unknown>[];
49
+ declare const institutionalTools: Tool<unknown>[];
50
+ declare const marketTools: Tool<unknown>[];
51
+ declare const quoteTools: Tool<unknown>[];
52
+ declare const senateHouseTools: Tool<unknown>[];
53
+ declare const stockTools: Tool<unknown>[];
54
+ declare const fmpTools: Tool<unknown>[];
55
+
56
+ export { calendarTools, companyTools, economicTools, etfTools, financialTools, fmpTools, getBalanceSheet, getCashFlowStatement, getCompanyProfile, getDividendHistory, getETFHoldings, getETFProfile, getEarningsCalendar, getEconomicCalendar, getEconomicIndicators, getFinancialRatios, getGainers, getHouseTrading, getHouseTradingByName, getHouseTradingRSSFeed, getIncomeStatement, getInsiderTrading, getInstitutionalHolders, getLosers, getMarketCap, getMarketPerformance, getMostActive, getSectorPerformance, getSenateTrading, getSenateTradingByName, getSenateTradingRSSFeed, getStockQuote, getStockSplits, getTreasuryRates, insiderTools, institutionalTools, marketTools, quoteTools, senateHouseTools, stockTools };
@@ -0,0 +1,56 @@
1
+ import * as _openai_agents from '@openai/agents';
2
+ import { Tool } from '@openai/agents';
3
+
4
+ declare const getCompanyProfile: _openai_agents.FunctionTool<unknown, any, string>;
5
+
6
+ declare const getEarningsCalendar: _openai_agents.FunctionTool<unknown, any, string>;
7
+ declare const getEconomicCalendar: _openai_agents.FunctionTool<unknown, any, string>;
8
+
9
+ declare const getTreasuryRates: _openai_agents.FunctionTool<unknown, any, string>;
10
+ declare const getEconomicIndicators: _openai_agents.FunctionTool<unknown, any, string>;
11
+
12
+ declare const getETFHoldings: _openai_agents.FunctionTool<unknown, any, string>;
13
+ declare const getETFProfile: _openai_agents.FunctionTool<unknown, any, string>;
14
+
15
+ declare const getBalanceSheet: _openai_agents.FunctionTool<unknown, any, string>;
16
+ declare const getIncomeStatement: _openai_agents.FunctionTool<unknown, any, string>;
17
+ declare const getCashFlowStatement: _openai_agents.FunctionTool<unknown, any, string>;
18
+ declare const getFinancialRatios: _openai_agents.FunctionTool<unknown, any, string>;
19
+
20
+ declare const getInsiderTrading: _openai_agents.FunctionTool<unknown, any, string>;
21
+
22
+ declare const getInstitutionalHolders: _openai_agents.FunctionTool<unknown, any, string>;
23
+
24
+ declare const getMarketPerformance: _openai_agents.FunctionTool<unknown, any, string>;
25
+ declare const getSectorPerformance: _openai_agents.FunctionTool<unknown, any, string>;
26
+ declare const getGainers: _openai_agents.FunctionTool<unknown, any, string>;
27
+ declare const getLosers: _openai_agents.FunctionTool<unknown, any, string>;
28
+ declare const getMostActive: _openai_agents.FunctionTool<unknown, any, string>;
29
+
30
+ declare const getStockQuote: _openai_agents.FunctionTool<unknown, any, string>;
31
+
32
+ declare const getSenateTrading: _openai_agents.FunctionTool<unknown, any, string>;
33
+ declare const getHouseTrading: _openai_agents.FunctionTool<unknown, any, string>;
34
+ declare const getSenateTradingByName: _openai_agents.FunctionTool<unknown, any, string>;
35
+ declare const getHouseTradingByName: _openai_agents.FunctionTool<unknown, any, string>;
36
+ declare const getSenateTradingRSSFeed: _openai_agents.FunctionTool<unknown, any, string>;
37
+ declare const getHouseTradingRSSFeed: _openai_agents.FunctionTool<unknown, any, string>;
38
+
39
+ declare const getMarketCap: _openai_agents.FunctionTool<unknown, any, string>;
40
+ declare const getStockSplits: _openai_agents.FunctionTool<unknown, any, string>;
41
+ declare const getDividendHistory: _openai_agents.FunctionTool<unknown, any, string>;
42
+
43
+ declare const companyTools: Tool<unknown>[];
44
+ declare const calendarTools: Tool<unknown>[];
45
+ declare const economicTools: Tool<unknown>[];
46
+ declare const etfTools: Tool<unknown>[];
47
+ declare const financialTools: Tool<unknown>[];
48
+ declare const insiderTools: Tool<unknown>[];
49
+ declare const institutionalTools: Tool<unknown>[];
50
+ declare const marketTools: Tool<unknown>[];
51
+ declare const quoteTools: Tool<unknown>[];
52
+ declare const senateHouseTools: Tool<unknown>[];
53
+ declare const stockTools: Tool<unknown>[];
54
+ declare const fmpTools: Tool<unknown>[];
55
+
56
+ export { calendarTools, companyTools, economicTools, etfTools, financialTools, fmpTools, getBalanceSheet, getCashFlowStatement, getCompanyProfile, getDividendHistory, getETFHoldings, getETFProfile, getEarningsCalendar, getEconomicCalendar, getEconomicIndicators, getFinancialRatios, getGainers, getHouseTrading, getHouseTradingByName, getHouseTradingRSSFeed, getIncomeStatement, getInsiderTrading, getInstitutionalHolders, getLosers, getMarketCap, getMarketPerformance, getMostActive, getSectorPerformance, getSenateTrading, getSenateTradingByName, getSenateTradingRSSFeed, getStockQuote, getStockSplits, getTreasuryRates, insiderTools, institutionalTools, marketTools, quoteTools, senateHouseTools, stockTools };