fmp-ai-tools 0.0.3 → 0.0.5
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 +59 -10
- package/dist/providers/openai/index.d.mts +56 -0
- package/dist/providers/openai/index.d.ts +56 -0
- package/dist/providers/openai/index.js +566 -0
- package/dist/providers/openai/index.js.map +1 -0
- package/dist/providers/openai/index.mjs +525 -0
- package/dist/providers/openai/index.mjs.map +1 -0
- package/dist/providers/vercel-ai/index.d.mts +29 -1
- package/dist/providers/vercel-ai/index.d.ts +29 -1
- package/dist/providers/vercel-ai/index.js +46 -0
- package/dist/providers/vercel-ai/index.js.map +1 -1
- package/dist/providers/vercel-ai/index.mjs +19 -1
- package/dist/providers/vercel-ai/index.mjs.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# FMP Tools
|
|
1
|
+
# FMP AI Tools
|
|
2
2
|
|
|
3
|
-
AI tools for Financial Modeling Prep (FMP) Node API - compatible with Vercel AI SDK,
|
|
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
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install fmp-tools
|
|
10
|
+
npm install fmp-ai-tools
|
|
11
11
|
# or
|
|
12
|
-
pnpm add fmp-tools
|
|
12
|
+
pnpm add fmp-ai-tools
|
|
13
13
|
# or
|
|
14
|
-
yarn add fmp-tools
|
|
14
|
+
yarn add fmp-ai-tools
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
@@ -21,7 +21,7 @@ yarn add fmp-tools
|
|
|
21
21
|
```typescript
|
|
22
22
|
import { openai } from '@ai-sdk/openai';
|
|
23
23
|
import { streamText, convertToModelMessages, stepCountIs } from 'ai';
|
|
24
|
-
import { fmpTools } from 'fmp-tools/vercel-ai';
|
|
24
|
+
import { fmpTools } from 'fmp-ai-tools/vercel-ai';
|
|
25
25
|
|
|
26
26
|
export async function POST(req: Request) {
|
|
27
27
|
const { messages } = await req.json();
|
|
@@ -37,6 +37,29 @@ export async function POST(req: Request) {
|
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### OpenAI Agents
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { Agent } from '@openai/agents';
|
|
44
|
+
import { fmpTools } from 'fmp-ai-tools/openai';
|
|
45
|
+
|
|
46
|
+
const agent = new Agent({
|
|
47
|
+
name: 'Financial Analyst',
|
|
48
|
+
instructions: 'You are a financial analyst with access to real-time market data.',
|
|
49
|
+
tools: fmpTools,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const result = await agent.run({
|
|
53
|
+
messages: [
|
|
54
|
+
{
|
|
55
|
+
role: 'user',
|
|
56
|
+
content:
|
|
57
|
+
'Get the current stock quote for Apple (AAPL) and show me their latest balance sheet',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
40
63
|
## Configuration
|
|
41
64
|
|
|
42
65
|
**Important**: You must set your FMP API key as an environment variable for the tools to work:
|
|
@@ -112,12 +135,12 @@ The tools internally use the `fmp-node-api` library, which reads this environmen
|
|
|
112
135
|
|
|
113
136
|
## Using Individual Tools
|
|
114
137
|
|
|
115
|
-
You can import and use specific tool categories or individual tools:
|
|
138
|
+
You can import and use specific tool categories or individual tools from either provider:
|
|
116
139
|
|
|
117
|
-
### Import Specific Categories
|
|
140
|
+
### Import Specific Categories (Vercel AI)
|
|
118
141
|
|
|
119
142
|
```typescript
|
|
120
|
-
import { quoteTools, financialTools, marketTools } from 'fmp-tools/vercel-ai';
|
|
143
|
+
import { quoteTools, financialTools, marketTools } from 'fmp-ai-tools/vercel-ai';
|
|
121
144
|
|
|
122
145
|
// Use only quote and financial tools
|
|
123
146
|
const selectedTools = {
|
|
@@ -133,7 +156,33 @@ const result = streamText({
|
|
|
133
156
|
});
|
|
134
157
|
```
|
|
135
158
|
|
|
136
|
-
###
|
|
159
|
+
### Import Specific Categories (OpenAI)
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import { quoteTools, financialTools, marketTools } from 'fmp-ai-tools/openai';
|
|
163
|
+
|
|
164
|
+
// Use only quote and financial tools
|
|
165
|
+
const selectedTools = [...quoteTools, ...financialTools];
|
|
166
|
+
|
|
167
|
+
// Use with OpenAI Agents
|
|
168
|
+
const agent = new Agent({
|
|
169
|
+
name: 'Financial Analyst',
|
|
170
|
+
instructions: 'You are a financial analyst with access to real-time market data.',
|
|
171
|
+
tools: selectedTools,
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Import Individual Tools
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
// Vercel AI SDK
|
|
179
|
+
import { getStockQuote, getCompanyProfile } from 'fmp-ai-tools/vercel-ai';
|
|
180
|
+
|
|
181
|
+
// OpenAI Agents
|
|
182
|
+
import { getStockQuote, getCompanyProfile } from 'fmp-ai-tools/openai';
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Example Tool Usage
|
|
137
186
|
|
|
138
187
|
Here are some example prompts you can use with the tools:
|
|
139
188
|
|
|
@@ -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, undefined, string>;
|
|
5
|
+
|
|
6
|
+
declare const getEarningsCalendar: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
7
|
+
declare const getEconomicCalendar: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
8
|
+
|
|
9
|
+
declare const getTreasuryRates: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
10
|
+
declare const getEconomicIndicators: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
11
|
+
|
|
12
|
+
declare const getETFHoldings: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
13
|
+
declare const getETFProfile: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
14
|
+
|
|
15
|
+
declare const getBalanceSheet: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
16
|
+
declare const getIncomeStatement: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
17
|
+
declare const getCashFlowStatement: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
18
|
+
declare const getFinancialRatios: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
19
|
+
|
|
20
|
+
declare const getInsiderTrading: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
21
|
+
|
|
22
|
+
declare const getInstitutionalHolders: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
23
|
+
|
|
24
|
+
declare const getMarketPerformance: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
25
|
+
declare const getSectorPerformance: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
26
|
+
declare const getGainers: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
27
|
+
declare const getLosers: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
28
|
+
declare const getMostActive: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
29
|
+
|
|
30
|
+
declare const getStockQuote: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
31
|
+
|
|
32
|
+
declare const getSenateTrading: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
33
|
+
declare const getHouseTrading: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
34
|
+
declare const getSenateTradingByName: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
35
|
+
declare const getHouseTradingByName: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
36
|
+
declare const getSenateTradingRSSFeed: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
37
|
+
declare const getHouseTradingRSSFeed: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
38
|
+
|
|
39
|
+
declare const getMarketCap: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
40
|
+
declare const getStockSplits: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
41
|
+
declare const getDividendHistory: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
42
|
+
|
|
43
|
+
declare const companyTools: Tool[];
|
|
44
|
+
declare const calendarTools: Tool[];
|
|
45
|
+
declare const economicTools: Tool[];
|
|
46
|
+
declare const etfTools: Tool[];
|
|
47
|
+
declare const financialTools: Tool[];
|
|
48
|
+
declare const insiderTools: Tool[];
|
|
49
|
+
declare const institutionalTools: Tool[];
|
|
50
|
+
declare const marketTools: Tool[];
|
|
51
|
+
declare const quoteTools: Tool[];
|
|
52
|
+
declare const senateHouseTools: Tool[];
|
|
53
|
+
declare const stockTools: Tool[];
|
|
54
|
+
declare const fmpTools: Tool[];
|
|
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, undefined, string>;
|
|
5
|
+
|
|
6
|
+
declare const getEarningsCalendar: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
7
|
+
declare const getEconomicCalendar: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
8
|
+
|
|
9
|
+
declare const getTreasuryRates: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
10
|
+
declare const getEconomicIndicators: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
11
|
+
|
|
12
|
+
declare const getETFHoldings: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
13
|
+
declare const getETFProfile: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
14
|
+
|
|
15
|
+
declare const getBalanceSheet: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
16
|
+
declare const getIncomeStatement: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
17
|
+
declare const getCashFlowStatement: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
18
|
+
declare const getFinancialRatios: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
19
|
+
|
|
20
|
+
declare const getInsiderTrading: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
21
|
+
|
|
22
|
+
declare const getInstitutionalHolders: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
23
|
+
|
|
24
|
+
declare const getMarketPerformance: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
25
|
+
declare const getSectorPerformance: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
26
|
+
declare const getGainers: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
27
|
+
declare const getLosers: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
28
|
+
declare const getMostActive: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
29
|
+
|
|
30
|
+
declare const getStockQuote: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
31
|
+
|
|
32
|
+
declare const getSenateTrading: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
33
|
+
declare const getHouseTrading: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
34
|
+
declare const getSenateTradingByName: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
35
|
+
declare const getHouseTradingByName: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
36
|
+
declare const getSenateTradingRSSFeed: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
37
|
+
declare const getHouseTradingRSSFeed: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
38
|
+
|
|
39
|
+
declare const getMarketCap: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
40
|
+
declare const getStockSplits: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
41
|
+
declare const getDividendHistory: _openai_agents.FunctionTool<unknown, undefined, string>;
|
|
42
|
+
|
|
43
|
+
declare const companyTools: Tool[];
|
|
44
|
+
declare const calendarTools: Tool[];
|
|
45
|
+
declare const economicTools: Tool[];
|
|
46
|
+
declare const etfTools: Tool[];
|
|
47
|
+
declare const financialTools: Tool[];
|
|
48
|
+
declare const insiderTools: Tool[];
|
|
49
|
+
declare const institutionalTools: Tool[];
|
|
50
|
+
declare const marketTools: Tool[];
|
|
51
|
+
declare const quoteTools: Tool[];
|
|
52
|
+
declare const senateHouseTools: Tool[];
|
|
53
|
+
declare const stockTools: Tool[];
|
|
54
|
+
declare const fmpTools: Tool[];
|
|
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 };
|