├── .env.example ├── .gitignore ├── README.md ├── _5_agentic_prompt_examples ├── evaluate_optimizer.py ├── helpers │ ├── async_run_llm.py │ ├── json_llm.py │ └── run_llm.py ├── orchestrator_workers.py ├── parallelization.py ├── prompt_chaining.py └── router.py ├── _agentops_example ├── .env └── groupchat.py ├── _create_first_agents ├── first_agents.py └── group_chat.py ├── _crewai_updates └── 0.83 │ ├── crewai_mem0.py │ ├── sample_knowledge.py │ └── search_mem0_tool.py ├── _fixingit ├── .env ├── agents.py ├── config.py ├── main.py ├── pdfsummary.py └── requirements.txt ├── _integrations ├── .env ├── README.md ├── airtable │ └── airtable.py ├── reddit │ ├── main.py │ ├── reddit.py │ └── reddit_classes.py └── youtube-summarizer │ ├── AudioTranscriber.py │ ├── AutoGenInteraction.py │ ├── YouTubeAudioDownloader.py │ └── main.py ├── _shorts_code ├── 01_pydantic_output.py └── 02_autogen_studio.py │ ├── my-app │ ├── alembic.ini │ ├── alembic │ │ ├── README │ │ ├── env.py │ │ ├── script.py.mako │ │ └── versions │ │ │ └── b96c1e242dd8_initial_schema.py │ └── autogen.db │ └── tictactoe.py ├── ai_agency_01_workout ├── .cache │ └── 41 │ │ └── cache.db ├── .env ├── README.md ├── agents.py ├── config.py ├── main.py ├── static │ └── main.css ├── system_messages.py └── templates │ └── index.html ├── ai_agency_02_lmstudio ├── README.md ├── example_01.py ├── example_02.py └── example_03.py ├── ai_agency_03_video_captions ├── .env ├── OAI_CONFIG_LIST.json ├── agents.py ├── captioned │ └── test.txt ├── config.py ├── functions.py ├── requirements.txt ├── templates │ └── index.html └── uploads │ └── upload.txt ├── ai_agency_04_youtube_service ├── .env ├── agents.py ├── config.py └── main.py ├── ai_agency_05_pdf ├── .env ├── main.py └── pdfsummary.py ├── ai_agency_06_meal_gym_planner ├── OAI_CONFIG_LIST.json ├── agentops.log ├── app.py ├── static │ └── css │ │ └── styles.css ├── templates │ ├── base.html │ ├── error.html │ ├── screen1.html │ ├── screen2.html │ ├── screen3.html │ ├── screen4.html │ └── workout_plan.html ├── workout_agents.py └── workout_plan.md ├── ai_agency_07_news_aggregator ├── .cache │ └── 41 │ │ └── cache.db ├── OAI_CONFIG_LIST.json ├── main.py └── news.md ├── ai_agency_08_checklistai ├── agents │ └── checklist_agent.py ├── app.py ├── checklist_flow │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ │ └── checklist_flow │ │ ├── __init__.py │ │ ├── crews │ │ ├── checklist_crew │ │ │ ├── checklist_crew.py │ │ │ └── config │ │ │ │ ├── agents.yaml │ │ │ │ └── tasks.yaml │ │ └── quote_crew │ │ │ ├── config │ │ │ ├── agents.yaml │ │ │ └── tasks.yaml │ │ │ └── quote_crew.py │ │ ├── main.py │ │ └── tools │ │ ├── __init__.py │ │ └── custom_tool.py ├── config.py ├── db │ └── models.py ├── email body flow.html ├── email_body.txt ├── migrations │ ├── README │ └── env.py ├── models │ └── __init__.py ├── requirements.txt ├── templates │ ├── base.html │ ├── checklists.html │ ├── create_checklist.html │ ├── index.html │ └── view_checklist.html └── utils │ ├── constants.py │ ├── db_helper.py │ ├── email_utils.py │ └── form_classes.py ├── ai_agency_09_movie_recommendation ├── .gitignore ├── README.md ├── _weaviate-docker │ └── docker-compose.yml ├── backend │ ├── app.py │ ├── movieflow │ │ ├── .gitignore │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── movieflow │ │ │ ├── __init__.py │ │ │ ├── crews │ │ │ └── poem_crew │ │ │ │ ├── config │ │ │ │ ├── agents.yaml │ │ │ │ └── tasks.yaml │ │ │ │ └── poem_crew.py │ │ │ ├── main.py │ │ │ └── tools │ │ │ ├── __init__.py │ │ │ └── custom_tool.py │ ├── movies.json │ ├── requirements.txt │ ├── weaviate_image_search.py │ ├── weaviate_search.py │ └── weaviate_setup.py ├── eslint.config.js ├── index.html ├── package-lock.json ├── package.json ├── postcss.config.js ├── public │ └── vite.svg ├── src │ ├── App.css │ ├── App.tsx │ ├── components │ │ ├── MovieCard.tsx │ │ ├── MovieGrid.tsx │ │ ├── MovieModal.tsx │ │ └── SearchBar.tsx │ ├── data │ │ └── sampleMovies.ts │ ├── index.css │ ├── main.tsx │ ├── types │ │ └── movie.ts │ └── vite-env.d.ts ├── tailwind.config.js ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.node.json └── vite.config.ts ├── ai_agency_09_powerpoint_ai ├── powerpoint.py └── pp_test.py ├── ai_snake_games ├── gemini_pro_1.5.py ├── gemma_7B.py ├── gpt-3.5-turbo.py ├── gpt-4.py ├── llama3.py ├── main.py ├── mistral.py ├── nous-hermes.py ├── phi3.py ├── qwen1.5.py └── wizardlm.py ├── autogen_agentbuilder ├── OAI_CONFIG_LIST ├── main.py └── utility.py ├── autogen_create_edit_software ├── OAI_CONFIG_LIST.json ├── README.md ├── backend_dir │ └── main.py └── main.py ├── autogen_functions ├── .env ├── autogen_function_example.py ├── autogen_function_example_decorators.py ├── autogen_function_planner.py ├── config │ └── OAI_CONFIG_LIST.json └── planning │ └── fetch_issues.py ├── autogen_gpt_vision ├── OAI_CONFIG_LIST.json └── autogen_vision.py ├── autogen_graphs ├── OAI_CONFIG_LIST.json ├── main.py └── test.md ├── autogen_human_interaction ├── OAI_CONFIG_LIST.json └── main.py ├── autogen_lmstudio_connection ├── OAI_CONFIG_LIST.json └── main.py ├── autogen_local_llm ├── CustomModelClient.py ├── OAI_CONFIG_LIST.json └── main.py ├── autogen_logging ├── OAI_CONFIG_LIST.json └── main.py ├── autogen_math_solving ├── OAI_CONFIG_LIST.json └── main.py ├── autogen_mem0 ├── .cache │ └── 41 │ │ └── cache.db ├── README.md └── bestbuy_basic.py ├── autogen_memgpt ├── .env ├── .idea │ ├── .gitignore │ ├── inspectionProfiles │ │ └── profiles_settings.xml │ ├── misc.xml │ └── modules.xml └── app.py ├── autogen_memgpt_lmstudio ├── .env └── autogen_memgpt_lmstudio.py ├── autogen_multiple_configs ├── .env ├── OAI_CONFIG_LIST.json ├── config_list_from_dotenv.py ├── config_list_from_json.py ├── config_list_openai_aoai.py ├── get_config_list.py └── txt │ ├── base_aoai.txt │ ├── base_openai.txt │ ├── key_aoai.txt │ └── key_openai.txt ├── autogen_rag_chroma ├── .cache │ └── 41 │ │ └── cache.db ├── OAI_CONFIG_LIST.json ├── README.md ├── rag_01.py └── tmp │ └── chromadb │ └── raw.githubusercontent.com_README.md_4ca99c20 ├── autogen_teaching ├── .env └── teachable_agents.py ├── autogen_text_to_video └── main.py ├── autogen_transcribe_video ├── .cache │ └── 41 │ │ └── cache.db ├── .env ├── functions.py ├── requirements.txt └── transcribe.py ├── autogen_updates_0_2_27 ├── OAI_CONFIG_LIST.json ├── code │ ├── home.html │ ├── index.html │ ├── script.js │ ├── style.css │ └── styles.css ├── dotnet-autogen.cs └── main.py ├── autogen_webscraping ├── OAI_CONFIG_LIST.json ├── package.json ├── requirements.txt ├── screenshot.js ├── screenshots │ ├── amazon.jpg │ └── publix.jpg └── vision_crawl.py ├── autogentest ├── .idea │ ├── .gitignore │ ├── inspectionProfiles │ │ └── profiles_settings.xml │ ├── misc.xml │ ├── modules.xml │ └── vcs.xml ├── OAI_CONFIG_LIST ├── code │ ├── classic_pong.py │ ├── countries.csv │ ├── get_country_data.py │ ├── newsletter.py │ ├── plot_countries.py │ ├── requirements.txt │ └── tictactoe.py ├── feedback │ ├── feedback.py │ ├── static │ │ └── styles.css │ ├── survey.py │ └── templates │ │ ├── admin.html │ │ ├── index.html │ │ └── thankyou.html ├── llama_lm_test.py ├── saas_customer_survey.py └── topten.py ├── crawl4ai ├── 01_first_crawl.py ├── 02_sequential.py ├── 03_quick_crawl.py └── crawl_crew │ ├── .gitignore │ ├── README.md │ ├── knowledge │ └── user_preference.txt │ ├── pyproject.toml │ └── src │ └── crawl_crew │ ├── __init__.py │ ├── config │ ├── agents.yaml │ └── tasks.yaml │ ├── crew.py │ ├── main.py │ └── tools │ ├── __init__.py │ └── custom_tool.py ├── crewai_docker_example ├── .gitignore ├── Dockerfile ├── README.md ├── pyproject.toml ├── requirements.txt └── src │ └── docker │ ├── __init__.py │ ├── config │ ├── agents.yaml │ └── tasks.yaml │ ├── crew.py │ ├── main.py │ ├── report.md │ └── tools │ ├── __init__.py │ └── custom_tool.py ├── crewai_first_flow ├── first_flow │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ │ └── first_flow │ │ ├── __init__.py │ │ ├── main.py │ │ └── tools │ │ ├── __init__.py │ │ └── custom_tool.py └── output │ ├── complete_guide.md │ └── guide_outline.json ├── crewai_flow_single_llm ├── README.md ├── single_llm │ ├── .gitignore │ ├── pyproject.toml │ └── src │ │ └── single_llm │ │ ├── __init__.py │ │ ├── main.py │ │ └── prompts.py ├── workout_plan.md └── workout_plan_google.md ├── crewai_flow_workout ├── .composio.lock ├── .env.example ├── README.md ├── agentops.log ├── crewai_flow.html └── work_out_flow │ ├── .gitignore │ ├── pyproject.toml │ └── src │ └── work_out_flow │ ├── .composio.lock │ ├── __init__.py │ ├── crews │ ├── research_crew │ │ ├── config │ │ │ ├── agents.yaml │ │ │ └── tasks.yaml │ │ └── research_crew.py │ └── summary_crew │ │ ├── config │ │ ├── agents.yaml │ │ └── tasks.yaml │ │ └── summary_crew.py │ └── main.py ├── crewai_google_calendar ├── .composio.lock ├── README.md └── google_crew │ ├── .gitignore │ ├── README.md │ ├── knowledge │ └── user_preference.txt │ ├── pyproject.toml │ └── src │ └── google_crew │ ├── __init__.py │ ├── config │ ├── agents.yaml │ └── tasks.yaml │ ├── crew.py │ ├── main.py │ └── tools │ ├── __init__.py │ └── custom_tool.py ├── crewai_infographic_creation ├── README.md ├── images_infographic_output │ ├── consistent_practice.png │ ├── immersion_learning.png │ ├── infographic_flow.png │ ├── motivation_mindset.png │ ├── multi_sensory_learning.png │ └── technology_based_learning.png ├── infographic_flow │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ │ └── infographic_flow │ │ ├── __init__.py │ │ ├── crews │ │ └── infographic_research_crew │ │ │ ├── config │ │ │ ├── agents.yaml │ │ │ └── tasks.yaml │ │ │ └── infographic_research_crew.py │ │ ├── main.py │ │ └── tools │ │ ├── __init__.py │ │ └── custom_tool.py └── main.py ├── crewai_listener_flow ├── .gitignore ├── README.md ├── poem.txt ├── pyproject.toml └── src │ └── crewai_listener_flow │ ├── __init__.py │ ├── crews │ └── poem_crew │ │ ├── __init__.py │ │ ├── config │ │ ├── agents.yaml │ │ └── tasks.yaml │ │ └── poem_crew.py │ ├── listeners │ ├── __init__.py │ └── my_custom_listener.py │ ├── main.py │ └── tools │ ├── __init__.py │ └── custom_tool.py ├── crewai_llamaindex_tools └── llamaindex_tools │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ └── llamaindex_tools │ ├── __init__.py │ ├── crews │ ├── math_crew │ │ ├── config │ │ │ ├── agents.yaml │ │ │ └── tasks.yaml │ │ └── crew.py │ ├── wikipedia_crew │ │ ├── config │ │ │ ├── agents.yaml │ │ │ └── tasks.yaml │ │ └── wikipedia_crew.py │ └── yahoo_crew │ │ ├── config │ │ ├── agents.yaml │ │ └── tasks.yaml │ │ └── yahoo_crew.py │ ├── main.py │ └── tools │ ├── __init__.py │ ├── math_function_tool.py │ └── wiki_tool.py ├── crewai_mem0 ├── .env.example ├── .gitignore ├── LICENSE.md ├── README.md ├── poetry.lock ├── pyproject.toml └── src │ ├── __init__.py │ ├── config │ ├── agents.yaml │ └── tasks.yaml │ ├── crew.py │ ├── main.py │ └── tools │ ├── __init__.py │ └── mem0_tool.py ├── crewai_series ├── .env.example ├── README.md ├── day_01.ipynb ├── day_01 │ ├── Dockerfile │ ├── config │ │ ├── agents.yaml │ │ └── tasks.yaml │ ├── main_crew.py │ ├── requirements.txt │ └── run_crew.py ├── day_02.ipynb ├── day_02 │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ │ └── day_02 │ │ ├── __init__.py │ │ ├── config │ │ ├── agents.yaml │ │ └── tasks.yaml │ │ ├── crew.py │ │ └── main.py ├── day_03.ipynb ├── day_03 │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ │ └── day_03 │ │ ├── __init__.py │ │ ├── config │ │ ├── agents.yaml │ │ └── tasks.yaml │ │ ├── crew.py │ │ ├── main.py │ │ └── report.md ├── day_04.ipynb ├── day_04 │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ │ └── day_04 │ │ ├── __init__.py │ │ ├── config │ │ ├── agents.yaml │ │ └── tasks.yaml │ │ ├── crew.py │ │ ├── main.py │ │ ├── report.md │ │ └── tools │ │ └── custom_tool.py ├── day_05.ipynb ├── day_05 │ ├── .gitignore │ ├── README.md │ ├── news │ │ └── news.md │ ├── pyproject.toml │ └── src │ │ └── day_05 │ │ ├── MyFlow.py │ │ ├── __init__.py │ │ ├── config │ │ ├── agents.yaml │ │ └── tasks.yaml │ │ ├── crew.py │ │ ├── main.py │ │ ├── my_flow_plot.html │ │ └── tools │ │ └── custom_tool.py ├── day_06 │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ │ └── day_06 │ │ ├── __init__.py │ │ ├── ainews │ │ ├── latest_news_on_generative_ai.md_20241011_135030.md │ │ └── news_articles.md_20241011_135326.md │ │ ├── config │ │ ├── agents.yaml │ │ ├── filewriter │ │ │ ├── agents.yaml │ │ │ └── tasks.yaml │ │ └── tasks.yaml │ │ ├── crew.py │ │ ├── file_writer_crew.py │ │ ├── main.py │ │ ├── tools │ │ ├── custom_file_writer_tool.py │ │ └── custom_tool.py │ │ └── workflow.py └── day_07 │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ └── day_07 │ ├── __init__.py │ ├── agentops.log │ ├── ainews │ ├── AI_News_Articles_20241017_150718.md │ └── generative_ai_news_20241017_145920.md │ ├── config │ ├── agents.yaml │ ├── filewriter │ │ ├── agents.yaml │ │ └── tasks.yaml │ └── tasks.yaml │ ├── crew.py │ ├── file_writer_crew.py │ ├── tools │ ├── custom_file_writer_tool.py │ └── custom_serper_dev_tool.py │ └── workflow.py ├── crewai_supabase ├── get_the_connection.py ├── knowledge │ └── table_info.txt ├── main.py └── supabase_tools │ ├── __init__.py │ ├── supabase_delete_row_tool.py │ ├── supabase_get_all_rows_tool.py │ ├── supabase_get_row_tool.py │ ├── supabase_insert_row_tool.py │ └── supabase_update_tool.py ├── crewai_tools_11 ├── CodeExamples │ └── bubble_sort.py ├── Financial Sample Data.csv ├── code_execution_tool.py ├── code_execution_tool_and_file_writer.py ├── csv_file_rag_search.py ├── docx_rag_search.py ├── exa_and_website_search.py ├── exa_search.py ├── images │ ├── airport.jpeg │ └── cats.jpg ├── json_rag_search.py ├── pdf │ └── AutoGen_Studio-12.pdf ├── pdf_docs_rag_Search.py ├── rag_dir │ ├── fake_alex.json │ ├── n8n.json │ └── user.docx ├── read_file.py ├── serper_dev.py └── vision_rag.py ├── google_drive_monitor └── google_drive_meetings │ ├── auth.py │ ├── credentials.json │ ├── downloads │ ├── EarningsCall.wav │ └── example_construction_contract.pdf │ ├── drive_monitor.py │ ├── googledrive │ ├── .env.example │ ├── .gitignore │ ├── README.md │ ├── agentops.log │ ├── pyproject.toml │ └── src │ │ └── googledrive │ │ ├── __init__.py │ │ ├── crews │ │ ├── contractmanagement │ │ │ ├── config │ │ │ │ ├── agents.yaml │ │ │ │ └── tasks.yaml │ │ │ └── contractmanagement.py │ │ └── meeting_minutes_crew │ │ │ ├── config │ │ │ ├── agents.yaml │ │ │ └── tasks.yaml │ │ │ └── meeting_minutes_crew.py │ │ ├── main.py │ │ └── tools │ │ ├── __init__.py │ │ └── custom_tool.py │ └── telegram_messaging.py ├── item_picker ├── .gitignore ├── README.md ├── knowledge │ └── user_preference.txt ├── pyproject.toml └── src │ └── item_picker │ ├── __init__.py │ ├── config │ ├── agents.yaml │ └── tasks.yaml │ ├── crew.py │ ├── main.py │ └── tools │ ├── __init__.py │ └── custom_tool.py ├── mcp_crewai ├── images │ ├── MCP_Diagram.png │ └── Model_Context_Protocol_Diagram.png ├── main.py └── servers │ └── image_server.py ├── n8n_crewai ├── app.py ├── deep_fried │ ├── .gitignore │ ├── README.md │ ├── pyproject.toml │ └── src │ │ └── deep_fried │ │ ├── __init__.py │ │ ├── crews │ │ └── deep_fried_crew │ │ │ ├── config │ │ │ ├── agents.yaml │ │ │ └── tasks.yaml │ │ │ └── deep_fried_crew.py │ │ ├── main.py │ │ └── tools │ │ ├── __init__.py │ │ └── custom_tool.py └── log.txt ├── openai_image_gen ├── README.md ├── image_editing.py ├── image_gen.py ├── image_inpainting.py ├── image_transparent_background.py ├── images_edit │ ├── bath-bomb.png │ ├── body-lotion.png │ ├── incense-kit.png │ └── soap.png ├── images_inpainting │ ├── mask.png │ └── sunlit_lounge.png ├── images_output │ ├── cat.png │ ├── composition.png │ ├── gift-basket.png │ └── image_gen1.png └── images_pixel_art_output │ ├── ClassicTopHat.png │ ├── Code Overview Diagram.png │ ├── Detailed Code Explanation.png │ ├── MagicWizardHat.png │ ├── QuirkyAnimalBeanie.png │ ├── WideBrimSunhat.png │ ├── Workflow Diagram.png │ ├── WornFarmersCap.png │ ├── cowboy_hat.png │ └── witch_hat.png ├── openai_sdk └── handoff_openai.py ├── openai_swarm ├── main.py ├── personal_shopper │ ├── application.db │ ├── database.py │ └── run.py └── weather_agent │ ├── agents.py │ └── run.py ├── pydanticai ├── hello-world.py └── web-scraper.py ├── repo_images ├── edit_software_after.png ├── edit_software_after_tests.png └── edit_software_before.png ├── requirements.txt ├── saas_products └── password │ ├── OAI_CONFIG_LIST │ └── password.py └── smolagents ├── 01 - first project.py ├── 02 - e2b.py ├── 03 - custom tool.py ├── 04 - gen image multiple tools.py ├── 05 - gradio image gen.py ├── 06 - any llm.py ├── 07 - import spaces.py ├── 08 - multi-agent framework.py ├── cat.png └── image.png /.env.example: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY= 2 | MEM0_API_KEY= 3 | 4 | SUPABASE_URL= 5 | SUPABASE_KEY= -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .venv/ 2 | .env 3 | .pyautogen/ 4 | autogen_rag_chroma/docs/ag_studio.pdf 5 | __pycache__ 6 | # Ignore all __pycache__ directories 7 | **/__pycache__/ 8 | .DS_Store 9 | .idea/ 10 | _integrations/youtube-summarizer/ 11 | crewai_series/ai.code-workspace 12 | ai_agency_08_checklistai/instance/checklists.db 13 | ai_agency_08_checklistai/migrations/alembic.ini 14 | ai_agency_08_checklistai/migrations/script.py.mako 15 | ai_agency_08_checklistai/migrations/versions/b1030fc3c9e7_add_checklistitem_model.py 16 | ai_agency_08_checklistai/migrations/versions/05fb2bd9e832_make_schedule_time_nullable.py 17 | ai_agency_08_checklistai/migrations/versions/d2881ce4c4cb_.py 18 | 19 | agentops.log 20 | .composio.lock/ 21 | 22 | venv/ -------------------------------------------------------------------------------- /_5_agentic_prompt_examples/helpers/async_run_llm.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from openai import AsyncOpenAI 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | client = AsyncOpenAI() 8 | 9 | async def run_llm_parallel(prompt, model): 10 | messages = [{"role": "user", "content": prompt}] 11 | response = await client.chat.completions.create( 12 | model=model, 13 | messages=messages 14 | ) 15 | 16 | return response.choices[0].message.content -------------------------------------------------------------------------------- /_5_agentic_prompt_examples/helpers/run_llm.py: -------------------------------------------------------------------------------- 1 | from openai import OpenAI 2 | from dotenv import load_dotenv 3 | import os 4 | 5 | load_dotenv() 6 | 7 | client = OpenAI() 8 | 9 | def run_llm(user_prompt : str, model : str, system_prompt : str = None): 10 | messages = [] 11 | if system_prompt: 12 | messages.append({"role": "system", "content": system_prompt}) 13 | 14 | messages.append({"role": "user", "content": user_prompt}) 15 | 16 | response = client.chat.completions.create( 17 | model=model, 18 | messages=messages 19 | ) 20 | 21 | return response.choices[0].message.content -------------------------------------------------------------------------------- /_5_agentic_prompt_examples/prompt_chaining.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from helpers.run_llm import run_llm 3 | 4 | def prompt_chain_workflow(input_query: str, prompt_chain : List[str]) -> List[str]: 5 | """Run a prompt chain of LLM calls to address the `input_query` 6 | using a list of prompts specified in `prompt_chain`. 7 | """ 8 | response_chain = [] 9 | response = input_query 10 | for i, prompt in enumerate(prompt_chain): 11 | print(f"Step {i+1}") 12 | response = run_llm(f"{prompt}\nInput:\n{response}", model='gpt-4o') 13 | response_chain.append(response) 14 | print(f"{response}\n") 15 | return response_chain 16 | 17 | question = "AI Agentic frameworks are the future, or is it?" 18 | 19 | prompt_chain = ["""Generate a sample speech, create a TED talk on the topic of 'The Future of AI Agents'.""", 20 | """Given the speech, ONLY talk about the action items for the audience to take away.""", 21 | """Given the speech, translate it into Dutch."""] 22 | 23 | responses = prompt_chain_workflow(question, prompt_chain) 24 | 25 | final_answer = responses[-1] -------------------------------------------------------------------------------- /_agentops_example/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-proj-1111 -------------------------------------------------------------------------------- /_create_first_agents/first_agents.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | 3 | config_list = [ 4 | { 5 | "model": "gpt-3.5-turbo", # or gpt-3.5-turbo 6 | "api_key": "sk-proj-1111" 7 | } 8 | ] 9 | 10 | user_proxy = autogen.UserProxyAgent( 11 | "user", 12 | code_execution_config={ 13 | "work_dir": "coding", 14 | "use_docker": False 15 | }, 16 | human_input_mode="TERMINATE", 17 | is_termination_msg=lambda msg: "TERMINATE" in msg["content"], 18 | ) 19 | 20 | engineer = autogen.AssistantAgent( 21 | "engineer", 22 | llm_config={ 23 | "config_list": config_list 24 | }, 25 | system_message="You are a 10x Python Engineer. You only code in Python. You create excellent front-end " 26 | "developer. Make sure to have # filename: .py as the first line after the triple tick marks. " 27 | "When you are done, reply with TERMINATE.", 28 | ) 29 | 30 | user_proxy.initiate_chat( 31 | engineer, 32 | message="""I want you to create two different python methods for me in 1 file. 1 will just generate a random 33 | number, and the other will take in a number and then reverse it. """) 34 | -------------------------------------------------------------------------------- /_crewai_updates/0.83/search_mem0_tool.py: -------------------------------------------------------------------------------- 1 | from crewai.tools import BaseTool 2 | from typing import Type 3 | from pydantic import BaseModel, Field 4 | from mem0 import MemoryClient 5 | 6 | client = MemoryClient(api_key="m0-sblhjtHFcj96vR7GAvPwQ5sVgY5J5pifrYrybXLA") 7 | 8 | class SearchMem0ToolInput(BaseModel): 9 | """Input schema for AirtableTool.""" 10 | query: str = Field(..., description="This is a query you want to search the memory store with.") 11 | 12 | class SearchMem0Tool(BaseTool): 13 | name: str = "SearchMem0Tool" 14 | description: str = ( 15 | "Clear description for what this tool is useful for, you agent will need this information to use it." 16 | ) 17 | args_schema: Type[BaseModel] = SearchMem0ToolInput 18 | 19 | def _run(self, query: str) -> str: 20 | result = client.search(query, user_id="tyler") 21 | return result 22 | -------------------------------------------------------------------------------- /_fixingit/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-proj-TuNXCKeMP4YBieoE2GQrT3BlbkFJvIid44Ap7E9DFOZ4K39t 2 | BASE_URL= 3 | MODEL=gpt-3.5-turbo -------------------------------------------------------------------------------- /_fixingit/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | config_list = [ 4 | { 5 | "api_key": os.getenv("OPENAI_API_KEY"), 6 | "model": os.getenv("MODEL"), 7 | "base_url": os.getenv("BASE_URL") 8 | } 9 | ] 10 | 11 | # set autogen user agent and assistant agent with function calling 12 | llm_config = { 13 | "timeout": 600, 14 | "seed": 42, 15 | "config_list": config_list, 16 | "temperature": 0, 17 | } -------------------------------------------------------------------------------- /_integrations/.env: -------------------------------------------------------------------------------- 1 | BASE_ID=1111 2 | API_KEY=1111 3 | OPENAI_API_KEY=sk-proj-1111 4 | CLIENT_ID=1111 5 | CLIENT_SECRET=1111 -------------------------------------------------------------------------------- /_integrations/README.md: -------------------------------------------------------------------------------- 1 | # **Autogen + Integrations** 2 | One thing I think is somewhat missing from Autogen is API Integration with other...well API's. This is something Langchain does well. But my goal is to add more than what they offer for some of these API's. 3 | 4 | ## Imports Needed: 5 | ### Airtable 6 | - pyautogen 7 | - pyairtable 8 | ### Reddit 9 | - pyautogen 10 | - praw (this stands for **Python Reddit API Wrapper**) 11 | 12 | ## .env 13 | - BASE_ID=airtable base id 14 | - API_KEY=airtable api key (may re-name this in future) 15 | - OPENAI_API_KEY=openai's api key 16 | - CLIENT_ID=the id after creating reddit app 17 | - CLIENT_SECRET=the secret after creating reddit app 18 | 19 | ## YouTube Link: 20 | - coming soon 21 | 22 | ## Updates: 23 | - 05/30/2024: Added Airtable Integration 24 | - 06/02/2024: Added Reddit Integration 25 | 26 | -------------------------------------------------------------------------------- /_integrations/youtube-summarizer/YouTubeAudioDownloader.py: -------------------------------------------------------------------------------- 1 | import yt_dlp 2 | import os 3 | 4 | 5 | class YouTubeAudioDownloader: 6 | def __init__(self, url, output_template='%(title)s [%(id)s].%(ext)s'): 7 | self.url = url 8 | self.ydl_opts = { 9 | 'format': 'bestaudio/best', 10 | 'outtmpl': output_template, 11 | 'postprocessors': [{ 12 | 'key': 'FFmpegExtractAudio', 13 | 'preferredcodec': 'm4a', 14 | }] 15 | } 16 | 17 | def download_audio(self): 18 | with yt_dlp.YoutubeDL(self.ydl_opts) as ydl: 19 | info_dict = ydl.extract_info(self.url, download=True) 20 | filename = ydl.prepare_filename(info_dict) 21 | return self.find_file_in_directory(filename) 22 | 23 | @staticmethod 24 | def find_file_in_directory(base_filename): 25 | base_name, _ = os.path.splitext(base_filename) 26 | for file in os.listdir('.'): 27 | if file.startswith(base_name): 28 | return file 29 | raise FileNotFoundError(f"The file {base_filename} does not exist in the current directory.") 30 | -------------------------------------------------------------------------------- /_integrations/youtube-summarizer/main.py: -------------------------------------------------------------------------------- 1 | import os 2 | from dotenv import load_dotenv 3 | 4 | from YouTubeAudioDownloader import YouTubeAudioDownloader 5 | from AudioTranscriber import AudioTranscriber 6 | from AutoGenInteraction import AutoGenInteraction 7 | 8 | load_dotenv() 9 | 10 | 11 | def main(): 12 | url = 'https://www.youtube.com/watch?v=WqIzUopTPvU' 13 | openai_api_key = os.getenv("OPENAI_API_KEY") 14 | 15 | # gives you the filename from yt video 16 | downloader = YouTubeAudioDownloader(url) 17 | filename = downloader.download_audio() 18 | print(f"Downloaded and saved audio (m4a) as: {filename}") 19 | 20 | # transcribes the audio 21 | transcriber = AudioTranscriber(api_key=openai_api_key) 22 | transcription = transcriber.transcribe_audio(filename) 23 | print("Transcription completed.") 24 | 25 | # ai agents summarize/translate 26 | autogen_interaction = AutoGenInteraction(api_key=openai_api_key, transcription=transcription) 27 | autogen_interaction.initiate_chat() 28 | print("Chat completed.") 29 | 30 | 31 | if __name__ == "__main__": 32 | main() 33 | -------------------------------------------------------------------------------- /_shorts_code/02_autogen_studio.py/my-app/alembic.ini: -------------------------------------------------------------------------------- 1 | [alembic] 2 | script_location = my-app/alembic 3 | sqlalchemy.url = sqlite:///my-app/autogen.db 4 | 5 | [loggers] 6 | keys = root,sqlalchemy,alembic 7 | 8 | [handlers] 9 | keys = console 10 | 11 | [formatters] 12 | keys = generic 13 | 14 | [logger_root] 15 | level = WARN 16 | handlers = console 17 | qualname = 18 | 19 | [logger_sqlalchemy] 20 | level = WARN 21 | handlers = 22 | qualname = sqlalchemy.engine 23 | 24 | [logger_alembic] 25 | level = INFO 26 | handlers = 27 | qualname = alembic 28 | 29 | [handler_console] 30 | class = StreamHandler 31 | args = (sys.stderr,) 32 | level = NOTSET 33 | formatter = generic 34 | 35 | [formatter_generic] 36 | format = %(levelname)-5.5s [%(name)s] %(message)s 37 | datefmt = %H:%M:%S -------------------------------------------------------------------------------- /_shorts_code/02_autogen_studio.py/my-app/alembic/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /_shorts_code/02_autogen_studio.py/my-app/alembic/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | from typing import Sequence, Union 9 | 10 | from alembic import op 11 | import sqlalchemy as sa 12 | import sqlmodel 13 | ${imports if imports else ""} 14 | 15 | # revision identifiers, used by Alembic. 16 | revision: str = ${repr(up_revision)} 17 | down_revision: Union[str, None] = ${repr(down_revision)} 18 | branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)} 19 | depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)} 20 | 21 | 22 | def upgrade() -> None: 23 | ${upgrades if upgrades else "pass"} 24 | 25 | 26 | def downgrade() -> None: 27 | ${downgrades if downgrades else "pass"} 28 | -------------------------------------------------------------------------------- /_shorts_code/02_autogen_studio.py/my-app/alembic/versions/b96c1e242dd8_initial_schema.py: -------------------------------------------------------------------------------- 1 | """Initial schema 2 | 3 | Revision ID: b96c1e242dd8 4 | Revises: 5 | Create Date: 2025-01-14 14:22:27.881915 6 | 7 | """ 8 | from typing import Sequence, Union 9 | 10 | from alembic import op 11 | import sqlalchemy as sa 12 | import sqlmodel 13 | 14 | 15 | # revision identifiers, used by Alembic. 16 | revision: str = 'b96c1e242dd8' 17 | down_revision: Union[str, None] = None 18 | branch_labels: Union[str, Sequence[str], None] = None 19 | depends_on: Union[str, Sequence[str], None] = None 20 | 21 | 22 | def upgrade() -> None: 23 | # ### commands auto generated by Alembic - please adjust! ### 24 | pass 25 | # ### end Alembic commands ### 26 | 27 | 28 | def downgrade() -> None: 29 | # ### commands auto generated by Alembic - please adjust! ### 30 | pass 31 | # ### end Alembic commands ### 32 | -------------------------------------------------------------------------------- /_shorts_code/02_autogen_studio.py/my-app/autogen.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/_shorts_code/02_autogen_studio.py/my-app/autogen.db -------------------------------------------------------------------------------- /ai_agency_01_workout/.cache/41/cache.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/ai_agency_01_workout/.cache/41/cache.db -------------------------------------------------------------------------------- /ai_agency_01_workout/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-1111 2 | base_url=http://localhost:1234/v1 3 | model_gpt_3.5_turbo=gpt-3.5-turbo 4 | model_gpt_4=gpt-4 -------------------------------------------------------------------------------- /ai_agency_01_workout/README.md: -------------------------------------------------------------------------------- 1 | # **Project** - Workout plan generator and .txt/.csv file saver 2 | ### You will learn to create a small team to build a simple workout plan, and then save a summarized version to a .txt file and a .csv file for export. 3 | ### Will also learn to separate the concerns into multiple files 4 | 5 | ## Current Library Versions: 6 | - autogen: 0.2.2 7 | 8 | ## Current Issues: 9 | - [ ] waiting for fix with LM Studio to allow function calls 10 | 11 | ## Updates 12 | - create a pull request if you would like to see updates to this project 13 | -------------------------------------------------------------------------------- /ai_agency_01_workout/agents.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | import config 3 | import system_messages 4 | 5 | user_proxy = autogen.UserProxyAgent( 6 | name="User_proxy", 7 | system_message=system_messages.user_proxy_message, 8 | human_input_mode="NEVER", 9 | max_consecutive_auto_reply=0, 10 | code_execution_config= { 11 | "work_dir": "code", 12 | "use_docker": False 13 | } 14 | ) 15 | 16 | fitness_expert = autogen.AssistantAgent( 17 | name=system_messages.fitness_expert_name, 18 | system_message=system_messages.fitness_expert_message, 19 | llm_config=config.llm_config, 20 | ) -------------------------------------------------------------------------------- /ai_agency_01_workout/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import dotenv 4 | 5 | dotenv.load_dotenv() 6 | 7 | SEED = 41 8 | 9 | config_list = [ 10 | { 11 | "model": os.getenv("model_gpt_4"), 12 | "api_key": os.getenv("OPENAI_API_KEY"), 13 | } 14 | ] 15 | 16 | # config_list = [ 17 | # { 18 | # "model": "NULL", 19 | # "base_url": os.getenv("base_url"), 20 | # "api_key": "NULL", 21 | # }, 22 | # ] 23 | 24 | llm_config = { 25 | "config_list": config_list, 26 | "seed": SEED 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /ai_agency_01_workout/static/main.css: -------------------------------------------------------------------------------- 1 | .scrollable{ 2 | overflow-y: auto; 3 | max-height: 300px; 4 | } 5 | 6 | body { 7 | display: flex; 8 | flex-direction: column; 9 | align-items: center; 10 | justify-content: center; 11 | height: 100vh; 12 | background: linear-gradient(to right, #ece9e6, #ffffff); 13 | 14 | } 15 | .container { 16 | text-align: center; 17 | } 18 | .form-group { 19 | display: flex; 20 | flex-wrap: wrap; 21 | justify-content: space-around; 22 | margin-top: 20px; 23 | } 24 | #prompt { 25 | width: 45%; /* Adjust the width as needed */ 26 | } 27 | #response { 28 | width: 45%; /* Adjust the width as needed */ 29 | } -------------------------------------------------------------------------------- /ai_agency_02_lmstudio/README.md: -------------------------------------------------------------------------------- 1 | # **Repository** - Direct connection to LM Studio with OpenAI API 2 | ### This will help you if you want just a direct connection to LM Studio for an AI Agent. 3 | 4 | ## Current Library Versions: 5 | - openai api: 1.6.1 6 | - lm studio: 0.2.10 -------------------------------------------------------------------------------- /ai_agency_02_lmstudio/example_01.py: -------------------------------------------------------------------------------- 1 | from openai import OpenAI 2 | 3 | client = OpenAI(base_url="http://localhost:1234/v1", api_key="not-needed") 4 | 5 | completion = client.chat.completions.create( 6 | model="local-model", 7 | messages=[ 8 | {"role": "system", "content": "You are a fitness expert."}, 9 | {"role": "user", "content": "I want you to create a single day workout for arms."} 10 | ], 11 | temperature=0.7, 12 | ) 13 | 14 | print(completion.choices[0].message.content) 15 | -------------------------------------------------------------------------------- /ai_agency_02_lmstudio/example_02.py: -------------------------------------------------------------------------------- 1 | from openai import OpenAI 2 | 3 | client = OpenAI(base_url="http://localhost:1234/v1", api_key="not-needed") 4 | 5 | history = [ 6 | {"role": "system", 7 | "content": "You are an intelligent assistant. You always provide well-reasoned answers that are both correct and " 8 | "helpful."}, 9 | {"role": "user", 10 | "content": "Hello, introduce yourself to someone opening this program for the first time. Be concise."}, 11 | ] 12 | 13 | while True: 14 | completion = client.chat.completions.create( 15 | model="local-model", 16 | messages=history, 17 | temperature=0.7, 18 | stream=True, 19 | ) 20 | 21 | new_message = {"role": "assistant", "content": ""} 22 | 23 | for chunk in completion: 24 | if chunk.choices[0].delta.content: 25 | print(chunk.choices[0].delta.content, end="", flush=True) 26 | new_message["content"] += chunk.choices[0].delta.content 27 | 28 | history.append(new_message) 29 | 30 | print() 31 | history.append({"role": "user", "content": input("> ")}) 32 | -------------------------------------------------------------------------------- /ai_agency_02_lmstudio/example_03.py: -------------------------------------------------------------------------------- 1 | from openai import OpenAI 2 | 3 | client = OpenAI(base_url="http://localhost:1234/v1", api_key="not-needed") 4 | 5 | 6 | def get_completion(prompt, model="local model", temperature=0.7): 7 | formatted_prompt = f"Hello! Please give me 3 words that rhyme with {prompt}" 8 | messages = [{"role": "user", "content": formatted_prompt}] 9 | print(f'\nYour prompt: {formatted_prompt}\n') 10 | 11 | completion = client.chat.completions.create( 12 | model=model, 13 | messages=messages, 14 | temperature=temperature 15 | ) 16 | 17 | return completion.choices[0].message 18 | 19 | 20 | prompt = input("Hello! Please give me 3 words that rhyme with... ") 21 | response = get_completion(prompt) 22 | print(f"LLM response: {response}") 23 | -------------------------------------------------------------------------------- /ai_agency_03_video_captions/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-1111 2 | model=gpt-4 3 | base_dir=/Users/tylerreed/PycharmProjects 4 | base_url=http://localhost:1234/v1 -------------------------------------------------------------------------------- /ai_agency_03_video_captions/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4", 4 | "api_key": "sk-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /ai_agency_03_video_captions/agents.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | import functions 3 | import config 4 | 5 | chatbot = autogen.AssistantAgent( 6 | name="chatbot", 7 | system_message=f"You are in charge of taking a video file and then caption it after" 8 | f"transcribing it.", 9 | llm_config=config.llm_config, 10 | ) 11 | 12 | user_proxy = autogen.UserProxyAgent( 13 | name="user_proxy", 14 | is_termination_msg=lambda x: x.get("content", "") and x.get("content", "").rstrip().endswith("TERMINATE"), 15 | human_input_mode="NEVER", 16 | max_consecutive_auto_reply=2, 17 | code_execution_config= { 18 | "work_dir": "code", 19 | "use_docker": False 20 | } 21 | ) 22 | 23 | user_proxy.register_function( 24 | function_map={ 25 | "recognize_transcript_from_video": functions.recognize_transcript_from_video, 26 | } 27 | ) 28 | -------------------------------------------------------------------------------- /ai_agency_03_video_captions/captioned/test.txt: -------------------------------------------------------------------------------- 1 | needed for folder -------------------------------------------------------------------------------- /ai_agency_03_video_captions/requirements.txt: -------------------------------------------------------------------------------- 1 | pyautogen 2 | flask 3 | whisper 4 | moviepy -------------------------------------------------------------------------------- /ai_agency_03_video_captions/uploads/upload.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/ai_agency_03_video_captions/uploads/upload.txt -------------------------------------------------------------------------------- /ai_agency_04_youtube_service/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-1111 2 | model_gpt_4=gpt-4 3 | base_url=http://localhost:1234/v1 -------------------------------------------------------------------------------- /ai_agency_04_youtube_service/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | import dotenv 3 | 4 | dotenv.load_dotenv() 5 | 6 | # config_list = [ 7 | # { 8 | # "model": os.getenv("model_gpt_4"), 9 | # "api_key": os.getenv("OPENAI_API_KEY"), 10 | # } 11 | # ] 12 | 13 | config_list = [ 14 | { 15 | "model": "NULL", 16 | "base_url": os.getenv("base_url"), 17 | "api_key": "NULL", 18 | }, 19 | ] 20 | 21 | llm_config = { 22 | "config_list": config_list, 23 | "timeout": 120, 24 | } 25 | -------------------------------------------------------------------------------- /ai_agency_05_pdf/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-1111 2 | BASE_URL=http://localhost:1234/v1 3 | AUTOGEN_USE_DOCKER=False 4 | TOKENIZERS_PARALLELISM=false -------------------------------------------------------------------------------- /ai_agency_06_meal_gym_planner/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4o", 4 | "api_key": "sk-proj-111-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /ai_agency_06_meal_gym_planner/agentops.log: -------------------------------------------------------------------------------- 1 | 2024-09-04 16:22:14,254 - INFO - Session Replay: https://app.agentops.ai/drilldown?session_id=7a39a939-d0cd-44ef-884e-526a76ff582b 2 | 2024-09-04 16:22:34,823 - INFO - This run's cost $0.000258 3 | 2024-09-04 16:22:34,823 - INFO - Session Replay: https://app.agentops.ai/drilldown?session_id=7a39a939-d0cd-44ef-884e-526a76ff582b 4 | -------------------------------------------------------------------------------- /ai_agency_06_meal_gym_planner/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Error 7 | 8 | 9 | 10 |
11 |

Oops! Something went wrong

12 |

{{ error_message }}

13 | Start Over 14 |
15 | 16 | -------------------------------------------------------------------------------- /ai_agency_07_news_aggregator/.cache/41/cache.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/ai_agency_07_news_aggregator/.cache/41/cache.db -------------------------------------------------------------------------------- /ai_agency_07_news_aggregator/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "lmstudio", 4 | "api_key": "sk-1111", 5 | "base_url": "http://localhost:1234/v1" 6 | }, 7 | { 8 | "model": "phi", 9 | "api_key": "sk-1111", 10 | "base_url": "http://localhost:11434/v1" 11 | }, 12 | { 13 | "model": "gpt-4o-2024-08-06", 14 | "api_key": "sk-1111", 15 | "tags": ["tool", "4o-tool"] 16 | } 17 | ] -------------------------------------------------------------------------------- /ai_agency_08_checklistai/agents/checklist_agent.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | from openai import OpenAI 3 | 4 | class MyChecklist(BaseModel): 5 | title: str 6 | items: list[str] 7 | 8 | class ChecklistAgent: 9 | def __init__(self, client: OpenAI): 10 | self.client = client 11 | 12 | def generate_checklist(self, prompt: str) -> MyChecklist: 13 | completion = self.client.beta.chat.completions.parse( 14 | model="gpt-4o-2024-08-06", 15 | messages=[ 16 | {"role": "system", "content": "Extract the checklist information."}, 17 | {"role": "user", "content": f"Create a checklist for: {prompt}. Give a fun title for the description of the checklist they provided."}, 18 | ], 19 | response_format=MyChecklist, 20 | ) 21 | return completion.choices[0].message.parsed 22 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "checklist_flow" 3 | version = "0.1.0" 4 | description = "checklist_flow using crewAI" 5 | authors = ["Your Name "] 6 | 7 | [tool.poetry.dependencies] 8 | python = ">=3.10,<=3.13" 9 | crewai = { extras = ["tools"], version = ">=0.70.1,<1.0.0" } 10 | asyncio = "*" 11 | 12 | [tool.poetry.scripts] 13 | checklist_flow = "checklist_flow.main:main" 14 | run_flow = "checklist_flow.main:main" 15 | plot_flow = "checklist_flow.main:plot" 16 | 17 | [build-system] 18 | requires = ["poetry-core"] 19 | build-backend = "poetry.core.masonry.api" 20 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/ai_agency_08_checklistai/checklist_flow/src/checklist_flow/__init__.py -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/crews/checklist_crew/checklist_crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from crewai.project import CrewBase, agent, crew, task 3 | 4 | @CrewBase 5 | class ChecklistCrew(): 6 | """Checklist Crew""" 7 | 8 | agents_config = 'config/agents.yaml' 9 | tasks_config = 'config/tasks.yaml' 10 | 11 | @agent 12 | def checklist_writer(self) -> Agent: 13 | return Agent( 14 | config=self.agents_config['checklist_writer'], 15 | ) 16 | 17 | @task 18 | def write_checklist(self) -> Task: 19 | return Task( 20 | config=self.tasks_config['write_checklist'], 21 | ) 22 | 23 | @crew 24 | def crew(self) -> Crew: 25 | """Creates the Checklist Crew""" 26 | return Crew( 27 | agents=self.agents, # Automatically created by the @agent decorator 28 | tasks=self.tasks, # Automatically created by the @task decorator 29 | process=Process.sequential, 30 | verbose=True, 31 | ) 32 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/crews/checklist_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | checklist_writer: 2 | role: > 3 | CrewAI Checklist Writer 4 | goal: > 5 | Based on the checklist given {checklist}, create an email body that is a list of the items in the checklist. 6 | This will be the body of an email, so format it nicely for the reader. 7 | 8 | Don't include any preamble or other text, just the body of the email. Also no subject. You may include emojis, and other formatting. 9 | backstory: > 10 | You are a helpful assistant that writes checklists and creates beautiful emails. -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/crews/checklist_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | write_checklist: 2 | description: > 3 | Write a checklist for a given task. 4 | Ensure the checklist is engaging and adheres to the checklist provided {checklist}. 5 | expected_output: > 6 | A beautifully crafted checklist formatted for an email. So, don't use markdown, make sure its formatted nicely like html for the email. 7 | agent: checklist_writer -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/crews/quote_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | quote_writer: 2 | role: > 3 | CrewAI Quote Writer 4 | goal: > 5 | You love to write quotes for emails. Based on the checklist, write a quote for the email. 6 | backstory: > 7 | You are a helpful assistant that generates quotes for emails. -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/crews/quote_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | write_quote: 2 | description: > 3 | Write a quote for a given checklist - {checklist}. 4 | expected_output: > 5 | A beautifully crafted quote formatted for an email. This can be a short quote or long quote from somebody famous, or even a made up quote. It should be formatted 6 | in HTML. 7 | agent: quote_writer -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/crews/quote_crew/quote_crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from crewai.project import CrewBase, agent, crew, task 3 | 4 | @CrewBase 5 | class QuoteCrew(): 6 | """Quote Crew""" 7 | 8 | agents_config = 'config/agents.yaml' 9 | tasks_config = 'config/tasks.yaml' 10 | 11 | @agent 12 | def quote_writer(self) -> Agent: 13 | return Agent( 14 | config=self.agents_config['quote_writer'], 15 | ) 16 | 17 | @task 18 | def write_quote(self) -> Task: 19 | return Task( 20 | config=self.tasks_config['write_quote'], 21 | ) 22 | 23 | @crew 24 | def crew(self) -> Crew: 25 | """Creates the Checklist Crew""" 26 | return Crew( 27 | agents=self.agents, # Automatically created by the @agent decorator 28 | tasks=self.tasks, # Automatically created by the @task decorator 29 | process=Process.sequential, 30 | verbose=True, 31 | ) 32 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/ai_agency_08_checklistai/checklist_flow/src/checklist_flow/tools/__init__.py -------------------------------------------------------------------------------- /ai_agency_08_checklistai/checklist_flow/src/checklist_flow/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import BaseTool 2 | 3 | 4 | class MyCustomTool(BaseTool): 5 | name: str = "Name of my tool" 6 | description: str = ( 7 | "Clear description for what this tool is useful for, you agent will need this information to use it." 8 | ) 9 | 10 | def _run(self, argument: str) -> str: 11 | # Implementation goes here 12 | return "this is an example of a tool output, ignore it and move along." 13 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | class Config: 4 | SECRET_KEY = os.environ.get('SECRET_KEY') or 'your_secret_key_here' 5 | SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///checklists.db' 6 | SQLALCHEMY_TRACK_MODIFICATIONS = False 7 | MAIL_SERVER = 'smtp.gmail.com' 8 | MAIL_PORT = 587 9 | MAIL_USE_TLS = True 10 | MAIL_USERNAME = os.environ.get('MAIL_USERNAME') or 'your_email@gmail.com' 11 | MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') or 'your_email_password' 12 | OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY') or 'your_openai_api_key_here' 13 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/db/models.py: -------------------------------------------------------------------------------- 1 | from flask_sqlalchemy import SQLAlchemy 2 | 3 | db = SQLAlchemy() 4 | 5 | class Checklist(db.Model): 6 | id = db.Column(db.Integer, primary_key=True) 7 | title = db.Column(db.String(100), nullable=False) 8 | schedule_time = db.Column(db.Time, nullable=True) 9 | recipients = db.Column(db.Text, nullable=False) 10 | items = db.relationship('ChecklistItem', back_populates='checklist', lazy=True, cascade='all, delete-orphan') 11 | 12 | class ChecklistItem(db.Model): 13 | id = db.Column(db.Integer, primary_key=True) 14 | checklist_id = db.Column(db.Integer, db.ForeignKey('checklist.id'), nullable=False) 15 | content = db.Column(db.String(200), nullable=False) 16 | checklist = db.relationship('Checklist', back_populates='items') 17 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/email_body.txt: -------------------------------------------------------------------------------- 1 | 2 |
3 |

Evening Checklist 🌙

4 |
    5 |
  • 🔌 Turn off all cameras.
  • 6 |
  • 🔋 Charge camera batteries.
  • 7 |
  • 💡 Turn off ring light.
  • 8 |
  • 🍽️ Have a snack before bed.
  • 9 |
  • 📏 Return everything back to its normal position.
  • 10 |
  • ❤️ Love you, babe!
  • 11 |
12 |
13 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/migrations/README: -------------------------------------------------------------------------------- 1 | Single-database configuration for Flask. 2 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/models/__init__.py: -------------------------------------------------------------------------------- 1 | from flask_sqlalchemy import SQLAlchemy 2 | 3 | db = SQLAlchemy() 4 | 5 | class Checklist(db.Model): 6 | id = db.Column(db.Integer, primary_key=True) 7 | title = db.Column(db.String(100), nullable=False) 8 | schedule_time = db.Column(db.Time, nullable=True) 9 | recipients = db.Column(db.Text, nullable=False) 10 | items = db.relationship('ChecklistItem', back_populates='checklist', lazy=True, cascade='all, delete-orphan') 11 | 12 | class ChecklistItem(db.Model): 13 | id = db.Column(db.Integer, primary_key=True) 14 | checklist_id = db.Column(db.Integer, db.ForeignKey('checklist.id'), nullable=False) 15 | content = db.Column(db.String(200), nullable=False) 16 | checklist = db.relationship('Checklist', back_populates='items') 17 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==2.3.2 2 | Flask-SQLAlchemy==3.0.3 3 | Flask-Migrate==4.0.4 4 | Flask-WTF==1.1.1 5 | Flask-Mail==0.9.1 6 | APScheduler==3.10.1 7 | email-validator==2.0.0.post2 8 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/utils/constants.py: -------------------------------------------------------------------------------- 1 | EXAMPLE_CHECKLISTS = { 2 | 'vacation': { 3 | 'title': 'Vacation Checklist', 4 | 'items': [ 5 | 'Pack clothes', 6 | 'Check passport', 7 | 'Book accommodations', 8 | 'Arrange transportation', 9 | 'Set up out-of-office email' 10 | ] 11 | }, 12 | 'nightly_routine': { 13 | 'title': 'Nightly Routine', 14 | 'items': [ 15 | 'Set out clothes for tomorrow', 16 | 'Brush teeth', 17 | 'Read for 30 minutes', 18 | 'Set alarm', 19 | 'Turn off electronics' 20 | ] 21 | }, 22 | 'work_from_home': { 23 | 'title': 'Work from Home Setup', 24 | 'items': [ 25 | 'Set up workspace', 26 | 'Check internet connection', 27 | 'Prepare to-do list', 28 | 'Schedule breaks', 29 | 'Ensure all necessary software is installed' 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ai_agency_08_checklistai/utils/form_classes.py: -------------------------------------------------------------------------------- 1 | from flask_wtf import FlaskForm 2 | from wtforms import StringField, TimeField, FieldList, FormField, HiddenField 3 | from wtforms.validators import DataRequired, Optional 4 | 5 | class ChecklistItemForm(FlaskForm): 6 | id = HiddenField('ID') 7 | item = StringField('Item', validators=[DataRequired()]) 8 | 9 | class ChecklistForm(FlaskForm): 10 | title = StringField('Title', validators=[DataRequired()]) 11 | schedule_time = TimeField('Schedule Time', validators=[Optional()]) 12 | recipients = StringField('Recipients (comma-separated emails)', validators=[DataRequired()]) 13 | items = FieldList(FormField(ChecklistItemForm), min_entries=1) 14 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/_weaviate-docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | weaviate: 4 | command: 5 | - --host 6 | - 0.0.0.0 7 | - --port 8 | - '8080' 9 | - --scheme 10 | - http 11 | image: cr.weaviate.io/semitechnologies/weaviate:1.27.6 12 | ports: 13 | - 8080:8080 14 | - 50051:50051 15 | volumes: 16 | - weaviate_data:/var/lib/weaviate 17 | restart: on-failure:0 18 | environment: 19 | CLIP_INFERENCE_API: 'http://multi2vec-clip:8080' 20 | QUERY_DEFAULTS_LIMIT: 25 21 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 22 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 23 | ENABLE_MODULES: 'multi2vec-clip' 24 | ENABLE_API_BASED_MODULES: 'true' 25 | CLUSTER_HOSTNAME: 'node1' 26 | multi2vec-clip: 27 | image: cr.weaviate.io/semitechnologies/multi2vec-clip:sentence-transformers-clip-ViT-B-32-multilingual-v1 28 | environment: 29 | ENABLE_CUDA: '0' 30 | volumes: 31 | weaviate_data: 32 | ... 33 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, jsonify 2 | from flask_cors import CORS 3 | 4 | from movieflow.src.movieflow.main import kickoff 5 | 6 | app = Flask(__name__) 7 | 8 | # Configure CORS properly 9 | CORS(app, resources={ 10 | r"/api/*": { 11 | "origins": ["http://localhost:5173"], 12 | "methods": ["POST", "OPTIONS"], 13 | "allow_headers": ["Content-Type"] 14 | } 15 | }) 16 | 17 | @app.route('/api/recommendations', methods=['POST']) 18 | def get_recommendations(): 19 | movies = kickoff(request_files=request.files, request_form=request.form) 20 | 21 | if movies is None: 22 | return jsonify({"error": "No valid input provided"}), 400 23 | 24 | return jsonify({"movies": movies}) 25 | 26 | if __name__ == '__main__': 27 | app.run(debug=True, port=5555) -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/movieflow/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/movieflow/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "movieflow" 3 | version = "0.1.0" 4 | description = "movieflow using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<=3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.83.0,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "movieflow.main:kickoff" 13 | plot = "movieflow.main:plot" 14 | 15 | [build-system] 16 | requires = ["hatchling"] 17 | build-backend = "hatchling.build" 18 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/movieflow/src/movieflow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/ai_agency_09_movie_recommendation/backend/movieflow/src/movieflow/__init__.py -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/movieflow/src/movieflow/crews/poem_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | poem_writer: 2 | role: > 3 | CrewAI Poem Writer 4 | goal: > 5 | Generate a funny, light heartedpoem about how CrewAI 6 | is awesome with a sentence count of {sentence_count} 7 | backstory: > 8 | You're a creative poet with a talent for capturing the essence of any topic 9 | in a beautiful and engaging way. Known for your ability to craft poems that 10 | resonate with readers, you bring a unique perspective and artistic flair to 11 | every piece you write. 12 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/movieflow/src/movieflow/crews/poem_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | write_poem: 2 | description: > 3 | Write a poem about how CrewAI is awesome. 4 | Ensure the poem is engaging and adheres to the specified sentence count of {sentence_count}. 5 | expected_output: > 6 | A beautifully crafted poem about CrewAI, with exactly {sentence_count} sentences. 7 | agent: poem_writer 8 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/movieflow/src/movieflow/crews/poem_crew/poem_crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from crewai.project import CrewBase, agent, crew, task 3 | 4 | @CrewBase 5 | class PoemCrew(): 6 | """Poem Crew""" 7 | 8 | agents_config = 'config/agents.yaml' 9 | tasks_config = 'config/tasks.yaml' 10 | 11 | @agent 12 | def poem_writer(self) -> Agent: 13 | return Agent( 14 | config=self.agents_config['poem_writer'], 15 | ) 16 | 17 | @task 18 | def write_poem(self) -> Task: 19 | return Task( 20 | config=self.tasks_config['write_poem'], 21 | ) 22 | 23 | @crew 24 | def crew(self) -> Crew: 25 | """Creates the Research Crew""" 26 | return Crew( 27 | agents=self.agents, # Automatically created by the @agent decorator 28 | tasks=self.tasks, # Automatically created by the @task decorator 29 | process=Process.sequential, 30 | verbose=True, 31 | ) 32 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/movieflow/src/movieflow/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/ai_agency_09_movie_recommendation/backend/movieflow/src/movieflow/tools/__init__.py -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/movieflow/src/movieflow/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from crewai.tools import BaseTool 4 | from pydantic import BaseModel, Field 5 | 6 | 7 | class MyCustomToolInput(BaseModel): 8 | """Input schema for MyCustomTool.""" 9 | 10 | argument: str = Field(..., description="Description of the argument.") 11 | 12 | 13 | class MyCustomTool(BaseTool): 14 | name: str = "Name of my tool" 15 | description: str = ( 16 | "Clear description for what this tool is useful for, you agent will need this information to use it." 17 | ) 18 | args_schema: Type[BaseModel] = MyCustomToolInput 19 | 20 | def _run(self, argument: str) -> str: 21 | # Implementation goes here 22 | return "this is an example of a tool output, ignore it and move along." 23 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/backend/requirements.txt: -------------------------------------------------------------------------------- 1 | flask==2.0.1 2 | flask-cors==3.0.10 -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/eslint.config.js: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import globals from 'globals'; 3 | import reactHooks from 'eslint-plugin-react-hooks'; 4 | import reactRefresh from 'eslint-plugin-react-refresh'; 5 | import tseslint from 'typescript-eslint'; 6 | 7 | export default tseslint.config( 8 | { ignores: ['dist'] }, 9 | { 10 | extends: [js.configs.recommended, ...tseslint.configs.recommended], 11 | files: ['**/*.{ts,tsx}'], 12 | languageOptions: { 13 | ecmaVersion: 2020, 14 | globals: globals.browser, 15 | }, 16 | plugins: { 17 | 'react-hooks': reactHooks, 18 | 'react-refresh': reactRefresh, 19 | }, 20 | rules: { 21 | ...reactHooks.configs.recommended.rules, 22 | 'react-refresh/only-export-components': [ 23 | 'warn', 24 | { allowConstantExport: true }, 25 | ], 26 | }, 27 | } 28 | ); 29 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React + TS 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-react-typescript-starter", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "vite build", 9 | "lint": "eslint .", 10 | "preview": "vite preview" 11 | }, 12 | "dependencies": { 13 | "lucide-react": "^0.344.0", 14 | "react": "^18.3.1", 15 | "react-dom": "^18.3.1" 16 | }, 17 | "devDependencies": { 18 | "@eslint/js": "^9.9.1", 19 | "@types/react": "^18.3.5", 20 | "@types/react-dom": "^18.3.0", 21 | "@vitejs/plugin-react": "^4.3.1", 22 | "autoprefixer": "^10.4.18", 23 | "eslint": "^9.9.1", 24 | "eslint-plugin-react-hooks": "^5.1.0-rc.0", 25 | "eslint-plugin-react-refresh": "^0.4.11", 26 | "globals": "^15.9.0", 27 | "postcss": "^8.4.35", 28 | "tailwindcss": "^3.4.1", 29 | "typescript": "^5.5.3", 30 | "typescript-eslint": "^8.3.0", 31 | "vite": "^5.4.2" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/src/App.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | color-scheme: dark; 7 | } 8 | 9 | body { 10 | background-color: #000000; 11 | color: #ffffff; 12 | } 13 | 14 | .container { 15 | max-width: 1200px; 16 | margin: 0 auto; 17 | } 18 | 19 | /* Add smooth hover transitions */ 20 | button { 21 | transition: all 0.2s ease-in-out; 22 | } 23 | 24 | button:hover { 25 | transform: translateY(-1px); 26 | box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1); 27 | } -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/src/components/MovieCard.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Movie } from '../types/movie'; 3 | 4 | interface MovieCardProps { 5 | movie: Movie; 6 | onSelect: (movie: Movie) => void; 7 | } 8 | 9 | export const MovieCard: React.FC = ({ movie, onSelect }) => { 10 | return ( 11 |
onSelect(movie)} 14 | > 15 | {movie.title} 20 |
21 |

{movie.title}

22 |

{movie.year}

23 |

Vote: {movie.voteAverage}

24 |
25 |
26 | ); 27 | }; -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/src/components/MovieGrid.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { MovieCard } from './MovieCard'; 3 | import { Movie } from '../types/movie'; 4 | 5 | interface MovieGridProps { 6 | movies: Movie[]; 7 | onSelectMovie: (movie: Movie) => void; 8 | } 9 | 10 | export const MovieGrid: React.FC = ({ movies, onSelectMovie }) => { 11 | return ( 12 |
13 | {movies.map((movie) => ( 14 | 19 | ))} 20 |
21 | ); 22 | }; -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/src/main.tsx: -------------------------------------------------------------------------------- 1 | import { StrictMode } from 'react'; 2 | import { createRoot } from 'react-dom/client'; 3 | import App from './App.tsx'; 4 | import './index.css'; 5 | 6 | createRoot(document.getElementById('root')!).render( 7 | 8 | 9 | 10 | ); 11 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/src/types/movie.ts: -------------------------------------------------------------------------------- 1 | export interface Movie { 2 | id: string; 3 | title: string; 4 | year: number; 5 | posterUrl: string; 6 | summary: string; 7 | voteAverage: number; 8 | } 9 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | export default { 3 | content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], 4 | theme: { 5 | extend: {}, 6 | }, 7 | plugins: [], 8 | }; 9 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "isolatedModules": true, 13 | "moduleDetection": "force", 14 | "noEmit": true, 15 | "jsx": "react-jsx", 16 | 17 | /* Linting */ 18 | "strict": true, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "noFallthroughCasesInSwitch": true 22 | }, 23 | "include": ["src"] 24 | } 25 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "lib": ["ES2023"], 5 | "module": "ESNext", 6 | "skipLibCheck": true, 7 | 8 | /* Bundler mode */ 9 | "moduleResolution": "bundler", 10 | "allowImportingTsExtensions": true, 11 | "isolatedModules": true, 12 | "moduleDetection": "force", 13 | "noEmit": true, 14 | 15 | /* Linting */ 16 | "strict": true, 17 | "noUnusedLocals": true, 18 | "noUnusedParameters": true, 19 | "noFallthroughCasesInSwitch": true 20 | }, 21 | "include": ["vite.config.ts"] 22 | } 23 | -------------------------------------------------------------------------------- /ai_agency_09_movie_recommendation/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import react from '@vitejs/plugin-react'; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | optimizeDeps: { 8 | exclude: ['lucide-react'], 9 | }, 10 | }); 11 | -------------------------------------------------------------------------------- /autogen_agentbuilder/OAI_CONFIG_LIST: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4-1106-preview", 4 | "api_key": "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" 5 | } 6 | ] -------------------------------------------------------------------------------- /autogen_create_edit_software/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4", 4 | "api_key": "sk-proj-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /autogen_create_edit_software/README.md: -------------------------------------------------------------------------------- 1 | # **Create and Edit Software** 2 | I think a realistic version of an AI Engineer is to also allow it to edit already existing code. You won't always be creating new code the way you want, and you will probably have to adhere to how existing code is written. 3 | 4 | ## Imports Needed: 5 | - pyautogen 6 | 7 | ## YouTube Link: 8 | - [Accelerate Software Creation with AI Agents: Quick Tutorial](https://youtu.be/tT-I0ImNcQ0) 9 | 10 | ## Updates: 11 | - 06/02/2024: Added README 12 | 13 | --- 14 | 15 | ### Before: 16 | ![Before](../repo_images/edit_software_before.png) 17 | 18 | --- 19 | 20 | ### After: 21 | ![After](../repo_images/edit_software_after.png) 22 | 23 | ### After With Tests: 24 | ![After](../repo_images/edit_software_after_tests.png) 25 | 26 | -------------------------------------------------------------------------------- /autogen_create_edit_software/backend_dir/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | import httpx 3 | 4 | app = FastAPI() 5 | 6 | 7 | @app.get("/fetch-todo") 8 | async def fetch_todo(): 9 | async with httpx.AsyncClient() as client: 10 | response = await client.get('') 11 | json_data = response.json() 12 | return json_data[:5] 13 | 14 | 15 | @app.get("/fetch-users") 16 | async def fetch_users(): 17 | async with httpx.AsyncClient() as client: 18 | response = await client.get('') 19 | json_data = response.json() 20 | return json_data 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /autogen_functions/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-1111 2 | model=gpt-4 -------------------------------------------------------------------------------- /autogen_functions/config/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-3.5-turbo", 4 | "api_key": "sk-1111" 5 | }, 6 | { 7 | "model": "gpt-4", 8 | "api_key": "sk-1111" 9 | } 10 | ] -------------------------------------------------------------------------------- /autogen_functions/planning/fetch_issues.py: -------------------------------------------------------------------------------- 1 | # filename: fetch_issues.py 2 | 3 | import requests 4 | import json 5 | 6 | 7 | def fetch_issues(): 8 | url = "https://api.github.com/repos/microsoft/FLAML/issues" 9 | params = { 10 | "state": "open", 11 | "labels": "good first issue" 12 | } 13 | response = requests.get(url, params=params) 14 | issues = response.json() 15 | for issue in issues: 16 | print(f"Issue ID: {issue['id']}, Title: {issue['title']}, URL: {issue['html_url']}") 17 | 18 | 19 | fetch_issues() 20 | -------------------------------------------------------------------------------- /autogen_gpt_vision/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4-vision-preview", 4 | "api_key": "sk-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /autogen_graphs/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "lmstudio", 4 | "api_key": "sk-1111", 5 | "base_url": "http://localhost:1234/v1" 6 | }, 7 | { 8 | "model": "phi", 9 | "api_key": "sk-1111", 10 | "base_url": "http://localhost:11434/v1" 11 | }, 12 | { 13 | "model": "gpt-4", 14 | "api_key": "sk-1111" 15 | } 16 | ] -------------------------------------------------------------------------------- /autogen_human_interaction/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "lmstudio", 4 | "api_key": "sk-1111", 5 | "base_url": "http://localhost:1234/v1" 6 | }, 7 | { 8 | "model": "phi", 9 | "api_key": "sk-1111", 10 | "base_url": "http://localhost:11434/v1" 11 | }, 12 | { 13 | "model": "gpt-3.5-turbo", 14 | "api_key": "sk-1111" 15 | } 16 | ] -------------------------------------------------------------------------------- /autogen_lmstudio_connection/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "phi", 4 | "api_key": "lm-studio", 5 | "base_url": "http://localhost:1234/v1" 6 | } 7 | ] -------------------------------------------------------------------------------- /autogen_lmstudio_connection/main.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | 3 | 4 | def main(): 5 | config_list = autogen.config_list_from_json(env_or_file="OAI_CONFIG_LIST.json") 6 | 7 | # Create the agent that uses the LLM. 8 | assistant = autogen.AssistantAgent("assistant", llm_config={"config_list": config_list}) 9 | 10 | # Create the agent that represents the user in the conversation. 11 | user_proxy = autogen.UserProxyAgent("user_proxy", 12 | code_execution_config={"work_dir": "coding", "use_docker": False}) 13 | 14 | user_proxy.initiate_chat(assistant, message="Generate a function that acts like the 8 Ball with random phrases.") 15 | 16 | 17 | if __name__ == "__main__": 18 | main() 19 | -------------------------------------------------------------------------------- /autogen_local_llm/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "stabilityai/stable-code-3b", 4 | "model_client_cls": "CustomModelClient", 5 | "model-card": "stable-code-3b-Q5_K_M.gguf", 6 | "device": "cpu", 7 | "n": 1, 8 | "params": { 9 | "max_length": 1000 10 | } 11 | } 12 | ] -------------------------------------------------------------------------------- /autogen_local_llm/main.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | import CustomModelClient as cmc 3 | from autogen import AssistantAgent, UserProxyAgent 4 | 5 | config_list_custom = autogen.config_list_from_json( 6 | "OAI_CONFIG_LIST.json", 7 | filter_dict={"model_client_cls": ["CustomModelClient"]}, 8 | ) 9 | 10 | assistant = AssistantAgent("assistant", llm_config={"config_list": config_list_custom}) 11 | user_proxy = UserProxyAgent( 12 | "user_proxy", 13 | code_execution_config={ 14 | "work_dir": "coding", 15 | "use_docker": False 16 | } 17 | ) 18 | 19 | assistant.register_model_client(model_client_cls=cmc.CustomModelClient) 20 | 21 | user_proxy.initiate_chat(assistant, message="Write python code to print Hello World!") 22 | 23 | -------------------------------------------------------------------------------- /autogen_logging/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-3.5-turbo", 4 | "api_key": "sk-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /autogen_math_solving/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-3.5-turbo", 4 | "api_key": "sk-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /autogen_math_solving/main.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | from autogen.agentchat.contrib.math_user_proxy_agent import MathUserProxyAgent 3 | 4 | # configuration 5 | config_list = autogen.config_list_from_json( 6 | "OAI_CONFIG_LIST.json", 7 | ) 8 | 9 | llm_config = { 10 | "timeout": 600, 11 | "seed": 42, 12 | "config_list": config_list, 13 | } 14 | 15 | # create assistants 16 | assistant = autogen.AssistantAgent( 17 | name="assistant", 18 | system_message="You are a helpful assistant.", 19 | llm_config=llm_config 20 | ) 21 | 22 | 23 | math_proxy_agent = MathUserProxyAgent( 24 | name="math_proxy_agent", 25 | human_input_mode="NEVER", 26 | code_execution_config={"use_docker": False}, 27 | ) 28 | 29 | # the math problem and initiate chat 30 | # math_problem = ( 31 | # """ 32 | # Find all $x$ that satisfy the inequality $(2x+10)(x+3)<(3x+9)(x+8)$. 33 | # Express your answer in interval notation. 34 | # """ 35 | # ) 36 | 37 | math_problem = "Problem: If $725x + 727y = 1500$ and $729x+ 731y = 1508$, what is the value of $x - y$ ?" 38 | math_proxy_agent.initiate_chat(assistant, problem=math_problem) 39 | -------------------------------------------------------------------------------- /autogen_mem0/.cache/41/cache.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/autogen_mem0/.cache/41/cache.db -------------------------------------------------------------------------------- /autogen_memgpt/.env: -------------------------------------------------------------------------------- 1 | model=gpt-4 2 | api_key=sk-your-api-key 3 | use_memgpt=True -------------------------------------------------------------------------------- /autogen_memgpt/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /autogen_memgpt/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /autogen_memgpt/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /autogen_memgpt/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /autogen_memgpt_lmstudio/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-11111 2 | LLM_BACKEND=openai 3 | # LLM_BACKEND = "azure" 4 | # LLM_BACKEND = "local" 5 | api_base=http://localhost:1234/v1 6 | model_endpoint_type=openai 7 | model_endpoint=https://api.openai.com/v1 8 | model=gpt-3.5-turbo 9 | use_memgpt=False -------------------------------------------------------------------------------- /autogen_multiple_configs/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-openai-11111 2 | ANOTHER_API_KEY=sk-another-api-key -------------------------------------------------------------------------------- /autogen_multiple_configs/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4", 4 | "api_key": "GPT-4 API KEY", 5 | "api_base": "https://api.gpt4.com" 6 | }, 7 | { 8 | "model": "gpt-3.5-turbo", 9 | "api_key": "GPT-3.5 API KEY", 10 | "api_version": "2023-03-01", 11 | "api_base": "https://api.someotherapi.com" 12 | } 13 | ] -------------------------------------------------------------------------------- /autogen_multiple_configs/config_list_from_dotenv.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | 3 | config_list = autogen.config_list_from_dotenv( 4 | dotenv_file_path='.env', 5 | model_api_key_map={ 6 | "gpt-4": "OPENAI_API_KEY", 7 | "gpt-3.5-turbo": { 8 | "api_key_env_var": "ANOTHER_API_KEY", 9 | "api_type": "openai", 10 | "api_version": "v4", 11 | "api_base": "http://someapi.com" 12 | } 13 | }, 14 | filter_dict={ 15 | "model": { 16 | "gpt-3.5-turbo" 17 | } 18 | } 19 | ) 20 | 21 | print(config_list) 22 | -------------------------------------------------------------------------------- /autogen_multiple_configs/config_list_from_json.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | 3 | cheap_config_list = autogen.config_list_from_json( 4 | env_or_file="OAI_CONFIG_LIST.json", 5 | filter_dict={ 6 | "model": { 7 | "gpt-3.5-turbo", 8 | } 9 | } 10 | ) 11 | 12 | costly_config_list = autogen.config_list_from_json( 13 | env_or_file="OAI_CONFIG_LIST.json", 14 | filter_dict={ 15 | "model": { 16 | "gpt-4", 17 | } 18 | } 19 | ) 20 | 21 | # Assistant using GPT 3.5 Turbo 22 | assistant_one = autogen.AssistantAgent( 23 | name="3.5-assistant", 24 | llm_config={ 25 | "timeout": 600, 26 | "cache_seed": 42, 27 | "config_list": cheap_config_list, 28 | "temperature": 0, 29 | }, 30 | ) 31 | 32 | # Assistant using GPT 4 33 | assistant_two = autogen.AssistantAgent( 34 | name="4-assistant", 35 | llm_config={ 36 | "timeout": 600, 37 | "cache_seed": 42, 38 | "config_list": costly_config_list, 39 | "temperature": 0, 40 | }, 41 | ) 42 | 43 | print(costly_config_list) 44 | -------------------------------------------------------------------------------- /autogen_multiple_configs/config_list_openai_aoai.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | 3 | config_list = autogen.config_list_openai_aoai( 4 | key_file_path=".", 5 | openai_api_key_file="/txt/key_openai.txt", 6 | aoai_api_key_file="/txt/key_aoai.txt", 7 | openai_api_base_file="/txt/base_openai.txt", 8 | aoai_api_base_file="/txt/base_aoai.txt", 9 | exclude='aoai' 10 | ) 11 | 12 | print(config_list) 13 | -------------------------------------------------------------------------------- /autogen_multiple_configs/get_config_list.py: -------------------------------------------------------------------------------- 1 | import autogen 2 | 3 | api_keys = ["SAMPLE_API_KEY"] 4 | base_urls = ["http://localhost:8001"] 5 | api_type = "openai" 6 | api_version = "api-preview-01" 7 | 8 | config_list = autogen.get_config_list( 9 | api_keys, 10 | base_urls, 11 | api_type, 12 | api_version 13 | ) 14 | 15 | print(config_list) 16 | -------------------------------------------------------------------------------- /autogen_multiple_configs/txt/base_aoai.txt: -------------------------------------------------------------------------------- 1 | http://base_azure:8001 -------------------------------------------------------------------------------- /autogen_multiple_configs/txt/base_openai.txt: -------------------------------------------------------------------------------- 1 | http://localhost:1234/v1 -------------------------------------------------------------------------------- /autogen_multiple_configs/txt/key_aoai.txt: -------------------------------------------------------------------------------- 1 | SAMPLE_AZURE_API_KEY -------------------------------------------------------------------------------- /autogen_multiple_configs/txt/key_openai.txt: -------------------------------------------------------------------------------- 1 | sk-11112341234 -------------------------------------------------------------------------------- /autogen_rag_chroma/.cache/41/cache.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/autogen_rag_chroma/.cache/41/cache.db -------------------------------------------------------------------------------- /autogen_rag_chroma/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "lmstudio", 4 | "api_key": "sk-1111", 5 | "base_url": "http://localhost:1234/v1" 6 | }, 7 | { 8 | "model": "phi", 9 | "api_key": "sk-1111", 10 | "base_url": "http://localhost:11434/v1" 11 | }, 12 | { 13 | "model": "gpt-4o", 14 | "api_key": "sk-proj-1111" 15 | } 16 | ] -------------------------------------------------------------------------------- /autogen_teaching/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-proj-1111 2 | TOKENIZERS_PARALLELISM=false 3 | MODEL=gpt-3.5-turbo -------------------------------------------------------------------------------- /autogen_text_to_video/main.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import cv2 3 | from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler 4 | from diffusers.utils import export_to_video 5 | 6 | # pipe = DiffusionPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16, variant="fp16") 7 | # pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) 8 | # pipe.enable_model_cpu_offload() 9 | 10 | # prompt = "Spiderman is surfing" 11 | # video_frames = pipe(prompt, num_inference_steps=25).frames 12 | # video_path = export_to_video(video_frames) 13 | 14 | pipe = DiffusionPipeline.from_pretrained("ali-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16) 15 | pipe.enable_model_cpu_offload() 16 | 17 | # memory optimization 18 | pipe.unet.enable_forward_chunking(chunk_size=1, dim=1) 19 | pipe.enable_vae_slicing() 20 | 21 | # prompt = "spiderman surfing a wave" 22 | # video_frames = pipe(prompt, num_frames=24).frames[0] 23 | 24 | prompt = "a cat surfing a wave" 25 | video_frames = pipe(prompt, num_frames=100).frames[0] 26 | 27 | video_path = export_to_video(video_frames, fps=30, output_video_path="vid1.mp4") 28 | 29 | 30 | # UPSCALE THIS AS WELL -------------------------------------------------------------------------------- /autogen_transcribe_video/.cache/41/cache.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/autogen_transcribe_video/.cache/41/cache.db -------------------------------------------------------------------------------- /autogen_transcribe_video/.env: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=sk-1111 2 | model=gpt-4 -------------------------------------------------------------------------------- /autogen_transcribe_video/requirements.txt: -------------------------------------------------------------------------------- 1 | pyautogen 2 | openai-whisper 3 | openai 4 | moviepy -------------------------------------------------------------------------------- /autogen_updates_0_2_27/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4", 4 | "api_key": "sk-proj-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /autogen_updates_0_2_27/code/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Welcome to the Home Page

11 | 12 | 13 | -------------------------------------------------------------------------------- /autogen_updates_0_2_27/code/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Welcome to the Homepage!

9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autogen_updates_0_2_27/code/script.js: -------------------------------------------------------------------------------- 1 | // filename: script.js 2 | 3 | window.onload = function() { 4 | document.getElementById("helloButton").onclick = function() { 5 | alert("Hello!"); 6 | } 7 | }; -------------------------------------------------------------------------------- /autogen_updates_0_2_27/code/style.css: -------------------------------------------------------------------------------- 1 | /* filename: style.css */ 2 | 3 | body { 4 | background-color: lightblue; 5 | } 6 | 7 | h1 { 8 | color: white; 9 | text-align: center; 10 | } 11 | 12 | #helloButton { 13 | display: block; 14 | width: 200px; 15 | height: 50px; 16 | margin: 20px auto; 17 | background-color: #4CAF50; 18 | color: white; 19 | padding: 14px 28px; 20 | font-size: 16px; 21 | cursor: pointer; 22 | text-align: center; 23 | } -------------------------------------------------------------------------------- /autogen_updates_0_2_27/code/styles.css: -------------------------------------------------------------------------------- 1 | # filename: styles.css 2 | body { 3 | background-color: lightblue; 4 | } 5 | 6 | h1 { 7 | color: white; 8 | text-align: center; 9 | } 10 | 11 | #my_button { 12 | display: block; 13 | width: 200px; 14 | height: 50px; 15 | margin: 20px auto; 16 | background-color: #4CAF50; 17 | color: white; 18 | text-align: center; 19 | line-height: 50px; 20 | font-size: 20px; 21 | cursor: pointer; 22 | } -------------------------------------------------------------------------------- /autogen_updates_0_2_27/dotnet-autogen.cs: -------------------------------------------------------------------------------- 1 | using AutoGen; 2 | using AutoGen.Core; 3 | using AutoGen.OpenAI; 4 | 5 | 6 | var openAIKey = "your-api-key"; 7 | var gpt35Config = new OpenAIConfig(openAIKey, "gpt-3.5-turbo"); 8 | 9 | var assistantAgent = new AssistantAgent( 10 | name: "assistant", 11 | systemMessage: "You are an assistant that help user to do some tasks.", 12 | llmConfig: new ConversableAgentConfig 13 | { 14 | Temperature = 0, 15 | ConfigList = [gpt35Config], 16 | }) 17 | .RegisterPrintMessage(); // register a hook to print message nicely to console 18 | 19 | // set human input mode to ALWAYS so that user always provide input 20 | var userProxyAgent = new UserProxyAgent( 21 | name: "user", 22 | humanInputMode: HumanInputMode.ALWAYS) 23 | .RegisterPrintMessage(); 24 | 25 | // start the conversation 26 | await userProxyAgent.InitiateChatAsync( 27 | receiver: assistantAgent, 28 | message: "Hey assistant, please do me a favor.", 29 | maxRound: 10); 30 | -------------------------------------------------------------------------------- /autogen_webscraping/OAI_CONFIG_LIST.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4-vision-preview", 4 | "api_key": "sk-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /autogen_webscraping/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "puppet_test", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "screenshot.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "puppeteer": "^21.6.0", 13 | "puppeteer-extra": "^3.3.6", 14 | "puppeteer-extra-plugin-stealth": "^2.11.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /autogen_webscraping/requirements.txt: -------------------------------------------------------------------------------- 1 | pyautogen 2 | -------------------------------------------------------------------------------- /autogen_webscraping/screenshot.js: -------------------------------------------------------------------------------- 1 | const puppeteer = require('puppeteer'); 2 | 3 | const url = process.argv[2]; 4 | const ss = process.argv[3]; 5 | const fullPath = `${ss}` 6 | const timeout = 75000; 7 | 8 | (async () => { 9 | const browser = await puppeteer.launch( { 10 | headless: "new", 11 | } ); 12 | 13 | const page = await browser.newPage(); 14 | 15 | await page.setViewport( { 16 | width: 1920, 17 | height: 1080, 18 | deviceScaleFactor: 1, 19 | } ); 20 | 21 | await page.goto( url, { 22 | waitUntil: "networkidle0", 23 | timeout: timeout, 24 | } ); 25 | 26 | await page.screenshot( { 27 | path: fullPath, 28 | fullPage: true, 29 | } ); 30 | 31 | await browser.close(); 32 | })(); 33 | -------------------------------------------------------------------------------- /autogen_webscraping/screenshots/amazon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/autogen_webscraping/screenshots/amazon.jpg -------------------------------------------------------------------------------- /autogen_webscraping/screenshots/publix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/autogen_webscraping/screenshots/publix.jpg -------------------------------------------------------------------------------- /autogentest/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /autogentest/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /autogentest/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /autogentest/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /autogentest/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /autogentest/OAI_CONFIG_LIST: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-4", 4 | "api_key": "sk-1111" 5 | } 6 | ] -------------------------------------------------------------------------------- /autogentest/code/get_country_data.py: -------------------------------------------------------------------------------- 1 | # filename: get_country_data.py 2 | 3 | import requests 4 | import pandas as pd 5 | 6 | # Send a GET request to the REST Countries API 7 | response = requests.get("https://restcountries.com/v2/all") 8 | 9 | # The response is a list of dictionaries 10 | data = response.json() 11 | 12 | # We're interested in the name and area (land mass) 13 | countries = [] 14 | areas = [] 15 | for country_data in data: 16 | country_name = country_data.get('name') 17 | 18 | # Check if 'area' exists in the dictionary 19 | if 'area' in country_data: 20 | area = country_data.get('area') 21 | else: 22 | area = None # Use None if the area is not available 23 | 24 | # Append the data to the respective list 25 | countries.append(country_name) 26 | areas.append(area) 27 | 28 | # Create a DataFrame 29 | df = pd.DataFrame({ 30 | 'Country': countries, 31 | 'Land_Mass': areas 32 | }) 33 | 34 | # Save the DataFrame in a CSV file 35 | df.to_csv('countries.csv', index=False) -------------------------------------------------------------------------------- /autogentest/code/plot_countries.py: -------------------------------------------------------------------------------- 1 | # filename: plot_countries.py 2 | 3 | import pandas as pd 4 | import matplotlib.pyplot as plt 5 | 6 | # Read countries and land masses from a CSV file. 7 | data = pd.read_csv('countries.csv') 8 | 9 | # Convert 'Land_Mass' to numeric, this will convert 'None' to 'NaN' 10 | data['Land_Mass'] = pd.to_numeric(data['Land_Mass'], errors='coerce') 11 | 12 | # Sort countries by land mass in descending order 13 | # This will omit the countries with 'NaN' area 14 | data_sorted = data.sort_values('Land_Mass', ascending=False) 15 | 16 | # Select the top 10 countries with the largest land mass 17 | top_10 = data_sorted.head(10) 18 | 19 | # Plot a horizontal bar chart 20 | plt.barh(top_10['Country'], top_10['Land_Mass'], color='blue') 21 | plt.xlabel('Land Mass') 22 | plt.ylabel('Country') 23 | plt.title('Top 10 Countries by Land Mass') 24 | plt.gca().invert_yaxis() 25 | plt.show() -------------------------------------------------------------------------------- /autogentest/code/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==1.1.2 2 | requests==2.25.1 3 | beautifulsoup4==4.9.3 4 | APScheduler==3.7.0 5 | smtplib==3.9.0 6 | -------------------------------------------------------------------------------- /autogentest/feedback/static/styles.css: -------------------------------------------------------------------------------- 1 | .container { 2 | max-width: 600px; 3 | margin: 0 auto; 4 | padding: 20px; 5 | text-align: center; 6 | } 7 | 8 | h1 { 9 | color: #333; 10 | } 11 | 12 | form { 13 | margin-top: 20px; 14 | } 15 | 16 | table { 17 | border-collapse: collapse; 18 | width: 100%; 19 | } 20 | 21 | th, td { 22 | border: 1px solid #333; 23 | padding: 8px; 24 | text-align: left; 25 | } -------------------------------------------------------------------------------- /autogentest/feedback/templates/admin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Admin 5 | 6 | 7 | 8 |
9 |

Feedback Records

10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {% for record in feedback %} 19 | 20 | 21 | 22 | 23 | {% endfor %} 24 | 25 |
IDExperience
{{ record[0] }}{{ record[1] }}
26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /autogentest/feedback/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Feedback Form 5 | 6 | 7 | 8 |
9 |

Feedback Form

10 |
11 |
12 | 13 | 18 |
19 | 20 |
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /autogentest/feedback/templates/thankyou.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Thank You 5 | 6 | 7 | 8 |
9 |

Thank You!

10 |

Thank you for your feedback.

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /autogentest/topten.py: -------------------------------------------------------------------------------- 1 | from autogen import AssistantAgent, UserProxyAgent, config_list_from_json 2 | 3 | config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST") 4 | 5 | assistant = AssistantAgent( 6 | name="assistant", 7 | llm_config={"config_list": config_list} 8 | ) 9 | 10 | user_proxy = UserProxyAgent( 11 | name="user_proxy", 12 | code_execution_config={ 13 | "work_dir": "code" 14 | } 15 | ) 16 | 17 | user_proxy.initiate_chat(assistant, message="Write to a python file the code to plot a chart of the top 10 countries by land mass.") -------------------------------------------------------------------------------- /crawl4ai/01_first_crawl.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from crawl4ai import AsyncWebCrawler 3 | 4 | async def main(): 5 | # Create an instance of AsyncWebCrawler 6 | async with AsyncWebCrawler() as crawler: 7 | # Run the crawler on a URL 8 | result = await crawler.arun(url="https://crawl4ai.com") 9 | 10 | # Print the extracted content 11 | print(result.markdown) 12 | 13 | # Run the async main function 14 | asyncio.run(main()) -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/knowledge/user_preference.txt: -------------------------------------------------------------------------------- 1 | User name is John Doe. 2 | User is an AI Engineer. 3 | User is interested in AI Agents. 4 | User is based in San Francisco, California. 5 | -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "crawl_crew" 3 | version = "0.1.0" 4 | description = "crawl_crew using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.102.0,<1.0.0" 9 | ] 10 | 11 | [project.scripts] 12 | crawl_crew = "crawl_crew.main:run" 13 | run_crew = "crawl_crew.main:run" 14 | train = "crawl_crew.main:train" 15 | replay = "crawl_crew.main:replay" 16 | test = "crawl_crew.main:test" 17 | 18 | [build-system] 19 | requires = ["hatchling"] 20 | build-backend = "hatchling.build" 21 | 22 | [tool.crewai] 23 | type = "crew" 24 | -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/src/crawl_crew/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crawl4ai/crawl_crew/src/crawl_crew/__init__.py -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/src/crawl_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | Crawl Expert 4 | goal: > 5 | Crawl a sitemap and return a list of URLs, and this is the sitemap url: {sitemap_url} 6 | backstory: > 7 | You're a seasoned url crawler. You're known for your ability to crawl a sitemap and return the data. -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/src/crawl_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Give a well written summary of the crawled results. 4 | expected_output: > 5 | Give a concise and brief summary of the crawled results. 6 | 7 | Include the following information: 8 | - important information found 9 | - any other relevant information 10 | agent: researcher 11 | -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/src/crawl_crew/crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from crewai.project import CrewBase, agent, crew, task 3 | from tools.custom_tool import MyCustomTool 4 | from dotenv import load_dotenv 5 | 6 | load_dotenv() 7 | 8 | @CrewBase 9 | class CrawlCrew(): 10 | """CrawlCrew crew""" 11 | 12 | agents_config = 'config/agents.yaml' 13 | tasks_config = 'config/tasks.yaml' 14 | 15 | @agent 16 | def researcher(self) -> Agent: 17 | return Agent( 18 | config=self.agents_config['researcher'], 19 | verbose=True, 20 | tools=[MyCustomTool()] 21 | ) 22 | 23 | 24 | @task 25 | def research_task(self) -> Task: 26 | return Task( 27 | config=self.tasks_config['research_task'], 28 | ) 29 | 30 | @crew 31 | def crew(self) -> Crew: 32 | """Creates the CrawlCrew crew""" 33 | 34 | return Crew( 35 | agents=self.agents, # Automatically created by the @agent decorator 36 | tasks=self.tasks, # Automatically created by the @task decorator 37 | process=Process.sequential, 38 | verbose=True, 39 | # process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/ 40 | ) 41 | -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/src/crawl_crew/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import warnings 4 | 5 | from datetime import datetime 6 | 7 | from crew import CrawlCrew 8 | 9 | warnings.filterwarnings("ignore", category=SyntaxWarning, module="pysbd") 10 | 11 | def run(): 12 | """ 13 | Run the crew. 14 | """ 15 | inputs = { 16 | 'sitemap_url': 'https://docs.crewai.com/sitemap.xml' 17 | } 18 | 19 | try: 20 | CrawlCrew().crew().kickoff(inputs=inputs) 21 | except Exception as e: 22 | raise Exception(f"An error occurred while running the crew: {e}") 23 | 24 | run() -------------------------------------------------------------------------------- /crawl4ai/crawl_crew/src/crawl_crew/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crawl4ai/crawl_crew/src/crawl_crew/tools/__init__.py -------------------------------------------------------------------------------- /crewai_docker_example/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /crewai_docker_example/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use Python 3.11.9 as base image 2 | FROM python:3.11.9-slim 3 | 4 | # Set the working directory in the container 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container 8 | COPY . /app 9 | 10 | # Install dependencies from requirements.txt 11 | RUN pip install --no-cache-dir -r requirements.txt 12 | 13 | # Copy the .env file if it’s used for environment variables 14 | COPY .env .env 15 | 16 | # Run the application 17 | CMD ["python", "src/docker/main.py"] -------------------------------------------------------------------------------- /crewai_docker_example/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "docker" 3 | version = "0.1.0" 4 | description = "docker using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<=3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.76.9,<1.0.0" 9 | ] 10 | 11 | [project.scripts] 12 | docker = "docker.main:run" 13 | run_crew = "docker.main:run" 14 | train = "docker.main:train" 15 | replay = "docker.main:replay" 16 | test = "docker.main:test" 17 | 18 | [build-system] 19 | requires = ["hatchling"] 20 | build-backend = "hatchling.build" 21 | -------------------------------------------------------------------------------- /crewai_docker_example/requirements.txt: -------------------------------------------------------------------------------- 1 | crewai 2 | crewai[tools] -------------------------------------------------------------------------------- /crewai_docker_example/src/docker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_docker_example/src/docker/__init__.py -------------------------------------------------------------------------------- /crewai_docker_example/src/docker/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior Data Researcher 4 | goal: > 5 | Uncover cutting-edge developments in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | 11 | reporting_analyst: 12 | role: > 13 | {topic} Reporting Analyst 14 | goal: > 15 | Create detailed reports based on {topic} data analysis and research findings 16 | backstory: > 17 | You're a meticulous analyst with a keen eye for detail. You're known for 18 | your ability to turn complex data into clear and concise reports, making 19 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /crewai_docker_example/src/docker/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Conduct a thorough research about {topic} 4 | Make sure you find any interesting and relevant information given 5 | the current year is 2024. 6 | expected_output: > 7 | A list with 10 bullet points of the most relevant information about {topic} 8 | agent: researcher 9 | 10 | reporting_task: 11 | description: > 12 | Review the context you got and expand each topic into a full section for a report. 13 | Make sure the report is detailed and contains any and all relevant information. 14 | expected_output: > 15 | A fully fledge reports with the mains topics, each with a full section of information. 16 | Formatted as markdown without '```' 17 | agent: reporting_analyst 18 | -------------------------------------------------------------------------------- /crewai_docker_example/src/docker/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | from crew import DockerCrew 4 | 5 | # This main file is intended to be a way for you to run your 6 | # crew locally, so refrain from adding unnecessary logic into this file. 7 | # Replace with inputs you want to test with, it will automatically 8 | # interpolate any tasks and agents information 9 | 10 | def run(): 11 | """ 12 | Run the crew. 13 | """ 14 | inputs = { 15 | 'topic': 'AI LLMs' 16 | } 17 | DockerCrew().crew().kickoff(inputs=inputs) 18 | 19 | if __name__ == "__main__": 20 | run() 21 | -------------------------------------------------------------------------------- /crewai_docker_example/src/docker/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_docker_example/src/docker/tools/__init__.py -------------------------------------------------------------------------------- /crewai_docker_example/src/docker/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | from crewai_tools import BaseTool 3 | from pydantic import BaseModel, Field 4 | 5 | class MyCustomToolInput(BaseModel): 6 | """Input schema for MyCustomTool.""" 7 | argument: str = Field(..., description="Description of the argument.") 8 | 9 | class MyCustomTool(BaseTool): 10 | name: str = "Name of my tool" 11 | description: str = ( 12 | "Clear description for what this tool is useful for, you agent will need this information to use it." 13 | ) 14 | args_schema: Type[BaseModel] = MyCustomToolInput 15 | 16 | def _run(self, argument: str) -> str: 17 | # Implementation goes here 18 | return "this is an example of a tool output, ignore it and move along." 19 | -------------------------------------------------------------------------------- /crewai_first_flow/first_flow/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /crewai_first_flow/first_flow/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "first_flow" 3 | version = "0.1.0" 4 | description = "first_flow using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.114.0,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "first_flow.main:kickoff" 13 | run_crew = "first_flow.main:kickoff" 14 | plot = "first_flow.main:plot" 15 | 16 | [build-system] 17 | requires = ["hatchling"] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.crewai] 21 | type = "flow" 22 | -------------------------------------------------------------------------------- /crewai_first_flow/first_flow/src/first_flow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_first_flow/first_flow/src/first_flow/__init__.py -------------------------------------------------------------------------------- /crewai_first_flow/first_flow/src/first_flow/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_first_flow/first_flow/src/first_flow/tools/__init__.py -------------------------------------------------------------------------------- /crewai_first_flow/first_flow/src/first_flow/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from crewai.tools import BaseTool 4 | from pydantic import BaseModel, Field 5 | 6 | 7 | class MyCustomToolInput(BaseModel): 8 | """Input schema for MyCustomTool.""" 9 | 10 | argument: str = Field(..., description="Description of the argument.") 11 | 12 | 13 | class MyCustomTool(BaseTool): 14 | name: str = "Name of my tool" 15 | description: str = ( 16 | "Clear description for what this tool is useful for, your agent will need this information to use it." 17 | ) 18 | args_schema: Type[BaseModel] = MyCustomToolInput 19 | 20 | def _run(self, argument: str) -> str: 21 | # Implementation goes here 22 | return "this is an example of a tool output, ignore it and move along." 23 | -------------------------------------------------------------------------------- /crewai_flow_single_llm/single_llm/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /crewai_flow_single_llm/single_llm/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "single_llm" 3 | version = "0.1.0" 4 | description = "single_llm using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.114.0,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "single_llm.main:kickoff" 13 | run_crew = "single_llm.main:kickoff" 14 | plot = "single_llm.main:plot" 15 | 16 | [build-system] 17 | requires = ["hatchling"] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.crewai] 21 | type = "flow" 22 | -------------------------------------------------------------------------------- /crewai_flow_single_llm/single_llm/src/single_llm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_flow_single_llm/single_llm/src/single_llm/__init__.py -------------------------------------------------------------------------------- /crewai_flow_single_llm/single_llm/src/single_llm/prompts.py: -------------------------------------------------------------------------------- 1 | def create_workout_plan_prompt(wake_up_time, bedtime, workout_active, run): 2 | messages = [ 3 | {"role": "system", "content": "You are a helpful assistant designed to output workout plans."}, 4 | {"role": "user", "content": f""" 5 | Create a workout plan for a day based on the following information: 6 | - Wake up time: {wake_up_time} 7 | - Bedtime: {bedtime} 8 | - Workout active: {workout_active} 9 | - Run: {run} 10 | 11 | Only return the workout plan, nothing else. 12 | """} 13 | ] 14 | 15 | return messages -------------------------------------------------------------------------------- /crewai_flow_single_llm/workout_plan.md: -------------------------------------------------------------------------------- 1 | # Daily Workout Plan 2 | 3 | **Day's Workout Plan:** 4 | 5 | 5:15 AM - Pre-workout warm-up 6 | - 5 minutes of light stretching 7 | - 5 minutes of dynamic warm-up (e.g., high knees, arm circles) 8 | 9 | 5:25 AM - Run 10 | - Run 1 mile at a comfortable pace 11 | 12 | 5:45 AM - Cool down 13 | - 10 minutes of cool-down stretching focusing on legs and back 14 | 15 | 6:00 AM - Breakfast 16 | 17 | **Evening Workout:** 18 | *Since you are active twice a week, on those days add strength training* - 19 | 5:30 PM - Strength Training Session (30 minutes) 20 | - Circuit workout: 21 | - Push-ups: 3 sets of 10 reps 22 | - Bodyweight squats: 3 sets of 15 reps 23 | - Plank: 3 sets holding for 30 seconds 24 | - Dumbbell rows (if available): 3 sets of 10 reps each side 25 | - Walking lunges: 3 sets of 10 reps each leg 26 | 27 | 6:15 PM - Post-workout stretching (10 minutes) 28 | 29 | 7:00 PM - Dinner 30 | 31 | 9:00 PM - Bedtime -------------------------------------------------------------------------------- /crewai_flow_workout/.composio.lock: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /crewai_flow_workout/.env.example: -------------------------------------------------------------------------------- 1 | COMPOSIO_API_KEY=ws... 2 | OPENAI_API_KEY=sk-... 3 | -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "work_out_flow" 3 | version = "0.1.0" 4 | description = "work_out_flow using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.114.0,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "work_out_flow.main:kickoff" 13 | run_crew = "work_out_flow.main:kickoff" 14 | plot = "work_out_flow.main:plot" 15 | 16 | [build-system] 17 | requires = ["hatchling"] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.crewai] 21 | type = "flow" 22 | -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/src/work_out_flow/.composio.lock: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/src/work_out_flow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_flow_workout/work_out_flow/src/work_out_flow/__init__.py -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/src/work_out_flow/crews/research_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | research_agent: 2 | role: > 3 | CrewAI Research Agent 4 | goal: > 5 | Research the internet for information about workouts. Should include HIIT, strength and cardio workouts. 6 | backstory: > 7 | You're a research agent with a talent for researching the internet for information about workouts. -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/src/work_out_flow/crews/research_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Research the internet for information about workouts. Use the tools to research, crawl and scrape the internet for information about workouts. 4 | expected_output: > 5 | Full research about about the best workouts for the user and the links that were scraped. 6 | agent: research_agent 7 | -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/src/work_out_flow/crews/summary_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | summary_agent: 2 | role: > 3 | CrewAI Summary Agent 4 | goal: > 5 | Summarize the information about workouts from the research: {research} 6 | backstory: > 7 | You're a summary agent with a talent for summarizing the internet for information about workouts 8 | in a beautiful and engaging way. Known for your ability to craft summaries that 9 | resonate with readers, you bring a unique perspective and artistic flair to 10 | every piece you write. 11 | -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/src/work_out_flow/crews/summary_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | summary_task: 2 | description: > 3 | Summarize the internet for information about workouts from the research: {research} 4 | expected_output: > 5 | A beautifully crafted summary about workouts from the research: {research} 6 | agent: summary_agent 7 | -------------------------------------------------------------------------------- /crewai_flow_workout/work_out_flow/src/work_out_flow/crews/summary_crew/summary_crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from crewai.project import CrewBase, agent, crew, task 3 | 4 | from dotenv import load_dotenv 5 | 6 | load_dotenv() 7 | 8 | @CrewBase 9 | class SummaryCrew: 10 | """Summary Crew""" 11 | 12 | agents_config = "config/agents.yaml" 13 | tasks_config = "config/tasks.yaml" 14 | 15 | @agent 16 | def summary_agent(self) -> Agent: 17 | return Agent( 18 | config=self.agents_config["summary_agent"], 19 | ) 20 | 21 | @task 22 | def summary_task(self) -> Task: 23 | return Task( 24 | config=self.tasks_config["summary_task"], 25 | ) 26 | 27 | @crew 28 | def crew(self) -> Crew: 29 | """Creates the Summary Crew""" 30 | 31 | return Crew( 32 | agents=self.agents, # Automatically created by the @agent decorator 33 | tasks=self.tasks, # Automatically created by the @task decorator 34 | process=Process.sequential, 35 | verbose=True, 36 | ) 37 | -------------------------------------------------------------------------------- /crewai_google_calendar/.composio.lock: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /crewai_google_calendar/google_crew/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /crewai_google_calendar/google_crew/knowledge/user_preference.txt: -------------------------------------------------------------------------------- 1 | User name is John Doe. 2 | User is an AI Engineer. 3 | User is interested in AI Agents. 4 | User is based in San Francisco, California. 5 | -------------------------------------------------------------------------------- /crewai_google_calendar/google_crew/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "google_crew" 3 | version = "0.1.0" 4 | description = "google_crew using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.114.0,<1.0.0" 9 | ] 10 | 11 | [project.scripts] 12 | google_crew = "google_crew.main:run" 13 | run_crew = "google_crew.main:run" 14 | train = "google_crew.main:train" 15 | replay = "google_crew.main:replay" 16 | test = "google_crew.main:test" 17 | 18 | [build-system] 19 | requires = ["hatchling"] 20 | build-backend = "hatchling.build" 21 | 22 | [tool.crewai] 23 | type = "crew" 24 | -------------------------------------------------------------------------------- /crewai_google_calendar/google_crew/src/google_crew/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_google_calendar/google_crew/src/google_crew/__init__.py -------------------------------------------------------------------------------- /crewai_google_calendar/google_crew/src/google_crew/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import warnings 4 | 5 | from datetime import datetime 6 | 7 | from crew import GoogleCrew 8 | 9 | warnings.filterwarnings("ignore", category=SyntaxWarning, module="pysbd") 10 | 11 | def run(): 12 | """ 13 | Run the crew. 14 | """ 15 | inputs = { 16 | 'query': 'I want to create a daily standup meeting in the calendar for these days: monday through thursday from 2pm - 2:15 pm titled Catchup - Standup. Just make sure these slots are available, and if they are, then creat them. Then send an email to tylerreed8893@gmail.com.', 17 | 'current_date': str(datetime.now().date()) 18 | } 19 | 20 | try: 21 | return GoogleCrew().crew().kickoff(inputs=inputs) 22 | except Exception as e: 23 | raise Exception(f"An error occurred while running the crew: {e}") 24 | 25 | if __name__ == "__main__": 26 | result = run() 27 | print(result) 28 | -------------------------------------------------------------------------------- /crewai_google_calendar/google_crew/src/google_crew/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_google_calendar/google_crew/src/google_crew/tools/__init__.py -------------------------------------------------------------------------------- /crewai_google_calendar/google_crew/src/google_crew/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from crewai.tools import BaseTool 2 | from typing import Type 3 | from pydantic import BaseModel, Field 4 | 5 | 6 | class MyCustomToolInput(BaseModel): 7 | """Input schema for MyCustomTool.""" 8 | argument: str = Field(..., description="Description of the argument.") 9 | 10 | class MyCustomTool(BaseTool): 11 | name: str = "Name of my tool" 12 | description: str = ( 13 | "Clear description for what this tool is useful for, your agent will need this information to use it." 14 | ) 15 | args_schema: Type[BaseModel] = MyCustomToolInput 16 | 17 | def _run(self, argument: str) -> str: 18 | # Implementation goes here 19 | return "this is an example of a tool output, ignore it and move along." 20 | -------------------------------------------------------------------------------- /crewai_infographic_creation/images_infographic_output/consistent_practice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_infographic_creation/images_infographic_output/consistent_practice.png -------------------------------------------------------------------------------- /crewai_infographic_creation/images_infographic_output/immersion_learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_infographic_creation/images_infographic_output/immersion_learning.png -------------------------------------------------------------------------------- /crewai_infographic_creation/images_infographic_output/infographic_flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_infographic_creation/images_infographic_output/infographic_flow.png -------------------------------------------------------------------------------- /crewai_infographic_creation/images_infographic_output/motivation_mindset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_infographic_creation/images_infographic_output/motivation_mindset.png -------------------------------------------------------------------------------- /crewai_infographic_creation/images_infographic_output/multi_sensory_learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_infographic_creation/images_infographic_output/multi_sensory_learning.png -------------------------------------------------------------------------------- /crewai_infographic_creation/images_infographic_output/technology_based_learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_infographic_creation/images_infographic_output/technology_based_learning.png -------------------------------------------------------------------------------- /crewai_infographic_creation/infographic_flow/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /crewai_infographic_creation/infographic_flow/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "infographic_flow" 3 | version = "0.1.0" 4 | description = "infographic_flow using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.114.0,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "infographic_flow.main:kickoff" 13 | run_crew = "infographic_flow.main:kickoff" 14 | plot = "infographic_flow.main:plot" 15 | 16 | [build-system] 17 | requires = ["hatchling"] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.crewai] 21 | type = "flow" 22 | -------------------------------------------------------------------------------- /crewai_infographic_creation/infographic_flow/src/infographic_flow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_infographic_creation/infographic_flow/src/infographic_flow/__init__.py -------------------------------------------------------------------------------- /crewai_infographic_creation/infographic_flow/src/infographic_flow/crews/infographic_research_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | infographic_researcher_agent: 2 | role: > 3 | Infographic Researcher 4 | goal: > 5 | Research the topic: {infographic_topic} and provide the research report 6 | backstory: > 7 | You're a creative infographic researcher with a talent for capturing the essence of any topic 8 | in a beautiful and engaging way. 9 | 10 | infographic_keypoints_agent: 11 | role: > 12 | Infographic Keypoints Generator 13 | goal: > 14 | Generate the keypoints for the infographic from the research report 15 | backstory: > 16 | You're a creative infographic keypoints generator with a talent for capturing the essence of any topic 17 | in a beautiful and engaging way. -------------------------------------------------------------------------------- /crewai_infographic_creation/infographic_flow/src/infographic_flow/crews/infographic_research_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | infographic_research_task: 2 | description: > 3 | Research the topic: {infographic_topic} and provide the research report 4 | expected_output: > 5 | A beautifully crafted research report about the topic: {infographic_topic} 6 | agent: infographic_researcher_agent 7 | 8 | infographic_keypoints_task: 9 | description: > 10 | Generate the keypoints for the infographic from the research report 11 | expected_output: > 12 | A list of 5 keypoints for the infographic 13 | agent: infographic_keypoints_agent 14 | -------------------------------------------------------------------------------- /crewai_infographic_creation/infographic_flow/src/infographic_flow/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_infographic_creation/infographic_flow/src/infographic_flow/tools/__init__.py -------------------------------------------------------------------------------- /crewai_infographic_creation/infographic_flow/src/infographic_flow/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from crewai.tools import BaseTool 4 | from pydantic import BaseModel, Field 5 | 6 | 7 | class MyCustomToolInput(BaseModel): 8 | """Input schema for MyCustomTool.""" 9 | 10 | argument: str = Field(..., description="Description of the argument.") 11 | 12 | 13 | class MyCustomTool(BaseTool): 14 | name: str = "Name of my tool" 15 | description: str = ( 16 | "Clear description for what this tool is useful for, your agent will need this information to use it." 17 | ) 18 | args_schema: Type[BaseModel] = MyCustomToolInput 19 | 20 | def _run(self, argument: str) -> str: 21 | # Implementation goes here 22 | return "this is an example of a tool output, ignore it and move along." 23 | -------------------------------------------------------------------------------- /crewai_infographic_creation/main.py: -------------------------------------------------------------------------------- 1 | from infographic_flow.src.infographic_flow.main import kickoff 2 | 3 | if __name__ == "__main__": 4 | result = kickoff("The best way to learn a new language") 5 | print(result) 6 | -------------------------------------------------------------------------------- /crewai_listener_flow/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /crewai_listener_flow/poem.txt: -------------------------------------------------------------------------------- 1 | CrewAI is a wizard in disguise, 2 | Turning queries into magic, oh what a surprise! 3 | With a sprinkle of humor and a dash of style, 4 | It makes the mundane feel like a joyous mile. -------------------------------------------------------------------------------- /crewai_listener_flow/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "crewai_listener_flow" 3 | version = "0.1.0" 4 | description = "crewai_listener_flow using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.119.0,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "crewai_listener_flow.main:kickoff" 13 | run_crew = "crewai_listener_flow.main:kickoff" 14 | plot = "crewai_listener_flow.main:plot" 15 | 16 | [build-system] 17 | requires = ["hatchling"] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.crewai] 21 | type = "flow" 22 | -------------------------------------------------------------------------------- /crewai_listener_flow/src/crewai_listener_flow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_listener_flow/src/crewai_listener_flow/__init__.py -------------------------------------------------------------------------------- /crewai_listener_flow/src/crewai_listener_flow/crews/poem_crew/__init__.py: -------------------------------------------------------------------------------- 1 | """Poem crew template.""" 2 | -------------------------------------------------------------------------------- /crewai_listener_flow/src/crewai_listener_flow/crews/poem_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | poem_writer: 2 | role: > 3 | CrewAI Poem Writer 4 | goal: > 5 | Generate a funny, light heartedpoem about how CrewAI 6 | is awesome with a sentence count of {sentence_count} 7 | backstory: > 8 | You're a creative poet with a talent for capturing the essence of any topic 9 | in a beautiful and engaging way. Known for your ability to craft poems that 10 | resonate with readers, you bring a unique perspective and artistic flair to 11 | every piece you write. 12 | -------------------------------------------------------------------------------- /crewai_listener_flow/src/crewai_listener_flow/crews/poem_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | write_poem: 2 | description: > 3 | Write a poem about how CrewAI is awesome. 4 | Ensure the poem is engaging and adheres to the specified sentence count of {sentence_count}. 5 | expected_output: > 6 | A beautifully crafted poem about CrewAI, with exactly {sentence_count} sentences. 7 | agent: poem_writer 8 | -------------------------------------------------------------------------------- /crewai_listener_flow/src/crewai_listener_flow/listeners/__init__.py: -------------------------------------------------------------------------------- 1 | from .my_custom_listener import my_custom_listener 2 | 3 | __all__ = ['my_custom_listener'] -------------------------------------------------------------------------------- /crewai_listener_flow/src/crewai_listener_flow/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_listener_flow/src/crewai_listener_flow/tools/__init__.py -------------------------------------------------------------------------------- /crewai_listener_flow/src/crewai_listener_flow/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from crewai.tools import BaseTool 4 | from pydantic import BaseModel, Field 5 | 6 | 7 | class MyCustomToolInput(BaseModel): 8 | """Input schema for MyCustomTool.""" 9 | 10 | argument: str = Field(..., description="Description of the argument.") 11 | 12 | 13 | class MyCustomTool(BaseTool): 14 | name: str = "Name of my tool" 15 | description: str = ( 16 | "Clear description for what this tool is useful for, your agent will need this information to use it." 17 | ) 18 | args_schema: Type[BaseModel] = MyCustomToolInput 19 | 20 | def _run(self, argument: str) -> str: 21 | # Implementation goes here 22 | return "this is an example of a tool output, ignore it and move along." 23 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "llamaindex_tools" 3 | version = "0.1.0" 4 | description = "llamaindex_tools using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<=3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.76.9,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "llamaindex_tools.main:kickoff" 13 | plot = "llamaindex_tools.main:plot" 14 | 15 | [build-system] 16 | requires = ["hatchling"] 17 | build-backend = "hatchling.build" 18 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/__init__.py -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/crews/math_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | math_agent: 2 | role: > 3 | Math Agent given {a} and {b} get result. I want you to use the multiply tool. 4 | goal: > 5 | Perform mathematical calculations 6 | backstory: > 7 | You're a seasoned mathematician with a knack for performing mathematical calculations. -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/crews/math_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | math_task: 2 | description: > 3 | Perform a mathematical calculation given {a} and {b} 4 | expected_output: > 5 | The result of {a} and {b} 6 | agent: math_agent 7 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/crews/math_crew/crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from crewai.project import CrewBase, agent, crew, task 3 | from crewai_llamaindex_tools.llamaindex_tools.src.llamaindex_tools.tools.math_function_tool import my_tools 4 | 5 | @CrewBase 6 | class MathCrew(): 7 | """MathCrew crew""" 8 | 9 | @agent 10 | def math_agent(self) -> Agent: 11 | return Agent( 12 | config=self.agents_config['math_agent'], 13 | tools=my_tools, 14 | verbose=True 15 | ) 16 | 17 | @task 18 | def math_task(self) -> Task: 19 | return Task( 20 | config=self.tasks_config['math_task'], 21 | ) 22 | 23 | @crew 24 | def crew(self) -> Crew: 25 | """Creates the MathCrew crew""" 26 | return Crew( 27 | agents=self.agents, 28 | tasks=self.tasks, 29 | process=Process.sequential, 30 | verbose=True, 31 | ) 32 | 33 | if __name__ == "__main__": 34 | math_crew = MathCrew() 35 | math_crew.crew.kickoff() -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/crews/wikipedia_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | wikipedia_agent: 2 | role: > 3 | CrewAI Wikipedia Agent 4 | goal: > 5 | Query wikipedia about {topic} with the query string {query_str} 6 | backstory: > 7 | You're a creative wikipedia agent with a talent for capturing the essence of any topic 8 | in a beautiful and engaging way. Known for your ability to query wikipedia with 9 | the query string {query_str} that resonate with readers, you bring a unique perspective and artistic flair to 10 | every piece you write. 11 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/crews/wikipedia_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | wikipedia_result: 2 | description: > 3 | Query wikipedia about {topic} with the query string {query_str} 4 | expected_output: > 5 | A wikipedia result about {topic} with the query string {query_str} 6 | agent: wikipedia_agent 7 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/crews/wikipedia_crew/wikipedia_crew.py: -------------------------------------------------------------------------------- 1 | # from crewai import Agent, Crew, Process, Task 2 | # from crewai.project import CrewBase, agent, crew, task 3 | # # from tools.wiki_tool import WikipediaTool as wikipedia_tool 4 | 5 | # @CrewBase 6 | # class WikipediaCrew(): 7 | # """Wikipedia Crew""" 8 | 9 | # agents_config = 'config/agents.yaml' 10 | # tasks_config = 'config/tasks.yaml' 11 | 12 | # @agent 13 | # def wikipedia_agent(self) -> Agent: 14 | # return Agent( 15 | # config=self.agents_config['wikipedia_agent'], 16 | # tools=[wikipedia_tool()] 17 | # ) 18 | 19 | # @task 20 | # def wikipedia_result(self) -> Task: 21 | # return Task( 22 | # config=self.tasks_config['wikipedia_result'], 23 | # ) 24 | 25 | # @crew 26 | # def crew(self) -> Crew: 27 | # """Creates the Wikipedia Crew""" 28 | # return Crew( 29 | # agents=self.agents, # Automatically created by the @agent decorator 30 | # tasks=self.tasks, # Automatically created by the @task decorator 31 | # process=Process.sequential, 32 | # verbose=True, 33 | # ) 34 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/crews/yahoo_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | yahoo_agent: 2 | role: > 3 | CrewAI Yahoo Finance Agent 4 | goal: > 5 | Query yahoo finance with this query: {query} 6 | backstory: > 7 | You understand the stock market and can answer questions about it. 8 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/crews/yahoo_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | yahoo_result: 2 | description: > 3 | Query yahoo finance with this query: {query} 4 | expected_output: > 5 | A yahoo finance result with this query: {query} 6 | agent: yahoo_agent 7 | -------------------------------------------------------------------------------- /crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_llamaindex_tools/llamaindex_tools/src/llamaindex_tools/tools/__init__.py -------------------------------------------------------------------------------- /crewai_mem0/.env.example: -------------------------------------------------------------------------------- 1 | AGENTOPS_API_KEY=... 2 | OPENAI_API_KEY=... 3 | 4 | # Tools 5 | 6 | NEO4J_URL=... 7 | NEO4J_USERNAME=... 8 | NEO4J_PASSWORD=... 9 | -------------------------------------------------------------------------------- /crewai_mem0/LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | MIT License 3 | 4 | Copyright (c) 2024 Tyler 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /crewai_mem0/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "crewai_mem0" 3 | version = "0.1.0" 4 | description = "Testing this project" 5 | authors = ["Tyler"] 6 | license = "MIT" 7 | 8 | [tool.poetry.dependencies] 9 | python = ">=3.10,<=3.13" 10 | agentops = "^0.3.12" 11 | crewai = "^0.63.6" 12 | crewai-tools= "0.12.1" 13 | mem0ai = "^0.1.25" 14 | 15 | [project.scripts] 16 | crewai_mem0 = "crewai_mem0.main:run" 17 | run_crew = "crewai_mem0.main:run" 18 | -------------------------------------------------------------------------------- /crewai_mem0/src/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_mem0/src/__init__.py -------------------------------------------------------------------------------- /crewai_mem0/src/config/agents.yaml: -------------------------------------------------------------------------------- 1 | 2 | joke_agent: 3 | role: > 4 | this agent will make a joke 5 | goal: > 6 | to make the best joke 7 | backstory: > 8 | The best joke maker in town! 9 | llm: openai/gpt-4 -------------------------------------------------------------------------------- /crewai_mem0/src/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | 2 | create_a_joke: 3 | description: > 4 | the joke should be brand new and find ways to get creative 5 | expected_output: > 6 | just the joke 7 | agent: joke_agent -------------------------------------------------------------------------------- /crewai_mem0/src/crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from crewai.project import CrewBase, agent, crew, task 3 | import tools 4 | 5 | @CrewBase 6 | class Mem0Crew: 7 | """mem0 crew""" 8 | 9 | # Agent definitions 10 | @agent 11 | def joke_agent(self) -> Agent: 12 | return Agent( 13 | config=self.agents_config['joke_agent'], 14 | tools=[tools.write_to_memory], 15 | verbose=True 16 | ) 17 | 18 | # Task definitions 19 | @task 20 | def create_a_joke(self) -> Task: 21 | return Task( 22 | config=self.tasks_config['create_a_joke'], 23 | ) 24 | 25 | @crew 26 | def crew(self) -> Crew: 27 | """Creates the Mem0 crew""" 28 | return Crew( 29 | agents=self.agents, # Automatically created by the @agent decorator 30 | tasks=self.tasks, # Automatically created by the @task decorator 31 | process=Process.sequential, 32 | verbose=True, 33 | # process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/ 34 | ) -------------------------------------------------------------------------------- /crewai_mem0/src/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | from crew import Mem0Crew 4 | 5 | def run(): 6 | """ 7 | Run the crew. 8 | """ 9 | 10 | result = Mem0Crew().crew().kickoff() 11 | print(result) 12 | 13 | if __name__ == "__main__": 14 | run() 15 | -------------------------------------------------------------------------------- /crewai_mem0/src/tools/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | # tool import 3 | 4 | from tools.mem0_tool import write_to_memory, read_from_memory 5 | -------------------------------------------------------------------------------- /crewai_series/.env.example: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY= 2 | SERPER_API_KEY= 3 | AGENTOPS_API_KEY= -------------------------------------------------------------------------------- /crewai_series/day_01/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use the official Python image 2 | FROM python:3.11.9 3 | 4 | # Set the working directory in the container 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container 8 | COPY . /app 9 | 10 | # Install dependencies from requirements.txt 11 | RUN pip install --no-cache-dir -r requirements.txt 12 | 13 | # Copy the .env file if it’s used for environment variables 14 | COPY .env .env 15 | 16 | # Expose port 80 if your app will listen on it 17 | EXPOSE 80 18 | 19 | # Command to run your script 20 | CMD ["python", "run_crew.py"] 21 | -------------------------------------------------------------------------------- /crewai_series/day_01/config/agents.yaml: -------------------------------------------------------------------------------- 1 | my_agent: 2 | role: > 3 | You are a helpful assistant. 4 | goal: > 5 | To give me a funny joke. 6 | backstory: > 7 | You love to give funny jokes. 8 | 9 | emoji_agent: 10 | role: > 11 | You are a helpful emoji assistant. 12 | goal: > 13 | To add emojis to the jokes. 14 | backstory: > 15 | You love to add emojis to the jokes. -------------------------------------------------------------------------------- /crewai_series/day_01/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | my_task: 2 | description: > 3 | To give me a funny joke. 4 | expected_output: > 5 | The new joke you came up with. 6 | 7 | emoji_task: 8 | description: > 9 | To add emojis to the jokes. 10 | expected_output: > 11 | The new joke with emojis, you can add lots of them. -------------------------------------------------------------------------------- /crewai_series/day_01/requirements.txt: -------------------------------------------------------------------------------- 1 | crewai 2 | crewai[tools] -------------------------------------------------------------------------------- /crewai_series/day_01/run_crew.py: -------------------------------------------------------------------------------- 1 | from main_crew import MyCrew 2 | 3 | def run_crew(): 4 | result = MyCrew().crew().kickoff() 5 | print(result) 6 | 7 | run_crew() -------------------------------------------------------------------------------- /crewai_series/day_02/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /crewai_series/day_02/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "day_02" 3 | version = "0.1.0" 4 | description = "day_02 using crewAI" 5 | authors = ["Tyler Reed "] 6 | 7 | [tool.poetry.dependencies] 8 | python = ">=3.10,<=3.13" 9 | crewai = { extras = ["tools"], version = ">=0.67.1,<1.0.0" } 10 | 11 | 12 | [tool.poetry.scripts] 13 | day_02 = "day_02.main:run" 14 | run_crew = "day_02.main:run" 15 | train = "day_02.main:train" 16 | replay = "day_02.main:replay" 17 | test = "day_02.main:test" 18 | 19 | [build-system] 20 | requires = ["poetry-core"] 21 | build-backend = "poetry.core.masonry.api" 22 | -------------------------------------------------------------------------------- /crewai_series/day_02/src/day_02/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_series/day_02/src/day_02/__init__.py -------------------------------------------------------------------------------- /crewai_series/day_02/src/day_02/config/agents.yaml: -------------------------------------------------------------------------------- 1 | chuck_norris_joke_generator: 2 | role: > 3 | Chuck Norris Joke Generator 4 | goal: > 5 | Generate 10 Chuck Norris jokes 6 | backstory: > 7 | You are the best joke generator in the world. You always generate the best jokes. 8 | 9 | chuck_norris_joke_picker: 10 | role: > 11 | Chuck Norris Joke Picker 12 | goal: > 13 | Pick the best joke from the list of jokes 14 | backstory: > 15 | You are a great judge of jokes. You always pick the best joke from the list of jokes. -------------------------------------------------------------------------------- /crewai_series/day_02/src/day_02/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | generate_joke_task: 2 | description: > 3 | Generate 10 Chuck Norris jokes 4 | expected_output: > 5 | A list with 10 Chuck Norris jokes 6 | agent: chuck_norris_joke_generator 7 | 8 | pick_joke_task: 9 | description: > 10 | Pick the best joke from the list of jokes 11 | expected_output: > 12 | The best joke from the list of jokes 13 | agent: chuck_norris_joke_picker 14 | -------------------------------------------------------------------------------- /crewai_series/day_02/src/day_02/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | from crew import Day02Crew 4 | 5 | # This main file is intended to be a way for your to run your 6 | # crew locally, so refrain from adding necessary logic into this file. 7 | # Replace with inputs you want to test with, it will automatically 8 | # interpolate any tasks and agents information 9 | 10 | def run(): 11 | """ 12 | Run the crew. 13 | """ 14 | 15 | Day02Crew().crew().kickoff() 16 | 17 | run() 18 | -------------------------------------------------------------------------------- /crewai_series/day_03/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /crewai_series/day_03/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "day_03" 3 | version = "0.1.0" 4 | description = "day_03 using crewAI" 5 | authors = ["Tyler Reed "] 6 | 7 | [tool.poetry.dependencies] 8 | python = ">=3.10,<=3.13" 9 | crewai = { extras = ["tools"], version = ">=0.67.1,<1.0.0" } 10 | 11 | 12 | [tool.poetry.scripts] 13 | day_03 = "day_03.main:run" 14 | run_crew = "day_03.main:run" 15 | train = "day_03.main:train" 16 | replay = "day_03.main:replay" 17 | test = "day_03.main:test" 18 | 19 | [build-system] 20 | requires = ["poetry-core"] 21 | build-backend = "poetry.core.masonry.api" 22 | -------------------------------------------------------------------------------- /crewai_series/day_03/src/day_03/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_series/day_03/src/day_03/__init__.py -------------------------------------------------------------------------------- /crewai_series/day_03/src/day_03/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior News Researcher 4 | goal: > 5 | Uncover latest news in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | 11 | reporting_analyst: 12 | role: > 13 | {topic} News Reporting Analyst 14 | goal: > 15 | Create detailed reports based on {topic} news analysis and research findings 16 | backstory: > 17 | You're a meticulous analyst with a keen eye for detail. You're known for 18 | your ability to turn complex data into clear and concise reports, making 19 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /crewai_series/day_03/src/day_03/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Search news about {topic} 4 | The current time is {date} 5 | expected_output: > 6 | A list of news articles about {topic} with the title, url and snippet 7 | agent: researcher 8 | 9 | reporting_task: 10 | description: > 11 | Review the context you got. 12 | Make sure the report is detailed and contains any and all relevant information. 13 | expected_output: > 14 | A fully fledge reporting of the news articles. 15 | Formatted as markdown without '```' 16 | agent: reporting_analyst 17 | -------------------------------------------------------------------------------- /crewai_series/day_03/src/day_03/crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from crewai.project import CrewBase, agent, crew, task 3 | from crewai_tools import SerperDevTool, ScrapeWebsiteTool 4 | 5 | @CrewBase 6 | class Day03Crew: 7 | """Day03 crew""" 8 | 9 | @agent 10 | def researcher(self) -> Agent: 11 | return Agent( 12 | config=self.agents_config['researcher'], 13 | tools=[SerperDevTool(), ScrapeWebsiteTool()], 14 | verbose=True 15 | ) 16 | 17 | @agent 18 | def reporting_analyst(self) -> Agent: 19 | return Agent( 20 | config=self.agents_config['reporting_analyst'], 21 | verbose=True 22 | ) 23 | 24 | @task 25 | def research_task(self) -> Task: 26 | return Task( 27 | config=self.tasks_config['research_task'], 28 | ) 29 | 30 | @task 31 | def reporting_task(self) -> Task: 32 | return Task( 33 | config=self.tasks_config['reporting_task'], 34 | output_file='report.md' 35 | ) 36 | 37 | @crew 38 | def crew(self) -> Crew: 39 | """Creates the Day03 crew""" 40 | return Crew( 41 | agents=self.agents, 42 | tasks=self.tasks, 43 | process=Process.sequential, 44 | verbose=True, 45 | ) -------------------------------------------------------------------------------- /crewai_series/day_03/src/day_03/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | from crew import Day03Crew 4 | from datetime import datetime 5 | 6 | def run(): 7 | """ 8 | Run the crew. 9 | """ 10 | inputs = { 11 | 'topic': 'openai', 12 | 'date': datetime.now().strftime("%Y-%m-%d") 13 | } 14 | Day03Crew().crew().kickoff(inputs=inputs) 15 | 16 | run() -------------------------------------------------------------------------------- /crewai_series/day_04/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /crewai_series/day_04/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "day_04" 3 | version = "0.1.0" 4 | description = "day_04 using crewAI" 5 | authors = ["Tyler Reed "] 6 | 7 | [tool.poetry.dependencies] 8 | python = ">=3.10,<=3.13" 9 | crewai = { extras = ["tools"], version = ">=0.67.1,<1.0.0" } 10 | 11 | 12 | [tool.poetry.scripts] 13 | day_04 = "day_04.main:run" 14 | run_crew = "day_04.main:run" 15 | train = "day_04.main:train" 16 | replay = "day_04.main:replay" 17 | test = "day_04.main:test" 18 | 19 | [build-system] 20 | requires = ["poetry-core"] 21 | build-backend = "poetry.core.masonry.api" 22 | -------------------------------------------------------------------------------- /crewai_series/day_04/src/day_04/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_series/day_04/src/day_04/__init__.py -------------------------------------------------------------------------------- /crewai_series/day_04/src/day_04/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior News Researcher 4 | goal: > 5 | Uncover latest news in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | 11 | reporting_analyst: 12 | role: > 13 | {topic} News Reporting Analyst 14 | goal: > 15 | Create detailed reports based on {topic} news analysis and research findings 16 | backstory: > 17 | You're a meticulous analyst with a keen eye for detail. You're known for 18 | your ability to turn complex data into clear and concise reports, making 19 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /crewai_series/day_04/src/day_04/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Search news about {topic} 4 | expected_output: > 5 | A list of news articles about {topic} with the title, url, image and snippet 6 | agent: researcher 7 | 8 | reporting_task: 9 | description: > 10 | Review the context you got. 11 | Make sure the report is detailed and contains any and all relevant information. 12 | expected_output: > 13 | A fully fledge reporting of the news articles. Make sure you have the title, summary, url and the image. 14 | Formatted as markdown without '```' 15 | agent: reporting_analyst 16 | -------------------------------------------------------------------------------- /crewai_series/day_04/src/day_04/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | from crew import Day04Crew 4 | from datetime import datetime 5 | 6 | def run(): 7 | """ 8 | Run the crew. 9 | """ 10 | inputs = { 11 | 'topic': 'ai agents' 12 | } 13 | 14 | Day04Crew().crew().kickoff(inputs=inputs) 15 | 16 | run() -------------------------------------------------------------------------------- /crewai_series/day_05/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /crewai_series/day_05/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "day_05" 3 | version = "0.1.0" 4 | description = "day_05 using crewAI" 5 | authors = ["Tyler Reed "] 6 | 7 | [tool.poetry.dependencies] 8 | python = ">=3.10,<=3.13" 9 | crewai = { extras = ["tools"], version = ">=0.67.1,<1.0.0" } 10 | 11 | 12 | [tool.poetry.scripts] 13 | day_05 = "day_05.main:run" 14 | run_crew = "day_05.main:run" 15 | train = "day_05.main:train" 16 | replay = "day_05.main:replay" 17 | test = "day_05.main:test" 18 | 19 | [build-system] 20 | requires = ["poetry-core"] 21 | build-backend = "poetry.core.masonry.api" 22 | -------------------------------------------------------------------------------- /crewai_series/day_05/src/day_05/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_series/day_05/src/day_05/__init__.py -------------------------------------------------------------------------------- /crewai_series/day_05/src/day_05/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior News Researcher 4 | goal: > 5 | Uncover latest news in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | 11 | reporting_analyst: 12 | role: > 13 | {topic} News Reporting Analyst 14 | goal: > 15 | Create detailed reports based on {topic} news analysis and research findings 16 | backstory: > 17 | You're a meticulous analyst with a keen eye for detail. You're known for 18 | your ability to turn complex data into clear and concise reports, making 19 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /crewai_series/day_05/src/day_05/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Search news about {topic} 4 | expected_output: > 5 | A list of news articles about {topic} with the title, url, image and snippet 6 | agent: researcher 7 | 8 | reporting_task: 9 | description: > 10 | Review the context you got. 11 | Make sure the report is detailed and contains any and all relevant information. 12 | expected_output: > 13 | A fully fledge reporting of the news articles. Make sure you have the title, summary, url and the image. 14 | Formatted as markdown without '```' 15 | agent: reporting_analyst 16 | -------------------------------------------------------------------------------- /crewai_series/day_05/src/day_05/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | from crew import Day05Crew 4 | from dotenv import load_dotenv 5 | import os 6 | 7 | load_dotenv() 8 | 9 | def run(): 10 | """ 11 | Run the crew. 12 | """ 13 | inputs = { 14 | 'topic': 'meta ai' 15 | } 16 | 17 | Day05Crew().crew().kickoff(inputs=inputs) 18 | 19 | run() -------------------------------------------------------------------------------- /crewai_series/day_06/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /crewai_series/day_06/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "day_06" 3 | version = "0.1.0" 4 | description = "day_06 using crewAI" 5 | authors = ["Tyler Reed "] 6 | 7 | [tool.poetry.dependencies] 8 | python = ">=3.10,<=3.13" 9 | crewai = { extras = ["tools"], version = ">=0.67.1,<1.0.0" } 10 | 11 | 12 | [tool.poetry.scripts] 13 | day_06 = "day_06.main:run" 14 | run_crew = "day_06.main:run" 15 | train = "day_06.main:train" 16 | replay = "day_06.main:replay" 17 | test = "day_06.main:test" 18 | 19 | [build-system] 20 | requires = ["poetry-core"] 21 | build-backend = "poetry.core.masonry.api" 22 | -------------------------------------------------------------------------------- /crewai_series/day_06/src/day_06/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_series/day_06/src/day_06/__init__.py -------------------------------------------------------------------------------- /crewai_series/day_06/src/day_06/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior News Researcher 4 | goal: > 5 | Uncover latest news in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | 11 | reporting_analyst: 12 | role: > 13 | {topic} News Reporting Analyst 14 | goal: > 15 | Create detailed reports based on {topic} news analysis and research findings 16 | backstory: > 17 | You're a meticulous analyst with a keen eye for detail. You're known for 18 | your ability to turn complex data into clear and concise reports, making 19 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /crewai_series/day_06/src/day_06/config/filewriter/agents.yaml: -------------------------------------------------------------------------------- 1 | writer: 2 | role: > 3 | Markdown File Writer 4 | goal: > 5 | Write the news to a markdown file from the given context: {news} 6 | backstory: > 7 | You're a skilled writer who excels at formatting information into 8 | well-organized markdown files. Known for your attention to detail and ability 9 | to present complex information in a clear and concise manner. -------------------------------------------------------------------------------- /crewai_series/day_06/src/day_06/config/filewriter/tasks.yaml: -------------------------------------------------------------------------------- 1 | write_task: 2 | description: > 3 | Write the news to a markdown file. 4 | expected_output: > 5 | A markdown file with the news. Add formatting and make it look pretty. 6 | agent: writer -------------------------------------------------------------------------------- /crewai_series/day_06/src/day_06/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Search news about {topic} 4 | expected_output: > 5 | A list of news articles about {topic} with the title, url, image and snippet 6 | agent: researcher 7 | 8 | reporting_task: 9 | description: > 10 | Review the context you got. 11 | Make sure the report is detailed and contains any and all relevant information. 12 | expected_output: > 13 | A fully fledge reporting of the news articles. Make sure you have the title, summary, url and the image. 14 | Formatted as markdown without '```' 15 | agent: reporting_analyst 16 | -------------------------------------------------------------------------------- /crewai_series/day_06/src/day_06/file_writer_crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task, LLM 2 | from crewai.project import CrewBase, agent, crew, task 3 | from tools.custom_file_writer_tool import CustomFileWriterTool 4 | 5 | @CrewBase 6 | class FileWriterCrew: 7 | """File Writer crew""" 8 | 9 | agents_config = "config/filewriter/agents.yaml" 10 | tasks_config = "config/filewriter/tasks.yaml" 11 | 12 | @agent 13 | def writer(self) -> Agent: 14 | return Agent( 15 | config=self.agents_config['writer'], 16 | tools=[CustomFileWriterTool()], 17 | verbose=True 18 | ) 19 | 20 | @task 21 | def write_task(self) -> Task: 22 | return Task( 23 | config=self.tasks_config['write_task'], 24 | ) 25 | 26 | @crew 27 | def crew(self) -> Crew: 28 | """Creates the File Writer crew""" 29 | return Crew( 30 | agents=self.agents, 31 | tasks=self.tasks, 32 | process=Process.sequential, 33 | verbose=True, 34 | ) -------------------------------------------------------------------------------- /crewai_series/day_06/src/day_06/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | from crew import Day05Crew 4 | from dotenv import load_dotenv 5 | import os 6 | 7 | load_dotenv() 8 | 9 | def run(): 10 | """ 11 | Run the crew. 12 | """ 13 | inputs = { 14 | 'topic': 'meta ai' 15 | } 16 | 17 | Day05Crew().crew().kickoff(inputs=inputs) 18 | 19 | run() -------------------------------------------------------------------------------- /crewai_series/day_07/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /crewai_series/day_07/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "day_06" 3 | version = "0.1.0" 4 | description = "day_06 using crewAI" 5 | authors = ["Tyler Reed "] 6 | 7 | [tool.poetry.dependencies] 8 | python = ">=3.10,<=3.13" 9 | crewai = { extras = ["tools"], version = ">=0.67.1,<1.0.0" } 10 | 11 | 12 | [tool.poetry.scripts] 13 | day_06 = "day_06.main:run" 14 | run_crew = "day_06.main:run" 15 | train = "day_06.main:train" 16 | replay = "day_06.main:replay" 17 | test = "day_06.main:test" 18 | 19 | [build-system] 20 | requires = ["poetry-core"] 21 | build-backend = "poetry.core.masonry.api" 22 | -------------------------------------------------------------------------------- /crewai_series/day_07/src/day_07/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_series/day_07/src/day_07/__init__.py -------------------------------------------------------------------------------- /crewai_series/day_07/src/day_07/agentops.log: -------------------------------------------------------------------------------- 1 | 2024-10-17 15:05:41,818 - WARNING - WARNING: agentops is out of date. Please update with the command: 'pip install --upgrade agentops' 2 | 2024-10-17 15:05:42,645 - INFO - Session Replay: https://app.agentops.ai/drilldown?session_id=a9ab16f6-49c4-400e-beff-cbf3ec6402f4 3 | 2024-10-17 15:07:48,505 - INFO - Session stats - Cost: $0.006329 Duration: 2m 4.8s LLMs: 6 Tools: 2 Actions: 0 Errors: 0 4 | 2024-10-17 15:07:48,506 - INFO - Session Replay: https://app.agentops.ai/drilldown?session_id=a9ab16f6-49c4-400e-beff-cbf3ec6402f4 5 | 2024-10-17 15:07:59,845 - INFO - SIGINT detected. Ending session... 6 | -------------------------------------------------------------------------------- /crewai_series/day_07/src/day_07/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior News Researcher 4 | goal: > 5 | Uncover latest news in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | 11 | reporting_analyst: 12 | role: > 13 | {topic} News Reporting Analyst 14 | goal: > 15 | Create detailed reports based on {topic} news analysis and research findings 16 | backstory: > 17 | You're a meticulous analyst with a keen eye for detail. You're known for 18 | your ability to turn complex data into clear and concise reports, making 19 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /crewai_series/day_07/src/day_07/config/filewriter/agents.yaml: -------------------------------------------------------------------------------- 1 | writer: 2 | role: > 3 | Markdown File Writer 4 | goal: > 5 | Write the news to a markdown file from the given context: {news} 6 | backstory: > 7 | You're a skilled writer who excels at formatting information into 8 | well-organized markdown files. Known for your attention to detail and ability 9 | to present complex information in a clear and concise manner. -------------------------------------------------------------------------------- /crewai_series/day_07/src/day_07/config/filewriter/tasks.yaml: -------------------------------------------------------------------------------- 1 | write_task: 2 | description: > 3 | Write the news to a markdown file. 4 | expected_output: > 5 | A markdown file with the news. Add formatting and make it look pretty. 6 | agent: writer -------------------------------------------------------------------------------- /crewai_series/day_07/src/day_07/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Search news about {topic} 4 | expected_output: > 5 | A list of news articles about {topic} with the title, url, image and snippet 6 | agent: researcher 7 | 8 | reporting_task: 9 | description: > 10 | Review the context you got. 11 | Make sure the report is detailed and contains any and all relevant information. 12 | expected_output: > 13 | A fully fledge reporting of the news articles. Make sure you have the title, summary, url and the image. 14 | Formatted as markdown without '```' 15 | agent: reporting_analyst 16 | -------------------------------------------------------------------------------- /crewai_series/day_07/src/day_07/file_writer_crew.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task, LLM 2 | from crewai.project import CrewBase, agent, crew, task 3 | from tools.custom_file_writer_tool import CustomFileWriterTool 4 | 5 | @CrewBase 6 | class FileWriterCrew: 7 | """File Writer crew""" 8 | 9 | agents_config = "config/filewriter/agents.yaml" 10 | tasks_config = "config/filewriter/tasks.yaml" 11 | 12 | @agent 13 | def writer(self) -> Agent: 14 | return Agent( 15 | config=self.agents_config['writer'], 16 | tools=[CustomFileWriterTool()], 17 | verbose=True 18 | ) 19 | 20 | @task 21 | def write_task(self) -> Task: 22 | return Task( 23 | config=self.tasks_config['write_task'], 24 | ) 25 | 26 | @crew 27 | def crew(self) -> Crew: 28 | """Creates the File Writer crew""" 29 | return Crew( 30 | agents=self.agents, 31 | tasks=self.tasks, 32 | process=Process.sequential, 33 | verbose=True, 34 | ) -------------------------------------------------------------------------------- /crewai_supabase/get_the_connection.py: -------------------------------------------------------------------------------- 1 | import os 2 | from supabase import create_client, Client 3 | 4 | url: str = os.environ.get("SUPABASE_URL") 5 | key: str = os.environ.get("SUPABASE_KEY") 6 | 7 | # Add debug prints to verify environment variables 8 | print(f"URL: {url}") 9 | print(f"Key: {'*' * len(key) if key else 'None'}") # Masked key for security 10 | 11 | supabase: Client = create_client(url, key) 12 | 13 | result = supabase.table("leads").select("*").execute() 14 | 15 | print(f"Insert result: {result}") 16 | 17 | -------------------------------------------------------------------------------- /crewai_supabase/knowledge/table_info.txt: -------------------------------------------------------------------------------- 1 | table_schema: public 2 | table_name: leads 3 | columns: 4 | id: 5 | data_type: integer 6 | is_nullable: NO 7 | column_default: nextval('leads_id_seq'::regclass) 8 | first_name: 9 | data_type: character varying 10 | is_nullable: NO 11 | column_default: null 12 | last_name: 13 | data_type: character varying 14 | is_nullable: NO 15 | column_default: null 16 | email: 17 | data_type: character varying 18 | is_nullable: NO 19 | column_default: null 20 | phone_number: 21 | data_type: character varying 22 | is_nullable: YES 23 | column_default: null 24 | company: 25 | data_type: character varying 26 | is_nullable: YES 27 | column_default: null 28 | job_title: 29 | data_type: character varying 30 | is_nullable: YES 31 | column_default: null 32 | lead_source: 33 | data_type: character varying 34 | is_nullable: YES 35 | column_default: null 36 | created_at: 37 | data_type: timestamp without time zone 38 | is_nullable: YES 39 | column_default: now() -------------------------------------------------------------------------------- /crewai_supabase/supabase_tools/__init__.py: -------------------------------------------------------------------------------- 1 | from .supabase_get_row_tool import SupabaseGetRowTool as supabase_get_row_tool 2 | from .supabase_get_all_rows_tool import SupabaseGetAllRowsTool as supabase_get_all_rows_tool 3 | from .supabase_insert_row_tool import SupabaseInsertRowTool as supabase_insert_row_tool 4 | from .supabase_delete_row_tool import SupabaseDeleteRowTool as supabase_delete_row_tool 5 | from .supabase_update_tool import SupabaseUpdateRowTool as supabase_update_row_tool -------------------------------------------------------------------------------- /crewai_supabase/supabase_tools/supabase_delete_row_tool.py: -------------------------------------------------------------------------------- 1 | from crewai.tools import BaseTool 2 | from pydantic import Field 3 | import os 4 | from supabase import create_client, Client 5 | from pydantic import BaseModel 6 | from typing import Type 7 | 8 | url: str = os.environ.get("SUPABASE_URL") 9 | key: str = os.environ.get("SUPABASE_KEY") 10 | supabase: Client = create_client(url, key) 11 | 12 | class SupabaseDeleteRowInputTool(BaseModel): 13 | table_name: str = Field(..., description="String containing the table name.") 14 | column_name: str = Field(..., description="String containing the column name.") 15 | value: str = Field(..., description="String containing the value.") 16 | 17 | class SupabaseDeleteRowTool(BaseTool): 18 | name: str = "Supabase Delete Row Tool" 19 | description: str = "This tool is useful for deleting a row from the Supabase database." 20 | 21 | args_schema: Type[BaseModel] = SupabaseDeleteRowInputTool 22 | 23 | def _run(self, table_name: str, column_name: str, value: str) -> str: 24 | result = supabase.table(table_name).delete().eq(column_name, value).execute() 25 | return result 26 | -------------------------------------------------------------------------------- /crewai_supabase/supabase_tools/supabase_get_row_tool.py: -------------------------------------------------------------------------------- 1 | from crewai.tools import BaseTool 2 | import os 3 | from supabase import create_client, Client 4 | 5 | url: str = os.environ.get("SUPABASE_URL") 6 | key: str = os.environ.get("SUPABASE_KEY") 7 | supabase: Client = create_client(url, key) 8 | 9 | class SupabaseGetRowTool(BaseTool): 10 | name: str = "Supabase Get Row Tool" 11 | description: str = "This tool is useful for getting a row from the Supabase database." 12 | 13 | def _run(self, table_name: str, column_name: str, value: str) -> str: 14 | result = supabase.table(table_name).select("*").eq(column_name, value).execute() 15 | return result 16 | -------------------------------------------------------------------------------- /crewai_tools_11/CodeExamples/bubble_sort.py: -------------------------------------------------------------------------------- 1 | def bubble_sort(arr): 2 | n = len(arr) 3 | for i in range(n): 4 | # Last i elements are already in place 5 | for j in range(0, n-i-1): 6 | # Traverse the array from 0 to n-i-1 7 | # Swap if the element found is greater than the next element 8 | if arr[j] > arr[j+1]: 9 | arr[j], arr[j+1] = arr[j+1], arr[j] 10 | return arr 11 | 12 | # Example usage 13 | example_array = [64, 34, 25, 12, 22, 11, 90] 14 | sorted_array = bubble_sort(example_array) 15 | print("Sorted array is:", sorted_array) 16 | -------------------------------------------------------------------------------- /crewai_tools_11/code_execution_tool.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Task, Crew, Process 2 | from crewai_tools import CodeInterpreterTool 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | tool = CodeInterpreterTool() 8 | 9 | agent = Agent( 10 | role="Code Execution Agent", 11 | goal="You will execute the code and return the output", 12 | backstory="""You are a master at executing code.""", 13 | tools=[tool], 14 | verbose=True, 15 | allow_delegation=False, 16 | ) 17 | task = Task( 18 | description="Answer the following question: {question}", 19 | expected_output="The actual code used to get the answer to the file.", 20 | agent=agent, 21 | ) 22 | 23 | crew = Crew( 24 | agents=[agent], 25 | tasks=[task], 26 | verbose=True, 27 | process=Process.sequential, 28 | ) 29 | 30 | 31 | question = input("Enter your code question: ") 32 | result = crew.kickoff(inputs={"question": question}) 33 | print(result) -------------------------------------------------------------------------------- /crewai_tools_11/code_execution_tool_and_file_writer.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Task, Crew, Process, LLM 2 | from crewai_tools import CodeInterpreterTool, FileWriterTool 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | tool = CodeInterpreterTool() 8 | file_writer = FileWriterTool() 9 | 10 | agent = Agent( 11 | role="Code Execution Agent", 12 | goal="You will execute the code and return the output AND save the code to the proper directory given by the tool.", 13 | backstory="""You are a master at executing code.""", 14 | tools=[tool, file_writer], 15 | verbose=True, 16 | allow_delegation=False, 17 | ) 18 | 19 | task = Task( 20 | description="Answer the following question: {question}", 21 | expected_output="The actual code used to get the answer to the file. Save the code to the proper directory. ONLY save the code.", 22 | agent=agent, 23 | ) 24 | 25 | crew = Crew( 26 | agents=[agent], 27 | tasks=[task], 28 | verbose=True, 29 | process=Process.sequential, 30 | ) 31 | 32 | 33 | question = input("Enter your code question: ") 34 | result = crew.kickoff(inputs={"question": question}) 35 | print(result) -------------------------------------------------------------------------------- /crewai_tools_11/csv_file_rag_search.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import CSVSearchTool 2 | from crewai import Agent, Task, Crew, Process, LLM 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | tool = CSVSearchTool(csv='/Users/tylerreed/_ai-projects/ai/crewai_tools_11/Financial Sample Data.csv') 8 | 9 | agent = Agent( 10 | role="CSV Search Agent", 11 | goal="You will search the CSV file for the answer to the question. Use the tools to search the CSV file.", 12 | backstory="""You are a master at searching CSV files.""", 13 | tools=[tool], 14 | verbose=True, 15 | allow_delegation=False, 16 | ) 17 | 18 | task = Task( 19 | description="Answer the following questions about the CSV file: {question}", 20 | expected_output="An answer to the question.", 21 | tools=[tool], 22 | agent=agent, 23 | ) 24 | 25 | crew = Crew( 26 | agents=[agent], 27 | tasks=[task], 28 | verbose=True, 29 | process=Process.sequential, 30 | ) 31 | 32 | while True: 33 | question = input("Enter a question about the CSV file: ") 34 | result = crew.kickoff(inputs={"question": question}) 35 | print(result) 36 | 37 | 38 | -------------------------------------------------------------------------------- /crewai_tools_11/docx_rag_search.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import DOCXSearchTool 2 | from crewai import Agent, Task, Crew, Process, LLM 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | # For fixed directory searches 8 | tool = DOCXSearchTool(docx='./rag_dir/user.docx') 9 | 10 | # Create an agent with the knowledge store 11 | agent = Agent( 12 | role="DOCX Search Agent", 13 | goal="You will search the DOCX file for the answer to the question. Use the tools to search the DOCX file.", 14 | backstory="""You are a master at searching DOCX files.""", 15 | tools=[tool], 16 | verbose=True, 17 | allow_delegation=False 18 | ) 19 | task = Task( 20 | description="Answer the following questions about the DOCX file: {question}", 21 | expected_output="An answer to the question.", 22 | tools=[tool], 23 | agent=agent, 24 | ) 25 | 26 | crew = Crew( 27 | agents=[agent], 28 | tasks=[task], 29 | verbose=True, 30 | process=Process.sequential, 31 | ) 32 | 33 | while True: 34 | question = input("Enter a question about the DOCX file: ") 35 | result = crew.kickoff(inputs={"question": question}) 36 | print(result) -------------------------------------------------------------------------------- /crewai_tools_11/exa_and_website_search.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import EXASearchTool, ScrapeWebsiteTool 2 | from crewai import Agent, Task, Crew, Process, LLM 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | tool = EXASearchTool() 8 | scrape_tool = ScrapeWebsiteTool() 9 | 10 | agent = Agent( 11 | role="EXA Search Agent", 12 | goal="You will search the website based on the input and then scrape those websites.", 13 | backstory="""You are a master at searching websites.""", 14 | tools=[tool, scrape_tool], 15 | verbose=True, 16 | allow_delegation=False 17 | ) 18 | task = Task( 19 | description="Answer the following questions about the website: {question}", 20 | expected_output="An answer to the question.", 21 | agent=agent, 22 | ) 23 | 24 | crew = Crew( 25 | agents=[agent], 26 | tasks=[task], 27 | verbose=True, 28 | process=Process.sequential, 29 | ) 30 | 31 | while True: 32 | question = input("Input: ") 33 | result = crew.kickoff(inputs={"question": question}) 34 | print(result) -------------------------------------------------------------------------------- /crewai_tools_11/exa_search.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import EXASearchTool 2 | from crewai import Agent, Task, Crew, Process, LLM 3 | from dotenv import load_dotenv 4 | load_dotenv() 5 | 6 | tool = EXASearchTool() 7 | 8 | agent = Agent( 9 | role="EXA Search Agent", 10 | goal="You will search the EXA file for the answer to the question. Use the tools to search the EXA file.", 11 | backstory="""You are a master at searching EXA files.""", 12 | tools=[tool], 13 | verbose=True, 14 | allow_delegation=False 15 | ) 16 | task = Task( 17 | description="Answer the following questions about the EXA file: {question}", 18 | expected_output="An answer to the question.", 19 | tools=[tool], 20 | agent=agent, 21 | ) 22 | 23 | crew = Crew( 24 | agents=[agent], 25 | tasks=[task], 26 | verbose=True, 27 | process=Process.sequential, 28 | ) 29 | 30 | while True: 31 | question = input("Enter a question about for EXA: ") 32 | result = crew.kickoff(inputs={"question": question}) 33 | print(result) -------------------------------------------------------------------------------- /crewai_tools_11/images/airport.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_tools_11/images/airport.jpeg -------------------------------------------------------------------------------- /crewai_tools_11/images/cats.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_tools_11/images/cats.jpg -------------------------------------------------------------------------------- /crewai_tools_11/json_rag_search.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import JSONSearchTool 2 | from crewai import Agent, Task, Crew, Process, LLM 3 | from dotenv import load_dotenv 4 | import os 5 | 6 | load_dotenv() 7 | 8 | # For fixed directory searches 9 | tool = JSONSearchTool() 10 | 11 | # Create an agent with the knowledge store 12 | agent = Agent( 13 | role="JSON Search Agent", 14 | goal="You will search the JSON for the answer to the question. Use the tools to search the JSON.", 15 | backstory="""You are a master at searching JSON files.""", 16 | tools=[tool], 17 | verbose=True, 18 | allow_delegation=False 19 | ) 20 | task = Task( 21 | description="Answer the following questions about the JSON: {question}", 22 | expected_output="An answer to the question.", 23 | agent=agent, 24 | ) 25 | 26 | crew = Crew( 27 | agents=[agent], 28 | tasks=[task], 29 | verbose=True, 30 | process=Process.sequential, 31 | ) 32 | 33 | while True: 34 | question = input("Enter a question about the JSON: ") 35 | result = crew.kickoff(inputs={"question": question}) 36 | print(result) -------------------------------------------------------------------------------- /crewai_tools_11/pdf/AutoGen_Studio-12.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_tools_11/pdf/AutoGen_Studio-12.pdf -------------------------------------------------------------------------------- /crewai_tools_11/rag_dir/user.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/crewai_tools_11/rag_dir/user.docx -------------------------------------------------------------------------------- /crewai_tools_11/read_file.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import FileReadTool 2 | from crewai import Agent, Task, Crew, Process, LLM 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | # For fixed directory searches 8 | tool = FileReadTool() 9 | 10 | # Create an agent with the knowledge store 11 | agent = Agent( 12 | role="File Read Agent", 13 | goal="You will read the file for the answer to the question. Use the tools to read the file.", 14 | backstory="""You are a master at reading files.""", 15 | tools=[tool], 16 | verbose=True, 17 | allow_delegation=False 18 | ) 19 | task = Task( 20 | description="What's in this file: {question}", 21 | expected_output="An answer to the question.", 22 | tools=[tool], 23 | agent=agent, 24 | ) 25 | 26 | crew = Crew( 27 | agents=[agent], 28 | tasks=[task], 29 | verbose=True, 30 | process=Process.sequential, 31 | ) 32 | 33 | while True: 34 | question = input("The file is: ") 35 | if question == "exit": 36 | break 37 | result = crew.kickoff(inputs={"question": question}) 38 | print(result) -------------------------------------------------------------------------------- /crewai_tools_11/serper_dev.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import SerperDevTool 2 | from crewai import Agent, Task, Crew, Process, LLM 3 | from dotenv import load_dotenv 4 | import os 5 | 6 | load_dotenv() 7 | 8 | # Create the tool with the token 9 | tool = SerperDevTool() 10 | 11 | # Create an agent with the knowledge store 12 | agent = Agent( 13 | role="Serper Search Agent", 14 | goal="You will search the internet for the answer to the question. Use the tools to search the internet.", 15 | backstory="""You are a master at searching the internet.""", 16 | tools=[tool], 17 | verbose=True, 18 | allow_delegation=False 19 | ) 20 | task = Task( 21 | description="Answer the following questions about the internet: {question}", 22 | expected_output="An answer to the question.", 23 | tools=[tool], 24 | agent=agent, 25 | ) 26 | 27 | crew = Crew( 28 | agents=[agent], 29 | tasks=[task], 30 | verbose=True, 31 | process=Process.sequential, 32 | ) 33 | 34 | while True: 35 | question = input("Enter a question about the internet: ") 36 | result = crew.kickoff(inputs={"question": question}) 37 | print(result) -------------------------------------------------------------------------------- /crewai_tools_11/vision_rag.py: -------------------------------------------------------------------------------- 1 | from crewai_tools import VisionTool 2 | from crewai import Agent, Task, Crew, Process, LLM 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | tool = VisionTool() 8 | 9 | agent = Agent( 10 | role="Vision Agent", 11 | goal="You will read the image for the answer to the question. Use the tools to read the image.", 12 | backstory="""You are a master at reading images.""", 13 | tools=[tool], 14 | verbose=True, 15 | allow_delegation=False 16 | ) 17 | 18 | task = Task( 19 | description="Answer the following questions about the image: {question}", 20 | expected_output="An answer to the question.", 21 | tools=[tool], 22 | agent=agent, 23 | ) 24 | 25 | crew = Crew( 26 | agents=[agent], 27 | tasks=[task], 28 | verbose=True, 29 | process=Process.sequential, 30 | ) 31 | 32 | while True: 33 | user_input = input("Enter a question about the image: ") 34 | 35 | if user_input == "exit": 36 | break 37 | else: 38 | question = user_input 39 | 40 | result = crew.kickoff(inputs={"question": question}) 41 | print(result) -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/auth.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pickle 3 | from googleapiclient.discovery import build 4 | from google_auth_oauthlib.flow import InstalledAppFlow 5 | from google.auth.transport.requests import Request 6 | 7 | SCOPES = ['https://www.googleapis.com/auth/drive.readonly'] 8 | 9 | def authenticate_drive(): 10 | """Authenticates and returns a Google Drive API service.""" 11 | creds = None 12 | if os.path.exists('token.pickle'): 13 | with open('token.pickle', 'rb') as token: 14 | creds = pickle.load(token) 15 | 16 | if not creds or not creds.valid: 17 | if creds and creds.expired and creds.refresh_token: 18 | creds.refresh(Request()) 19 | else: 20 | flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES) 21 | creds = flow.run_local_server(port=0) 22 | 23 | with open('token.pickle', 'wb') as token: 24 | pickle.dump(creds, token) 25 | 26 | return build('drive', 'v3', credentials=creds) -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/credentials.json: -------------------------------------------------------------------------------- 1 | replace this. -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/downloads/EarningsCall.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/google_drive_monitor/google_drive_meetings/downloads/EarningsCall.wav -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/downloads/example_construction_contract.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/google_drive_monitor/google_drive_meetings/downloads/example_construction_contract.pdf -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/.env.example: -------------------------------------------------------------------------------- 1 | AIRTABLE_API_KEY = 2 | AIRTABLE_BASE_ID = 3 | AIRTABLE_TABLE_NAME = 4 | 5 | LLAMA_API_KEY = 6 | 7 | OPENAI_API_KEY = 8 | 9 | TELEGRAM_BOT_TOKEN = 10 | TELEGRAM_CHAT_ID = 11 | 12 | AGENTOPS_API_KEY = -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/agentops.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/google_drive_monitor/google_drive_meetings/googledrive/agentops.log -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "googledrive" 3 | version = "0.1.0" 4 | description = "googledrive using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.100.1,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "googledrive.main:kickoff" 13 | plot = "googledrive.main:plot" 14 | 15 | [build-system] 16 | requires = ["hatchling"] 17 | build-backend = "hatchling.build" 18 | 19 | [tool.crewai] 20 | type = "flow" 21 | -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/src/googledrive/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/google_drive_monitor/google_drive_meetings/googledrive/src/googledrive/__init__.py -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/src/googledrive/crews/contractmanagement/config/agents.yaml: -------------------------------------------------------------------------------- 1 | contract_analyst: 2 | role: > 3 | Contract Management Expert 4 | goal: > 5 | Analyze the contract and extract the key terms and conditions. The contract content is: {contract_content} 6 | backstory: > 7 | You're a seasoned contract management expert with a knack for analyzing contracts and extracting the key terms and conditions. 8 | 9 | reporting_analyst: 10 | role: > 11 | Contract Management Reporting Analyst 12 | goal: > 13 | Create detailed reports based on contract analysis and research findings 14 | backstory: > 15 | You're a meticulous analyst with a keen eye for detail. You're known for 16 | your ability to turn complex data into clear and concise reports, making 17 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/src/googledrive/crews/contractmanagement/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | contract_analysis_task: 2 | description: > 3 | Analyze the contract and extract the key terms and conditions 4 | expected_output: > 5 | The key terms and conditions of the contract. Make sure to include all monetary terms, dates, and any other relevant information. 6 | agent: contract_analyst 7 | 8 | reporting_task: 9 | description: > 10 | Review the context you got and expand each topic into a full section for a report. 11 | Make sure the report is detailed and contains any and all relevant information. 12 | expected_output: > 13 | A fully fledged report with the main topics, each with a full section of information. 14 | Formatted as markdown without '```' 15 | agent: reporting_analyst 16 | -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/src/googledrive/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/google_drive_monitor/google_drive_meetings/googledrive/src/googledrive/tools/__init__.py -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/googledrive/src/googledrive/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from crewai.tools import BaseTool 4 | from pydantic import BaseModel, Field 5 | 6 | 7 | class MyCustomToolInput(BaseModel): 8 | """Input schema for MyCustomTool.""" 9 | 10 | argument: str = Field(..., description="Description of the argument.") 11 | 12 | 13 | class MyCustomTool(BaseTool): 14 | name: str = "Name of my tool" 15 | description: str = ( 16 | "Clear description for what this tool is useful for, your agent will need this information to use it." 17 | ) 18 | args_schema: Type[BaseModel] = MyCustomToolInput 19 | 20 | def _run(self, argument: str) -> str: 21 | # Implementation goes here 22 | return "this is an example of a tool output, ignore it and move along." 23 | -------------------------------------------------------------------------------- /google_drive_monitor/google_drive_meetings/telegram_messaging.py: -------------------------------------------------------------------------------- 1 | import os 2 | import requests 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | def send_telegram_message(message): 8 | """Sends a message to Telegram.""" 9 | 10 | TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN") # Replace with your bot token 11 | TELEGRAM_CHAT_ID = os.getenv("TELEGRAM_CHAT_ID") # Replace with your chat ID 12 | 13 | print(f"Sending message to Telegram: {TELEGRAM_BOT_TOKEN}") 14 | print(f"Chat ID: {TELEGRAM_CHAT_ID}") 15 | 16 | url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage" 17 | data = {"chat_id": TELEGRAM_CHAT_ID, "text": message} 18 | response = requests.post(url, data=data) 19 | 20 | if response.status_code == 200: 21 | print("✅ Telegram message sent!") 22 | else: 23 | print(f"❌ Failed to send Telegram message: {response.text}") 24 | 25 | if __name__ == "__main__": 26 | send_telegram_message("Hello, world!") -------------------------------------------------------------------------------- /item_picker/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /item_picker/knowledge/user_preference.txt: -------------------------------------------------------------------------------- 1 | User name is John Doe. 2 | User is an AI Engineer. 3 | User is interested in AI Agents. 4 | User is based in San Francisco, California. 5 | -------------------------------------------------------------------------------- /item_picker/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "item_picker" 3 | version = "0.1.0" 4 | description = "item_picker using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.121.0,<1.0.0" 9 | ] 10 | 11 | [project.scripts] 12 | item_picker = "item_picker.main:run" 13 | run_crew = "item_picker.main:run" 14 | train = "item_picker.main:train" 15 | replay = "item_picker.main:replay" 16 | test = "item_picker.main:test" 17 | 18 | [build-system] 19 | requires = ["hatchling"] 20 | build-backend = "hatchling.build" 21 | 22 | [tool.crewai] 23 | type = "crew" 24 | -------------------------------------------------------------------------------- /item_picker/src/item_picker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/item_picker/src/item_picker/__init__.py -------------------------------------------------------------------------------- /item_picker/src/item_picker/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior Data Researcher 4 | goal: > 5 | Uncover cutting-edge developments in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | 11 | reporting_analyst: 12 | role: > 13 | {topic} Reporting Analyst 14 | goal: > 15 | Create detailed reports based on {topic} data analysis and research findings 16 | backstory: > 17 | You're a meticulous analyst with a keen eye for detail. You're known for 18 | your ability to turn complex data into clear and concise reports, making 19 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /item_picker/src/item_picker/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Conduct a thorough research about {topic} 4 | Make sure you find any interesting and relevant information given 5 | the current year is {current_year}. 6 | expected_output: > 7 | A list with 10 bullet points of the most relevant information about {topic} 8 | agent: researcher 9 | 10 | reporting_task: 11 | description: > 12 | Review the context you got and expand each topic into a full section for a report. 13 | Make sure the report is detailed and contains any and all relevant information. 14 | expected_output: > 15 | A fully fledged report with the main topics, each with a full section of information. 16 | Formatted as markdown without '```' 17 | agent: reporting_analyst 18 | -------------------------------------------------------------------------------- /item_picker/src/item_picker/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/item_picker/src/item_picker/tools/__init__.py -------------------------------------------------------------------------------- /item_picker/src/item_picker/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from crewai.tools import BaseTool 2 | from typing import Type 3 | from pydantic import BaseModel, Field 4 | 5 | 6 | class MyCustomToolInput(BaseModel): 7 | """Input schema for MyCustomTool.""" 8 | argument: str = Field(..., description="Description of the argument.") 9 | 10 | class MyCustomTool(BaseTool): 11 | name: str = "Name of my tool" 12 | description: str = ( 13 | "Clear description for what this tool is useful for, your agent will need this information to use it." 14 | ) 15 | args_schema: Type[BaseModel] = MyCustomToolInput 16 | 17 | def _run(self, argument: str) -> str: 18 | # Implementation goes here 19 | return "this is an example of a tool output, ignore it and move along." 20 | -------------------------------------------------------------------------------- /mcp_crewai/images/MCP_Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/mcp_crewai/images/MCP_Diagram.png -------------------------------------------------------------------------------- /mcp_crewai/images/Model_Context_Protocol_Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/mcp_crewai/images/Model_Context_Protocol_Diagram.png -------------------------------------------------------------------------------- /n8n_crewai/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, jsonify 2 | from flask_cors import CORS 3 | from deep_fried.src.deep_fried.main import kickoff 4 | from datetime import datetime 5 | 6 | app = Flask(__name__) 7 | CORS(app) # This enables CORS for all routes 8 | 9 | @app.route('/process', methods=['POST']) 10 | def process_request(): 11 | # Get the JSON data from the request 12 | data = request.get_json() 13 | print(data) 14 | 15 | result = kickoff(data) 16 | 17 | # This is just a sample response 18 | sample_response = { 19 | "status": "success", 20 | "message": "Request processed successfully", 21 | "received_data": data, 22 | "sample_result": { 23 | "task": "completed", 24 | "timestamp": datetime.now().strftime("%Y-%m-%d"), 25 | "response": result 26 | } 27 | } 28 | 29 | return jsonify(sample_response) 30 | 31 | if __name__ == '__main__': 32 | app.run(debug=True, port=5003, host='0.0.0.0') -------------------------------------------------------------------------------- /n8n_crewai/deep_fried/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | -------------------------------------------------------------------------------- /n8n_crewai/deep_fried/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "deep_fried" 3 | version = "0.1.0" 4 | description = "deep_fried using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<=3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.85.0,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "deep_fried.main:kickoff" 13 | plot = "deep_fried.main:plot" 14 | 15 | [build-system] 16 | requires = ["hatchling"] 17 | build-backend = "hatchling.build" 18 | -------------------------------------------------------------------------------- /n8n_crewai/deep_fried/src/deep_fried/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/n8n_crewai/deep_fried/src/deep_fried/__init__.py -------------------------------------------------------------------------------- /n8n_crewai/deep_fried/src/deep_fried/crews/deep_fried_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | response_generator: 2 | role: > 3 | CrewAI Response Generator 4 | goal: > 5 | Generate a funny, light hearted response based on the following inputs: 6 | - {arrival_rating}: The rating of the arrival of the customer 7 | - {comments}: The comments of the customer 8 | - {feedback}: The feedback of the customer 9 | - {overall}: The overall rating of the customer 10 | - {timestamp}: The timestamp of the customer 11 | backstory: > 12 | You're a creative writer with a talent for crafting responses that are both 13 | funny and light hearted. You're known for your ability to craft responses 14 | that are both engaging and insightful. 15 | 16 | response_checker: 17 | role: > 18 | CrewAI Response Checker 19 | goal: > 20 | Check the response generated by the response generator to ensure it's both 21 | funny and light hearted. 22 | backstory: > 23 | You're a creative writer with a talent for crafting responses that are both 24 | funny and light hearted. You're known for your ability to craft responses 25 | that are both engaging and insightful. -------------------------------------------------------------------------------- /n8n_crewai/deep_fried/src/deep_fried/crews/deep_fried_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | response_generator: 2 | description: > 3 | Generate a response based on the following inputs: 4 | - {arrival_rating}: The rating of the arrival of the customer 5 | - {comments}: The comments of the customer 6 | - {feedback}: The feedback of the customer 7 | - {overall}: The overall rating of the customer 8 | - {timestamp}: The timestamp of the customer 9 | Ensure the response is both funny and light hearted. This is going to be sent to a customer in an email. 10 | expected_output: > 11 | A response that is both funny and light hearted, and is going to be sent to a customer in an email. 12 | agent: response_generator 13 | 14 | response_checker: 15 | description: > 16 | Check the response generated by the response generator to ensure it's both 17 | funny and light hearted. 18 | expected_output: > 19 | A response that is both funny and light hearted. 20 | agent: response_checker 21 | -------------------------------------------------------------------------------- /n8n_crewai/deep_fried/src/deep_fried/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/n8n_crewai/deep_fried/src/deep_fried/tools/__init__.py -------------------------------------------------------------------------------- /n8n_crewai/deep_fried/src/deep_fried/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from crewai.tools import BaseTool 4 | from pydantic import BaseModel, Field 5 | 6 | 7 | class MyCustomToolInput(BaseModel): 8 | """Input schema for MyCustomTool.""" 9 | 10 | argument: str = Field(..., description="Description of the argument.") 11 | 12 | 13 | class MyCustomTool(BaseTool): 14 | name: str = "Name of my tool" 15 | description: str = ( 16 | "Clear description for what this tool is useful for, you agent will need this information to use it." 17 | ) 18 | args_schema: Type[BaseModel] = MyCustomToolInput 19 | 20 | def _run(self, argument: str) -> str: 21 | # Implementation goes here 22 | return "this is an example of a tool output, ignore it and move along." 23 | -------------------------------------------------------------------------------- /openai_image_gen/image_editing.py: -------------------------------------------------------------------------------- 1 | import base64 2 | from openai import OpenAI 3 | from dotenv import load_dotenv 4 | import os 5 | 6 | load_dotenv() 7 | 8 | client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"), organization=os.getenv("OPENAI_ORGANIZATION")) 9 | 10 | prompt = """ 11 | Generate a photorealistic image of a gift basket on a white background 12 | labeled 'Relax & Unwind' with a ribbon and handwriting-like font, 13 | containing all the items in the reference pictures. 14 | """ 15 | 16 | result = client.images.edit( 17 | model="gpt-image-1", 18 | image=[ 19 | open("images_edit/body-lotion.png", "rb"), 20 | open("images_edit/bath-bomb.png", "rb"), 21 | open("images_edit/incense-kit.png", "rb"), 22 | open("images_edit/soap.png", "rb"), 23 | ], 24 | prompt=prompt 25 | ) 26 | 27 | image_base64 = result.data[0].b64_json 28 | image_bytes = base64.b64decode(image_base64) 29 | 30 | # Save the image to a file 31 | with open("images_output/gift-basket.png", "wb") as f: 32 | f.write(image_bytes) -------------------------------------------------------------------------------- /openai_image_gen/image_inpainting.py: -------------------------------------------------------------------------------- 1 | from openai import OpenAI 2 | from dotenv import load_dotenv 3 | import os 4 | import base64 5 | 6 | load_dotenv() 7 | 8 | client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"), organization=os.getenv("OPENAI_ORGANIZATION")) 9 | 10 | result = client.images.edit( 11 | model="gpt-image-1", 12 | image=open("images_inpainting/sunlit_lounge.png", "rb"), 13 | mask=open("images_inpainting/mask.png", "rb"), 14 | prompt="A sunlit indoor lounge area with a pool containing a flamingo" 15 | ) 16 | 17 | image_base64 = result.data[0].b64_json 18 | image_bytes = base64.b64decode(image_base64) 19 | 20 | # Save the image to a file 21 | with open("images_output/composition.png", "wb") as f: 22 | f.write(image_bytes) -------------------------------------------------------------------------------- /openai_image_gen/images_edit/bath-bomb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_edit/bath-bomb.png -------------------------------------------------------------------------------- /openai_image_gen/images_edit/body-lotion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_edit/body-lotion.png -------------------------------------------------------------------------------- /openai_image_gen/images_edit/incense-kit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_edit/incense-kit.png -------------------------------------------------------------------------------- /openai_image_gen/images_edit/soap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_edit/soap.png -------------------------------------------------------------------------------- /openai_image_gen/images_inpainting/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_inpainting/mask.png -------------------------------------------------------------------------------- /openai_image_gen/images_inpainting/sunlit_lounge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_inpainting/sunlit_lounge.png -------------------------------------------------------------------------------- /openai_image_gen/images_output/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_output/cat.png -------------------------------------------------------------------------------- /openai_image_gen/images_output/composition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_output/composition.png -------------------------------------------------------------------------------- /openai_image_gen/images_output/gift-basket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_output/gift-basket.png -------------------------------------------------------------------------------- /openai_image_gen/images_output/image_gen1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_output/image_gen1.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/ClassicTopHat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/ClassicTopHat.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/Code Overview Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/Code Overview Diagram.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/Detailed Code Explanation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/Detailed Code Explanation.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/MagicWizardHat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/MagicWizardHat.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/QuirkyAnimalBeanie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/QuirkyAnimalBeanie.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/WideBrimSunhat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/WideBrimSunhat.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/Workflow Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/Workflow Diagram.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/WornFarmersCap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/WornFarmersCap.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/cowboy_hat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/cowboy_hat.png -------------------------------------------------------------------------------- /openai_image_gen/images_pixel_art_output/witch_hat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_image_gen/images_pixel_art_output/witch_hat.png -------------------------------------------------------------------------------- /openai_swarm/main.py: -------------------------------------------------------------------------------- 1 | from swarm import Swarm, Agent 2 | 3 | client = Swarm() 4 | 5 | def transfer_to_agent_b(): 6 | return agent_b 7 | 8 | 9 | agent_a = Agent( 10 | name="Agent A", 11 | instructions="You are a helpful agent.", 12 | functions=[transfer_to_agent_b], 13 | ) 14 | 15 | agent_b = Agent( 16 | name="Agent B", 17 | instructions="Only speak in Haikus.", 18 | ) 19 | 20 | response = client.run( 21 | agent=agent_a, 22 | messages=[{"role": "user", "content": "I want to talk to agent B."}], 23 | stream=True, 24 | ) 25 | 26 | # for streaming 27 | message = "" 28 | for chunk in response: 29 | # Check if content exists and is not None 30 | if chunk.get('content'): 31 | message += chunk['content'] 32 | # If you want to see each piece as it comes in: 33 | print(chunk['content'], end='') 34 | 35 | # for non-streaming 36 | # print(response.messages[-1]["content"]) -------------------------------------------------------------------------------- /openai_swarm/personal_shopper/application.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/openai_swarm/personal_shopper/application.db -------------------------------------------------------------------------------- /openai_swarm/weather_agent/agents.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from swarm import Agent 4 | 5 | 6 | def get_weather(location, time="now"): 7 | """Get the current weather in a given location. Location MUST be a city.""" 8 | return json.dumps({"location": location, "temperature": "65", "time": time}) 9 | 10 | 11 | def send_email(recipient, subject, body): 12 | print("Sending email...") 13 | print(f"To: {recipient}") 14 | print(f"Subject: {subject}") 15 | print(f"Body: {body}") 16 | return "Sent!" 17 | 18 | 19 | weather_agent = Agent( 20 | name="Weather Agent", 21 | instructions="You are a helpful agent.", 22 | functions=[get_weather, send_email], 23 | ) -------------------------------------------------------------------------------- /openai_swarm/weather_agent/run.py: -------------------------------------------------------------------------------- 1 | from swarm.repl import run_demo_loop 2 | from agents import weather_agent 3 | 4 | # run the demo loop 5 | # it has the while True loop that allows you to keep interacting with the agent 6 | # stream=True allows for streaming responses 7 | # it does make sure you have a valid city 8 | if __name__ == "__main__": 9 | run_demo_loop(weather_agent, stream=True) -------------------------------------------------------------------------------- /pydanticai/hello-world.py: -------------------------------------------------------------------------------- 1 | from pydantic_ai import Agent 2 | 3 | agent = Agent( 4 | 'openai:gpt-4o', 5 | system_prompt='Be concise, reply with one sentence.', 6 | ) 7 | 8 | result = agent.run_sync('Where does "hello world" come from?') 9 | print(result.data) -------------------------------------------------------------------------------- /repo_images/edit_software_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/repo_images/edit_software_after.png -------------------------------------------------------------------------------- /repo_images/edit_software_after_tests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/repo_images/edit_software_after_tests.png -------------------------------------------------------------------------------- /repo_images/edit_software_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/repo_images/edit_software_before.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/requirements.txt -------------------------------------------------------------------------------- /saas_products/password/OAI_CONFIG_LIST: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "gpt-3.5-turbo", 4 | "api_key": "sk-1111" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /smolagents/01 - first project.py: -------------------------------------------------------------------------------- 1 | from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel 2 | 3 | agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel()) 4 | 5 | agent.run("How long would it take for an elephant to cross the united states from florida to california?") 6 | -------------------------------------------------------------------------------- /smolagents/02 - e2b.py: -------------------------------------------------------------------------------- 1 | from smolagents import CodeAgent, VisitWebpageTool, HfApiModel 2 | 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | agent = CodeAgent( 8 | tools = [VisitWebpageTool()], 9 | model=HfApiModel(), 10 | additional_authorized_imports=["requests", "markdownify"], 11 | use_e2b_executor=True 12 | ) 13 | 14 | agent.run("What was Abraham Lincoln's preferred pet?") -------------------------------------------------------------------------------- /smolagents/03 - custom tool.py: -------------------------------------------------------------------------------- 1 | from smolagents import CodeAgent, HfApiModel 2 | from smolagents import tool 3 | from huggingface_hub import list_models 4 | 5 | from dotenv import load_dotenv 6 | 7 | load_dotenv() 8 | 9 | @tool 10 | def model_download_tool(task: str) -> str: 11 | """ 12 | This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. 13 | It returns the name of the checkpoint. 14 | 15 | Args: 16 | task: The task for which to get the download count. 17 | """ 18 | most_downloaded_model = next(iter(list_models(filter=task, sort="downloads", direction=-1))) 19 | 20 | return most_downloaded_model.id 21 | 22 | 23 | agent = CodeAgent(tools=[model_download_tool], model=HfApiModel()) 24 | agent.run( 25 | "Give me the most downloaded model for text-generation on the Hugging Face Hub." 26 | ) -------------------------------------------------------------------------------- /smolagents/06 - any llm.py: -------------------------------------------------------------------------------- 1 | from smolagents import LiteLLMModel 2 | from dotenv import load_dotenv 3 | 4 | load_dotenv() 5 | 6 | messages = [] 7 | model = LiteLLMModel("openai/gpt-4o", temperature=0.2) 8 | 9 | while True: 10 | user_input = input("Enter a message: ") 11 | 12 | if user_input == "exit": 13 | break 14 | 15 | messages.append({"role": "user", "content": user_input}) 16 | 17 | response = model(messages, max_tokens=500) 18 | assistant_message = response.content 19 | 20 | print("Assistant:", assistant_message) 21 | messages.append({"role": "assistant", "content": assistant_message}) 22 | -------------------------------------------------------------------------------- /smolagents/07 - import spaces.py: -------------------------------------------------------------------------------- 1 | from smolagents import CodeAgent, VisitWebpageTool, HfApiModel, Tool 2 | 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | get_travel_duration_tool = Tool.from_space( 8 | "m-ric/get-travel-duration-tool", 9 | name="get_travel_duration_tool", 10 | description="Get the travel duration between two locations" 11 | ) 12 | 13 | response = get_travel_duration_tool("Paris", "London") 14 | print(response) -------------------------------------------------------------------------------- /smolagents/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/smolagents/cat.png -------------------------------------------------------------------------------- /smolagents/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerprogramming/ai/6b82238bb3192f62f2714d2d22e40b022b83bfcf/smolagents/image.png --------------------------------------------------------------------------------