Created
January 13, 2024 02:01
-
-
Save iamaziz/546468b74ae5ed806ab74a5d800ce078 to your computer and use it in GitHub Desktop.
Trying out Agents/Tools with Arabic LLMs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# basedk on: https://github.com/joaomdmoura/crewAI#getting-started | |
from crewai import Agent, Task, Crew | |
from langchain_community.llms import Ollama | |
from langchain_community.tools import DuckDuckGoSearchRun | |
# -- model | |
# ollama_llm = Ollama(model="arabic_deepseek-llm") | |
# ollama_llm = Ollama(model="arabic_notux") | |
ollama_llm = Ollama(model="arabic_mixtral") | |
# ollama_llm = Ollama(model="arabic_deepseek-llm:67b") | |
# ollama_llm = Ollama(model="arabic_llama2:70b") | |
# -- tools | |
search_tool = DuckDuckGoSearchRun() | |
# Define your agents with roles and goals | |
researcher = Agent( | |
role='باحث ومحلل خبير', | |
goal='2024 كشف التطورات الحديثة في الذكاء الاصطناعي وعلوم البيانات في', | |
backstory="""أنت تعمل في مركز أبحاث تقني رائد. | |
خبرتك تكمن في تحديد الاتجاهات الناشئة. | |
لديك موهبة لتحليل البيانات المعقدة وتقديم | |
أفكار قابلة للتنفيذ.""", | |
verbose=True, | |
allow_delegation=False, | |
tools=[search_tool], | |
llm=ollama_llm # was defined above in the file | |
) | |
writer = Agent( | |
role='استراتيجي محتوى تقني', | |
goal='صياغة محتوى مقنع حول التقدم التقني', | |
backstory="""أنت استراتيجي محتوى مشهور، معروف ب | |
مقالاتك الفكرية والمشوقة. | |
أنت تحول المفاهيم المعقدة إلى سرد مقنع.""", | |
verbose=True, | |
allow_delegation=True, | |
llm=ollama_llm | |
) | |
# Create tasks for your agents | |
task1 = Task( | |
description="""أجرِ تحليلًا شاملاً لأحدث التطورات في مجال الذكاء الاصطناعي في عام 2024. | |
تحديد الاتجاهات الرئيسية والتقنيات الجديدة والتأثيرات المحتملة على الصناعة. | |
إجابتك النهائية يجب أن تكون تقرير تحليل كامل""", | |
agent=researcher | |
) | |
task2 = Task( | |
description="""باستخدام الأفكار المقدمة، اكتب مقالة محترفة | |
تسلط الضوء على أهم التطورات في مجال الذكاء الاصطناعي. | |
يجب أن تكون مشاركتك إعلامية ولكنها متاحة للجمهور الملم بالتكنولوجيا. | |
اجعلها تبدو رائعة، وتجنب الكلمات المعقدة حتى لا تبدو وكأنها ذكاء اصطناعي. | |
إجابتك النهائية يجب أن تكون مقالة كاملة تتكون من 4 فقرات على الأقل.""", | |
agent=writer | |
) | |
# Instantiate your crew with a sequential process | |
crew = Crew( | |
agents=[researcher, writer], | |
tasks=[task1, task2], | |
verbose=2, # You can set it to 1 or 2 to different logging levels | |
) | |
# Get your crew to work! | |
result = crew.kickoff() | |
print("######################") | |
print("your result is:") | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment