多模式的代理系統代表了人工智能領域的革命性進步,無縫地結合了多種數據類型(例如文本,圖像,音頻和視頻),這是一個統一的系統,可以顯著增強智能技術的能力。這些系統依賴於可以獨立處理,分析和綜合各種來源的信息的自主智能代理,從而促進對複雜情況的更深入,更細微的理解。
通過將多模式輸入與代理功能合併,這些系統可以實時動態適應不斷變化的環境和用戶交互,從而提供更敏感和智能的體驗。這種融合不僅提高了各個行業的運營效率,而且還提高了人類計算機的相互作用,從而使它們更加流暢,直覺和上下文意識。結果,將多模式的代理框架設置為重塑我們與技術互動和利用技術的方式,在跨部門的無數應用中推動創新。學習目標
> > data Science Blogathon的一部分。 Table of contentsAgentic AI systems with Image Analysis CapabilitiesBuilding a Multi-Modal Agentic System to Explain Stock Behavior From Stock Charts
> deepSeek-r1-distill-qwen-7b
展示了其有效處理複雜數學推理的能力。 除了其數學能力外,DeepSeek-R1-Distill-Qwen-7b在事實提問的任務上表現出色,在GPQA Diamond上得分為49.1%,在數學和事實推理能力之間取得了良好的平衡。
>我們將利用這一模型來解釋和找到公司股票行為背後的推理,從庫存圖表圖像中提取信息。
使用Ollama在Google Colab上使用Ollama實施
!pip install crewai crewai_tools !sudo apt update !sudo apt install -y pciutils !pip install langchain-ollama !curl -fsSL https://ollama.com/install.sh | sh !pip install ollama==0.4.2
import threading import subprocess import time def run_ollama_serve(): subprocess.Popen(["ollama", "serve"]) thread = threading.Thread(target=run_ollama_serve) thread.start() time.sleep(5)
!ollama pull deepseek-r1>步驟4。定義OpenAI API鍵和LLM模型
import os from crewai import Agent, Task, Crew, Process, LLM from crewai_tools import LlamaIndexTool from langchain_openai import ChatOpenAI from crewai_tools import VisionTool vision_tool = VisionTool() os.environ['OPENAI_API_KEY'] ='' os.environ["OPENAI_MODEL_NAME"] = "gpt-4o-mini" llm = LLM( model="ollama/deepseek-r1", )步驟5。定義代理,工作人員中的任務
def create_crew(image_url,image_url1): #Agent For EXTRACTNG INFORMATION FROM STOCK CHART stockchartexpert= Agent( role="STOCK CHART EXPERT", goal="Your goal is to EXTRACT INFORMATION FROM THE TWO GIVEN %s & %s stock charts correctly """%(image_url, image_url1), backstory="""You are a STOCK CHART expert""", verbose=True,tools=[vision_tool], allow_delegation=False ) #Agent For RESEARCH WHY THE STOCK BEHAVED IN A SPECIFIC WAY stockmarketexpert= Agent( role="STOCK BEHAVIOUR EXPERT", goal="""BASED ON THE PREVIOUSLY EXTRACTED INFORMATION ,RESEARCH ABOUT THE RECENT UPDATES OF THE TWO COMPANIES and EXPLAIN AND COMPARE IN SPECIFIC POINTS WHY THE STOCK BEHAVED THIS WAY . """, backstory="""You are a STOCK BEHAVIOUR EXPERT""", verbose=True, allow_delegation=False,llm = llm ) #Task For EXTRACTING INFORMATION FROM A STOCK CHART task1 = Task( description="""Your goal is to EXTRACT INFORMATION FROM THE GIVEN %s & %s stock chart correctly """%((image_url,image_url1)), expected_output="information in text format", agent=stockchartexpert, ) #Task For EXPLAINING WITH ENOUGH REASONINGS WHY THE STOCK BEHAVED IN A SPECIFIC WAY task2 = Task( description="""BASED ON THE PREVIOUSLY EXTRACTED INFORMATION ,RESEARCH ABOUT THE RECENT UPDATES OF THE TWO COMPANIES and EXPLAIN AND COMPARE IN SPECIFIC POINTS WHY THE STOCK BEHAVED THIS WAY.""", expected_output="Reasons behind stock behavior in BULLET POINTS", agent=stockmarketexpert ) #Define the crew based on the defined agents and tasks crew = Crew( agents=[stockchartexpert,stockmarketexpert], tasks=[task1,task2], verbose=True, # You can set it to 1 or 2 to different logging levels ) result = crew.kickoff() return result>步驟6。運行船員
text = create_crew("https://www.eqimg.com/images/2024/11182024-chart6-equitymaster.gif","https://www.eqimg.com/images/2024/03262024-chart4-equitymaster.gif") pprint(text)
最終輸出
Mamaearth's stock exhibited volatility during the year due to internal<br> challenges that led to significant price changes. These included unexpected<br> product launches and market controversies which caused both peaks and<br> troughs in the share price, resulting in an overall fluctuating trend.<br><br>On the other hand, Zomato demonstrated a generally upward trend in its share<br> price over the same period. This upward movement can be attributed to<br> expanding business operations, particularly with successful forays into<br> cities like Bengaluru and Pune, enhancing their market presence. However,<br> near the end of 2024, external factors such as a major scandal or regulatory<br> issues might have contributed to a temporary decline in share price despite<br> the overall positive trend.<br><br>In summary, Mamaearth's stock volatility stems from internal inconsistencies<br> and external controversies, while Zomato's upward trajectory is driven by<br> successful market expansion with minor setbacks due to external events.多模式代理系統的另一個示例,用於股票洞察
>讓我們檢查並比較另外兩家公司的股票圖表中的股價行為 - 欣喜若狂的食品工程和比卡吉食品國際有限公司。
text = create_crew("https://s3.tradingview.com/p/PuKVGTNm_mid.png","https://images.cnbctv18.com/uploads/2024/12/bikaji-dec12-2024-12-b639f48761fab044197b144a2f9be099.jpg?im=Resize,width=360,aspect=fit,type=normal") print(text)
從最終產出可以看出,代理系統對股票圖表中的股價行為進行了很好的分析,並比較了對比卡吉(Bikaji)持續性能的趨勢的詳盡解釋,與歡樂的食品公司的看漲模式相比。
以上是如何建立用於股票見解的多模式代理系統?的詳細內容。更多資訊請關注PHP中文網其他相關文章!