Spaces:
Running
on
Zero
Running
on
Zero
Upload 2 files
Browse files- functions.json +59 -0
- my_functions.py +45 -0
functions.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"name": "get_product_name_by_PID",
|
| 4 |
+
"description": "Finds the name of a product by its Product ID.",
|
| 5 |
+
"module_path": "my_functions",
|
| 6 |
+
"func_name_in_module": "get_product_name_by_PID",
|
| 7 |
+
"parameters": {
|
| 8 |
+
"type": "object",
|
| 9 |
+
"properties": {
|
| 10 |
+
"PID": {
|
| 11 |
+
"type": "string"
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"required": ["PID"]
|
| 15 |
+
},
|
| 16 |
+
"example_usage": "```tool_code\nget_product_name_by_PID(PID=\"807ZPKBL9V\")\n```"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "get_stock_price",
|
| 20 |
+
"description": "Retrieves the latest stock price for a given ticker symbol using yfinance.",
|
| 21 |
+
"module_path": "my_functions",
|
| 22 |
+
"func_name_in_module": "get_stock_price",
|
| 23 |
+
"parameters": {
|
| 24 |
+
"type": "object",
|
| 25 |
+
"properties": {
|
| 26 |
+
"ticker": {
|
| 27 |
+
"type": "string"
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"required": ["ticker"]
|
| 31 |
+
},
|
| 32 |
+
"example_usage": "```tool_code\nget_stock_price(ticker=\"AAPL\")\n```"
|
| 33 |
+
},
|
| 34 |
+
|
| 35 |
+
// -------------------------------------------------
|
| 36 |
+
// μλ‘ μΆκ°ν MCO μν€ν
μ² λΆμ ν¨μ (μμ)
|
| 37 |
+
// -------------------------------------------------
|
| 38 |
+
{
|
| 39 |
+
"name": "analyze_mco_architecture",
|
| 40 |
+
"description": "MCO μν€ν
μ²(ν¨μ JSON + Python λͺ¨λ) ꡬ쑰λ₯Ό λΆμ λ° μμ½ν΄μ£Όλ ν¨μμ
λλ€.",
|
| 41 |
+
"module_path": "my_functions",
|
| 42 |
+
"func_name_in_module": "analyze_mco_architecture",
|
| 43 |
+
"parameters": {
|
| 44 |
+
"type": "object",
|
| 45 |
+
"properties": {
|
| 46 |
+
"framework_version": {
|
| 47 |
+
"type": "string",
|
| 48 |
+
"description": "νμ¬ MCO νλ μμν¬ λ²μ (μ: 'v2.0')"
|
| 49 |
+
},
|
| 50 |
+
"detail_level": {
|
| 51 |
+
"type": "number",
|
| 52 |
+
"description": "λΆμ μμΈλ (1~5 μ¬μ΄ μ μ)"
|
| 53 |
+
}
|
| 54 |
+
},
|
| 55 |
+
"required": ["framework_version"]
|
| 56 |
+
},
|
| 57 |
+
"example_usage": "```tool_code\nanalyze_mco_architecture(framework_version=\"v2.1\", detail_level=4)\n```"
|
| 58 |
+
}
|
| 59 |
+
]
|
my_functions.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import yfinance as yf
|
| 2 |
+
|
| 3 |
+
product_catalog = {
|
| 4 |
+
"807ZPKBL9V": "SuperWidget",
|
| 5 |
+
"1234567890": "MegaGadget"
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
def get_product_name_by_PID(PID: str) -> str:
|
| 9 |
+
"""
|
| 10 |
+
Finds the name of a product by its Product ID
|
| 11 |
+
"""
|
| 12 |
+
return product_catalog.get(PID, "Unknown product")
|
| 13 |
+
|
| 14 |
+
def get_stock_price(ticker: str) -> float:
|
| 15 |
+
"""
|
| 16 |
+
Retrieves the latest stock price for a given ticker using yfinance.
|
| 17 |
+
"""
|
| 18 |
+
stock = yf.Ticker(ticker)
|
| 19 |
+
data = stock.history(period="1d")
|
| 20 |
+
if not data.empty:
|
| 21 |
+
return data['Close'].iloc[-1]
|
| 22 |
+
return float('nan')
|
| 23 |
+
|
| 24 |
+
# ----------------------------------------------------
|
| 25 |
+
# μλ‘κ² μΆκ°λ MCO μν€ν
μ² λΆμμ© ν¨μ (μμ)
|
| 26 |
+
# ----------------------------------------------------
|
| 27 |
+
def analyze_mco_architecture(framework_version: str, detail_level: int = 3) -> str:
|
| 28 |
+
"""
|
| 29 |
+
MCO μν€ν
μ²(ν¨μ JSON + Python λͺ¨λ) ꡬ쑰λ₯Ό λΆμ λ° μμ½ν΄μ£Όλ ν¨μ.
|
| 30 |
+
framework_version: (μ: 'v2.1')
|
| 31 |
+
detail_level: λΆμ μμΈλ (1~5)
|
| 32 |
+
"""
|
| 33 |
+
if detail_level < 1:
|
| 34 |
+
detail_level = 1
|
| 35 |
+
elif detail_level > 5:
|
| 36 |
+
detail_level = 5
|
| 37 |
+
|
| 38 |
+
analysis = (
|
| 39 |
+
f"MCO μν€ν
μ²(λ²μ {framework_version}) λΆμ κ²°κ³Ό:\n"
|
| 40 |
+
f" - functions.jsonμ μ μλ ν¨μ λͺ©λ‘ νμΈ\n"
|
| 41 |
+
f" - Python λͺ¨λ({__file__})μμ ν¨μ ꡬν μ μ μ°κ²° νμΈ\n"
|
| 42 |
+
f" - detail_level={detail_level} κΈ°μ€μΌλ‘ μμ½ λ¦¬ν¬νΈ\n"
|
| 43 |
+
f"β» μ€μ λ‘λ νμμ λ°λΌ λ 볡μ‘ν λ‘μ§/νμΌ λΆμ λ± μν κ°λ₯."
|
| 44 |
+
)
|
| 45 |
+
return analysis
|