ollama-client 0.2.5 → 0.2.7

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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +336 -91
  4. data/RELEASE_NOTES_v0.2.6.md +41 -0
  5. data/docs/AREAS_FOR_CONSIDERATION.md +325 -0
  6. data/docs/EXAMPLE_REORGANIZATION.md +412 -0
  7. data/docs/FEATURES_ADDED.md +12 -1
  8. data/docs/GETTING_STARTED.md +361 -0
  9. data/docs/INTEGRATION_TESTING.md +170 -0
  10. data/docs/NEXT_STEPS_SUMMARY.md +114 -0
  11. data/docs/PERSONAS.md +383 -0
  12. data/docs/QUICK_START.md +195 -0
  13. data/docs/TESTING.md +392 -170
  14. data/docs/TEST_CHECKLIST.md +450 -0
  15. data/examples/README.md +62 -63
  16. data/examples/basic_chat.rb +33 -0
  17. data/examples/basic_generate.rb +29 -0
  18. data/examples/mcp_executor.rb +39 -0
  19. data/examples/mcp_http_executor.rb +45 -0
  20. data/examples/tool_calling_parsing.rb +59 -0
  21. data/examples/tool_dto_example.rb +0 -0
  22. data/exe/ollama-client +128 -1
  23. data/lib/ollama/agent/planner.rb +7 -2
  24. data/lib/ollama/chat_session.rb +101 -0
  25. data/lib/ollama/client.rb +41 -35
  26. data/lib/ollama/config.rb +9 -4
  27. data/lib/ollama/document_loader.rb +1 -1
  28. data/lib/ollama/embeddings.rb +61 -28
  29. data/lib/ollama/errors.rb +1 -0
  30. data/lib/ollama/mcp/http_client.rb +149 -0
  31. data/lib/ollama/mcp/stdio_client.rb +146 -0
  32. data/lib/ollama/mcp/tools_bridge.rb +72 -0
  33. data/lib/ollama/mcp.rb +31 -0
  34. data/lib/ollama/options.rb +3 -1
  35. data/lib/ollama/personas.rb +287 -0
  36. data/lib/ollama/version.rb +1 -1
  37. data/lib/ollama_client.rb +17 -5
  38. metadata +22 -48
  39. data/examples/advanced_complex_schemas.rb +0 -366
  40. data/examples/advanced_edge_cases.rb +0 -241
  41. data/examples/advanced_error_handling.rb +0 -200
  42. data/examples/advanced_multi_step_agent.rb +0 -341
  43. data/examples/advanced_performance_testing.rb +0 -186
  44. data/examples/chat_console.rb +0 -143
  45. data/examples/complete_workflow.rb +0 -245
  46. data/examples/dhan_console.rb +0 -843
  47. data/examples/dhanhq/README.md +0 -236
  48. data/examples/dhanhq/agents/base_agent.rb +0 -74
  49. data/examples/dhanhq/agents/data_agent.rb +0 -66
  50. data/examples/dhanhq/agents/orchestrator_agent.rb +0 -120
  51. data/examples/dhanhq/agents/technical_analysis_agent.rb +0 -252
  52. data/examples/dhanhq/agents/trading_agent.rb +0 -81
  53. data/examples/dhanhq/analysis/market_structure.rb +0 -138
  54. data/examples/dhanhq/analysis/pattern_recognizer.rb +0 -192
  55. data/examples/dhanhq/analysis/trend_analyzer.rb +0 -88
  56. data/examples/dhanhq/builders/market_context_builder.rb +0 -67
  57. data/examples/dhanhq/dhanhq_agent.rb +0 -829
  58. data/examples/dhanhq/indicators/technical_indicators.rb +0 -158
  59. data/examples/dhanhq/scanners/intraday_options_scanner.rb +0 -492
  60. data/examples/dhanhq/scanners/swing_scanner.rb +0 -247
  61. data/examples/dhanhq/schemas/agent_schemas.rb +0 -61
  62. data/examples/dhanhq/services/base_service.rb +0 -46
  63. data/examples/dhanhq/services/data_service.rb +0 -118
  64. data/examples/dhanhq/services/trading_service.rb +0 -59
  65. data/examples/dhanhq/technical_analysis_agentic_runner.rb +0 -411
  66. data/examples/dhanhq/technical_analysis_runner.rb +0 -420
  67. data/examples/dhanhq/test_tool_calling.rb +0 -538
  68. data/examples/dhanhq/test_tool_calling_verbose.rb +0 -251
  69. data/examples/dhanhq/utils/instrument_helper.rb +0 -32
  70. data/examples/dhanhq/utils/parameter_cleaner.rb +0 -28
  71. data/examples/dhanhq/utils/parameter_normalizer.rb +0 -45
  72. data/examples/dhanhq/utils/rate_limiter.rb +0 -23
  73. data/examples/dhanhq/utils/trading_parameter_normalizer.rb +0 -72
  74. data/examples/dhanhq_agent.rb +0 -964
  75. data/examples/dhanhq_tools.rb +0 -1663
  76. data/examples/multi_step_agent_with_external_data.rb +0 -368
  77. data/examples/structured_outputs_chat.rb +0 -72
  78. data/examples/structured_tools.rb +0 -89
  79. data/examples/test_dhanhq_tool_calling.rb +0 -375
  80. data/examples/test_tool_calling.rb +0 -160
  81. data/examples/tool_calling_direct.rb +0 -124
  82. data/examples/tool_calling_pattern.rb +0 -269
  83. data/exe/dhan_console +0 -4
@@ -1,236 +0,0 @@
1
- # DhanHQ Agent - Complete Trading & Technical Analysis System
2
-
3
- ## Features
4
-
5
- ### Core Capabilities
6
- - **Data Retrieval**: 6 DhanHQ Data APIs (Market Quote, LTP, Depth, Historical, Options, Chain)
7
- - **Trading Tools**: Order parameter building (regular, super orders, cancel)
8
- - **LLM-Powered Decisions**: Ollama for intelligent market analysis and decision making
9
- - **LLM Orchestration**: AI decides what symbols to analyze, which exchange segments, and what analysis to run
10
-
11
- ### Technical Analysis (NEW!)
12
- - **Trend Analysis**: Uptrend, downtrend, sideways detection with strength calculation
13
- - **Market Structure**: SMC (Smart Money Concepts) analysis
14
- - Order blocks identification
15
- - Liquidity zones (buy-side/sell-side)
16
- - Structure breaks detection
17
- - **Pattern Recognition**:
18
- - Candlestick patterns (engulfing, hammer, shooting star, etc.)
19
- - Chart patterns (head & shoulders, double top/bottom)
20
- - **Technical Indicators**:
21
- - Moving Averages (SMA, EMA)
22
- - RSI (Relative Strength Index)
23
- - MACD (Moving Average Convergence Divergence)
24
- - Bollinger Bands
25
- - ATR (Average True Range)
26
- - Support & Resistance levels
27
-
28
- ### Scanners (NEW!)
29
- - **Swing Trading Scanner**: Find swing trading candidates based on technical analysis
30
- - **Intraday Options Scanner**: Find intraday options buying opportunities with IV/OI analysis
31
-
32
- ## Structure
33
-
34
- ```
35
- dhanhq/
36
- ├── agents/ # Agent classes (LLM decision makers)
37
- │ ├── base_agent.rb
38
- │ ├── data_agent.rb
39
- │ ├── trading_agent.rb
40
- │ ├── technical_analysis_agent.rb
41
- │ └── orchestrator_agent.rb # NEW - LLM decides what to analyze
42
- ├── services/ # Service classes (API executors)
43
- │ ├── base_service.rb
44
- │ ├── data_service.rb
45
- │ └── trading_service.rb
46
- ├── analysis/ # Technical analysis modules (NEW)
47
- │ ├── market_structure.rb # SMC, trend, structure breaks
48
- │ ├── pattern_recognizer.rb # Candlestick & chart patterns
49
- │ └── trend_analyzer.rb # Comprehensive trend analysis
50
- ├── indicators/ # Technical indicators (NEW)
51
- │ └── technical_indicators.rb # RSI, MACD, MA, Bollinger, ATR, etc.
52
- ├── scanners/ # Trading scanners (NEW)
53
- │ ├── swing_scanner.rb # Swing trading candidates
54
- │ └── intraday_options_scanner.rb # Options opportunities
55
- ├── builders/ # Builder classes
56
- │ └── market_context_builder.rb
57
- ├── utils/ # Utility classes
58
- │ ├── instrument_helper.rb
59
- │ ├── parameter_normalizer.rb
60
- │ ├── parameter_cleaner.rb
61
- │ ├── trading_parameter_normalizer.rb
62
- │ └── rate_limiter.rb
63
- ├── schemas/ # JSON schemas for LLM
64
- │ └── agent_schemas.rb
65
- └── dhanhq_agent.rb # Main entry point
66
- ```
67
-
68
- ## Design Principles
69
-
70
- - **SOLID**: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion
71
- - **KISS**: Keep It Simple, Stupid
72
- - **DRY**: Don't Repeat Yourself
73
- - **Namespacing**: All classes under `DhanHQ` module
74
-
75
- ## Usage
76
-
77
- ### Basic Usage
78
-
79
- ```ruby
80
- require_relative "dhanhq/dhanhq_agent"
81
-
82
- agent = DhanHQ::Agent.new
83
-
84
- # Data retrieval
85
- decision = agent.data_agent.analyze_and_decide(market_context: "...")
86
- result = agent.data_agent.execute_decision(decision)
87
-
88
- # Trading
89
- trading_decision = agent.trading_agent.analyze_and_decide(market_context: "...")
90
- order_params = agent.trading_agent.execute_decision(trading_decision)
91
- ```
92
-
93
- ### LLM Orchestration (NEW!)
94
-
95
- ```ruby
96
- # Let LLM decide what to analyze
97
- plan = agent.orchestrator_agent.decide_analysis_plan(
98
- market_context: "NIFTY is at 25,790, RELIANCE showing strength",
99
- user_query: "Find swing trading opportunities in banking stocks"
100
- )
101
-
102
- # Plan contains:
103
- # - analysis_plan: Array of tasks with symbol, exchange_segment, analysis_type
104
- # - reasoning: Why the LLM chose this plan
105
-
106
- # Execute the plan
107
- plan["analysis_plan"].each do |task|
108
- case task["analysis_type"]
109
- when "technical_analysis"
110
- agent.analysis_agent.analyze_symbol(...)
111
- when "swing_scan"
112
- agent.swing_scanner.scan_symbols(...)
113
- when "options_scan"
114
- agent.options_scanner.scan_for_options_setups(...)
115
- end
116
- end
117
- ```
118
-
119
- ### Technical Analysis
120
-
121
- ```ruby
122
- # Analyze a symbol
123
- analysis = agent.analysis_agent.analyze_symbol(
124
- symbol: "RELIANCE",
125
- exchange_segment: "NSE_EQ"
126
- )
127
-
128
- # Get swing trading recommendation
129
- recommendation = agent.analysis_agent.generate_recommendation(
130
- analysis,
131
- trading_style: :swing
132
- )
133
- ```
134
-
135
- ### Scanning
136
-
137
- ```ruby
138
- # Swing trading scanner
139
- candidates = agent.swing_scanner.scan_symbols(
140
- ["RELIANCE", "TCS", "INFY"],
141
- exchange_segment: "NSE_EQ"
142
- )
143
-
144
- # Intraday options scanner
145
- options_setups = agent.options_scanner.scan_for_options_setups(
146
- "NIFTY",
147
- exchange_segment: "IDX_I"
148
- )
149
- ```
150
-
151
- ## Technical Analysis Capabilities
152
-
153
- ### Trend Analysis
154
- - Detects uptrend, downtrend, sideways
155
- - Calculates trend strength percentage
156
- - Uses moving averages for confirmation
157
-
158
- ### SMC (Smart Money Concepts)
159
- - **Order Blocks**: Identifies institutional order zones
160
- - **Liquidity Zones**: Finds buy-side and sell-side liquidity areas
161
- - **Structure Breaks**: Detects trend changes and breakouts
162
-
163
- ### Pattern Recognition
164
- - **Candlestick Patterns**: Engulfing, hammer, shooting star, three white soldiers/crows
165
- - **Chart Patterns**: Head & shoulders, double top/bottom
166
-
167
- ### Indicators
168
- - **RSI**: Overbought/oversold conditions
169
- - **MACD**: Momentum and trend changes
170
- - **Moving Averages**: Trend confirmation
171
- - **Bollinger Bands**: Volatility and mean reversion
172
- - **ATR**: Volatility measurement
173
- - **Support/Resistance**: Key price levels
174
-
175
- ## Scanner Features
176
-
177
- ### Swing Trading Scanner
178
- - Scores symbols based on:
179
- - Trend strength
180
- - RSI levels (prefers 40-60 zone)
181
- - MACD bullish crossovers
182
- - Structure breaks
183
- - Pattern recognition
184
- - Returns top candidates sorted by score
185
-
186
- ### Intraday Options Scanner
187
- - Analyzes underlying trend
188
- - Finds ATM/near-ATM strikes
189
- - Considers:
190
- - Implied Volatility (lower is better for buying)
191
- - Open Interest (higher is better)
192
- - Volume (higher is better)
193
- - Trend alignment
194
- - RSI levels
195
- - Returns top 5 setups with scores
196
-
197
- ## Running
198
-
199
- ### Full Demo (All Features)
200
- ```bash
201
- ruby examples/dhanhq/dhanhq_agent.rb
202
- ```
203
-
204
- This will demonstrate:
205
- 1. Data retrieval with LLM decisions
206
- 2. Trading order parameter building
207
- 3. Technical analysis for a symbol
208
- 4. Swing trading scanner
209
- 5. Intraday options scanner
210
-
211
- ### Technical Analysis Only
212
- ```bash
213
- # LLM decides what to analyze (default)
214
- ruby examples/dhanhq/technical_analysis_runner.rb
215
-
216
- # With custom query
217
- ruby examples/dhanhq/technical_analysis_runner.rb "Find options opportunities for NIFTY"
218
-
219
- # With custom query and market context
220
- ruby examples/dhanhq/technical_analysis_runner.rb "Analyze banking stocks" "Banking sector showing strength"
221
-
222
- # Show manual examples too (for comparison)
223
- SHOW_MANUAL_EXAMPLES=true ruby examples/dhanhq/technical_analysis_runner.rb
224
- ```
225
-
226
- **LLM-Powered Orchestration:**
227
- The LLM decides:
228
- - Which symbols to analyze (e.g., "RELIANCE", "NIFTY", "BANKNIFTY")
229
- - Which exchange segments to use (NSE_EQ, IDX_I, etc.)
230
- - What type of analysis to run (technical_analysis, swing_scan, options_scan)
231
- - Priority order of analysis tasks
232
-
233
- This makes the system truly autonomous - you just ask what you want, and the LLM figures out how to get it.
234
-
235
- **Manual Examples (optional):**
236
- If `SHOW_MANUAL_EXAMPLES=true`, it also runs fixed examples for comparison.
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../utils/parameter_normalizer"
4
- require_relative "../utils/parameter_cleaner"
5
-
6
- module DhanHQ
7
- module Agents
8
- # Base class for all agents with common LLM interaction logic
9
- class BaseAgent
10
- MIN_CONFIDENCE = 0.6
11
-
12
- def initialize(ollama_client:, schema:)
13
- @ollama_client = ollama_client
14
- @schema = schema
15
- end
16
-
17
- def analyze_and_decide(market_context:)
18
- prompt = build_analysis_prompt(market_context: market_context)
19
-
20
- decision = call_llm(prompt)
21
- return invalid_decision unless valid_decision?(decision)
22
-
23
- decision = clean_parameters(decision)
24
- return low_confidence_decision(decision) if low_confidence?(decision)
25
-
26
- decision
27
- rescue StandardError => e
28
- error_decision(e.message)
29
- end
30
-
31
- protected
32
-
33
- def build_analysis_prompt(market_context:)
34
- raise NotImplementedError, "Subclasses must implement build_analysis_prompt"
35
- end
36
-
37
- private
38
-
39
- def call_llm(prompt)
40
- @ollama_client.generate(prompt: prompt, schema: @schema)
41
- end
42
-
43
- def valid_decision?(decision)
44
- decision.is_a?(Hash) && decision["confidence"]
45
- end
46
-
47
- def clean_parameters(decision)
48
- return decision unless decision["parameters"].is_a?(Hash)
49
-
50
- cleaned_params = DhanHQ::Utils::ParameterCleaner.clean(decision["parameters"])
51
- decision.merge("parameters" => cleaned_params)
52
- end
53
-
54
- def low_confidence?(decision)
55
- decision["confidence"] < MIN_CONFIDENCE
56
- end
57
-
58
- def invalid_decision
59
- { action: "no_action", reason: "invalid_decision" }
60
- end
61
-
62
- def low_confidence_decision(decision)
63
- confidence_pct = (decision["confidence"] * 100).round
64
- puts "⚠️ Low confidence (#{confidence_pct}%) - skipping action"
65
- { action: "no_action", reason: "low_confidence" }
66
- end
67
-
68
- def error_decision(message)
69
- puts "❌ Ollama error: #{message}"
70
- { action: "no_action", reason: "error", error: message }
71
- end
72
- end
73
- end
74
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base_agent"
4
- require_relative "../schemas/agent_schemas"
5
- require_relative "../services/data_service"
6
-
7
- module DhanHQ
8
- module Agents
9
- # Agent for market data retrieval decisions using LLM
10
- class DataAgent < BaseAgent
11
- def initialize(ollama_client:)
12
- super(ollama_client: ollama_client, schema: DhanHQ::Schemas::AgentSchemas::DATA_AGENT_SCHEMA)
13
- @data_service = DhanHQ::Services::DataService.new
14
- end
15
-
16
- def execute_decision(decision)
17
- action = decision["action"]
18
- params = DhanHQ::Utils::ParameterNormalizer.normalize(decision["parameters"] || {})
19
-
20
- @data_service.execute(action: action, params: params)
21
- end
22
-
23
- protected
24
-
25
- def build_analysis_prompt(market_context:)
26
- <<~PROMPT
27
- Analyze the following market situation and decide the best data retrieval action:
28
-
29
- Market Context:
30
- #{market_context}
31
-
32
- Available Actions (DATA ONLY - NO TRADING):
33
- - get_market_quote: Get market quote using Instrument.quote convenience method (requires: symbol OR security_id as STRING, exchange_segment as STRING)
34
- - get_live_ltp: Get live last traded price using Instrument.ltp convenience method (requires: symbol OR security_id as STRING, exchange_segment as STRING)
35
- - get_market_depth: Get full market depth (bid/ask levels) using Instrument.quote convenience method (requires: symbol OR security_id as STRING, exchange_segment as STRING)
36
- - get_historical_data: Get historical data using Instrument.daily/intraday convenience methods (requires: symbol OR security_id as STRING, exchange_segment as STRING, from_date, to_date, optional: interval, expiry_code)
37
- - get_expired_options_data: Get expired options historical data (requires: symbol OR security_id as STRING, exchange_segment as STRING, expiry_date; optional: expiry_code, interval, instrument, expiry_flag, strike, drv_option_type, required_data)
38
- - get_option_chain: Get option chain using Instrument.expiry_list/option_chain convenience methods (requires: symbol OR security_id as STRING, exchange_segment as STRING, optional: expiry)
39
- - no_action: Take no action if unclear what data is needed
40
-
41
- CRITICAL: Each API call handles ONLY ONE symbol at a time. If you need data for multiple symbols, choose ONE symbol for this decision.
42
- - symbol must be a SINGLE STRING value (e.g., "NIFTY" or "RELIANCE"), NOT an array
43
- - exchange_segment must be a SINGLE STRING value (e.g., "NSE_EQ" or "IDX_I"), NOT an array
44
- - All APIs use Instrument.find() which expects SYMBOL (e.g., "NIFTY", "RELIANCE"), not security_id
45
- - Instrument convenience methods automatically use the instrument's security_id, exchange_segment, and instrument attributes
46
- - Use symbol when possible for better compatibility
47
- Examples:
48
- - For NIFTY: symbol="NIFTY", exchange_segment="IDX_I"
49
- - For RELIANCE: symbol="RELIANCE", exchange_segment="NSE_EQ"
50
- Valid exchange_segments: NSE_EQ, NSE_FNO, NSE_CURRENCY, BSE_EQ, BSE_FNO, BSE_CURRENCY, MCX_COMM, IDX_I
51
-
52
- Decision Criteria:
53
- - Only take actions with confidence > 0.6
54
- - Focus on data retrieval, not trading decisions
55
- - Provide all required parameters for the chosen action
56
-
57
- Respond with a JSON object containing:
58
- - action: one of the available actions
59
- - reasoning: why this action was chosen
60
- - confidence: your confidence level (0-1)
61
- - parameters: object with required parameters for the action
62
- PROMPT
63
- end
64
- end
65
- end
66
- end
@@ -1,120 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base_agent"
4
- require_relative "../schemas/agent_schemas"
5
-
6
- module DhanHQ
7
- module Agents
8
- # Orchestrator agent that uses LLM to decide what to analyze
9
- class OrchestratorAgent < BaseAgent
10
- def initialize(ollama_client:)
11
- super(ollama_client: ollama_client, schema: build_orchestration_schema)
12
- end
13
-
14
- def decide_analysis_plan(market_context: "", user_query: "")
15
- prompt = build_orchestration_prompt(market_context: market_context, user_query: user_query)
16
-
17
- begin
18
- plan = @ollama_client.generate(
19
- prompt: prompt,
20
- schema: build_orchestration_schema
21
- )
22
-
23
- return { error: "Invalid plan" } unless plan.is_a?(Hash) && plan["analysis_plan"]
24
-
25
- plan
26
- rescue Ollama::Error => e
27
- { error: e.message }
28
- end
29
- end
30
-
31
- protected
32
-
33
- def build_analysis_prompt(*)
34
- ""
35
- end
36
-
37
- private
38
-
39
- def build_orchestration_prompt(market_context:, user_query:)
40
- <<~PROMPT
41
- You are a trading analysis orchestrator. Based on the market context and user query, decide what technical analysis to perform.
42
-
43
- Market Context:
44
- #{market_context.empty? ? 'No specific market context provided' : market_context}
45
-
46
- User Query:
47
- #{user_query.empty? ? 'No specific query - analyze current market opportunities' : user_query}
48
-
49
- Your task is to create an analysis plan that includes:
50
- 1. Which symbols to analyze:
51
- - Equity stocks: "RELIANCE", "TCS", "INFY", "HDFC" (use NSE_EQ or BSE_EQ)
52
- - Indices: "NIFTY", "SENSEX", "BANKNIFTY" (use IDX_I)
53
- 2. Which exchange segments to use:
54
- - NSE_EQ or BSE_EQ for equity stocks
55
- - IDX_I for indices (NIFTY, SENSEX, BANKNIFTY)
56
- 3. What type of analysis to perform:
57
- - "technical_analysis": Full technical analysis (trend, indicators, patterns) - can be used for both stocks and indices
58
- - "swing_scan": Scan for swing trading opportunities - ONLY for equity stocks, NEVER for indices
59
- - "options_scan": Scan for intraday options opportunities - ONLY for indices (NIFTY, SENSEX, BANKNIFTY)
60
- - "all": Run all applicable analysis types (swing_scan only for stocks, options_scan only for indices)
61
- 4. Priority order (which symbols/analyses to run first)
62
-
63
- Consider:
64
- - If user mentions specific stocks, prioritize those
65
- - If user asks about "swing trading", use swing_scan ONLY for equity stocks (not indices)
66
- - If user asks about "options" or "intraday", use options_scan
67
- - If no specific query, scan for opportunities across multiple symbols
68
- - CRITICAL: Index symbols (NIFTY, SENSEX, BANKNIFTY) are INDICES, not stocks
69
- * Indices should ONLY be analyzed with options_scan (for options buying opportunities)
70
- * Indices should NEVER be analyzed with swing_scan (swing trading is for stocks only)
71
- - For options, use index symbols (NIFTY, SENSEX, BANKNIFTY) with IDX_I segment
72
- - For swing trading, use ONLY equity symbols (RELIANCE, TCS, INFY, HDFC) with NSE_EQ or BSE_EQ segment
73
-
74
- Respond with a JSON object containing your analysis plan.
75
- PROMPT
76
- end
77
-
78
- def build_orchestration_schema
79
- {
80
- "type" => "object",
81
- "required" => ["analysis_plan", "reasoning"],
82
- "properties" => {
83
- "analysis_plan" => {
84
- "type" => "array",
85
- "items" => {
86
- "type" => "object",
87
- "required" => ["symbol", "exchange_segment", "analysis_type"],
88
- "properties" => {
89
- "symbol" => {
90
- "type" => "string",
91
- "description" => "Symbol to analyze (e.g., 'RELIANCE', 'NIFTY', 'TCS')"
92
- },
93
- "exchange_segment" => {
94
- "type" => "string",
95
- "enum" => ["NSE_EQ", "NSE_FNO", "NSE_CURRENCY", "BSE_EQ", "BSE_FNO",
96
- "BSE_CURRENCY", "MCX_COMM", "IDX_I"],
97
- "description" => "Exchange segment for the symbol"
98
- },
99
- "analysis_type" => {
100
- "type" => "string",
101
- "enum" => ["technical_analysis", "swing_scan", "options_scan", "all"],
102
- "description" => "Type of analysis to perform"
103
- },
104
- "priority" => {
105
- "type" => "number",
106
- "description" => "Priority (1 = highest, lower numbers = higher priority)"
107
- }
108
- }
109
- }
110
- },
111
- "reasoning" => {
112
- "type" => "string",
113
- "description" => "Why you chose this analysis plan"
114
- }
115
- }
116
- }
117
- end
118
- end
119
- end
120
- end