珠宝怎么做网站/南昌seo招聘信息
Agents:
- Role 角色
- Goal 目标
- Backstory 背景故事
Tasks:
- Description 描述
- Expected Output 期望输出
- Agent 代理
Automated Project: Planning, Estimation, and Allocation
Initial Imports
1.本地文件helper.py
# Add your utilities or helper functions to this file.import os
from dotenv import load_dotenv, find_dotenvdef load_env():_ = load_dotenv(find_dotenv())def get_openai_api_key():load_env()openai_api_key = os.getenv("OPENAI_API_KEY")return openai_api_key
2. pip install crewai
3. 导入相应库
# Warning control
import warnings
warnings.filterwarnings('ignore')# Load environment variables
from helper import load_env
load_env()import os
import yaml
from crewai import Agent, Task, Crew
Set OpenAI Model
os.environ['OPENAI_MODEL_NAME'] = 'gpt-4o-mini'
Loading Tasks and Agents YAML files
# Define file paths for YAML configurations
files = {'agents': 'config/agents.yaml','tasks': 'config/tasks.yaml'
}# Load configurations from YAML files
configs = {}
for config_type, file_path in files.items():with open(file_path, 'r') as file:configs[config_type] = yaml.safe_load(file)# Assign loaded configurations to specific variables
agents_config = configs['agents']
tasks_config = configs['tasks']
Create Pydantic Models for Structured Output
from typing import List
from pydantic import BaseModel, Fieldclass TaskEstimate(BaseModel):task_name: str = Field(..., description="Name of the task")estimated_time_hours: float = Field(..., description="Estimated time to complete the task in hours")required_resources: List[str] = Field(..., description="List of resources required to complete the task")class Milestone(BaseModel):milestone_name: str = Field(..., description="Name of the milestone")tasks: List[str] = Field(..., description="List of task IDs associated with this milestone")class ProjectPlan(BaseModel):tasks: List[TaskEstimate] = Field(..., description="List of tasks with their estimates")milestones: List[Milestone] = Field(..., description="List of project milestones")
Create Crew, Agents and Tasks
# Creating Agents
project_planning_agent = Agent(config=agents_config['project_planning_agent']
)estimation_agent = Agent(config=agents_config['estimation_agent']
)resource_allocation_agent = Agent(config=agents_config['resource_allocation_agent']
)# Creating Tasks
task_breakdown = Task(config=tasks_config['task_breakdown'],agent=project_planning_agent
)time_resource_estimation = Task(config=tasks_config['time_resource_estimation'],agent=estimation_agent
)resource_allocation = Task(config=tasks_config['resource_allocation'],agent=resource_allocation_agent,output_pydantic=ProjectPlan # This is the structured output we want
)# Creating Crew
crew = Crew(agents=[project_planning_agent,estimation_agent,resource_allocation_agent],tasks=[task_breakdown,time_resource_estimation,resource_allocation],verbose=True
)
Crew's Inputs
from IPython.display import display, Markdownproject = 'Website'
industry = 'Technology'
project_objectives = 'Create a website for a small business'
team_members = """
- John Doe (Project Manager)
- Jane Doe (Software Engineer)
- Bob Smith (Designer)
- Alice Johnson (QA Engineer)
- Tom Brown (QA Engineer)
"""
project_requirements = """
- Create a responsive design that works well on desktop and mobile devices
- Implement a modern, visually appealing user interface with a clean look
- Develop a user-friendly navigation system with intuitive menu structure
- Include an "About Us" page highlighting the company's history and values
- Design a "Services" page showcasing the business's offerings with descriptions
- Create a "Contact Us" page with a form and integrated map for communication
- Implement a blog section for sharing industry news and company updates
- Ensure fast loading times and optimize for search engines (SEO)
- Integrate social media links and sharing capabilities
- Include a testimonials section to showcase customer feedback and build trust
"""# Format the dictionary as Markdown for a better display in Jupyter Lab
formatted_output = f"""
**Project Type:** {project}**Project Objectives:** {project_objectives}**Industry:** {industry}**Team Members:**
{team_members}
**Project Requirements:**
{project_requirements}
"""
# Display the formatted output as Markdown
display(Markdown(formatted_output))
Kicking off the crew
# The given Python dictionary
inputs = {'project_type': project,'project_objectives': project_objectives,'industry': industry,'team_members': team_members,'project_requirements': project_requirements
}# Run the crew
result = crew.kickoff(inputs=inputs
)
Usage Metrics and Costs
import pandas as pdcosts = 0.150 * (crew.usage_metrics.prompt_tokens + crew.usage_metrics.completion_tokens) / 1_000_000
print(f"Total costs: ${costs:.4f}")# Convert UsageMetrics instance to a DataFrame
df_usage_metrics = pd.DataFrame([crew.usage_metrics.dict()])
df_usage_metrics
Result
result.pydantic.dict()
Inspect further
tasks = result.pydantic.dict()['tasks']
df_tasks = pd.DataFrame(tasks)# Display the DataFrame as an HTML table
df_tasks.style.set_table_attributes('border="1"').set_caption("Task Details").set_table_styles([{'selector': 'th, td', 'props': [('font-size', '120%')]}]
)
Inspecting Milestones
milestones = result.pydantic.dict()['milestones']
df_milestones = pd.DataFrame(milestones)# Display the DataFrame as an HTML table
df_milestones.style.set_table_attributes('border="1"').set_caption("Task Details").set_table_styles([{'selector': 'th, td', 'props': [('font-size', '120%')]}]
)
相关文章:

AI Agents - 自动化项目:计划、评估和分配
Agents: Role 角色Goal 目标Backstory 背景故事 Tasks: Description 描述Expected Output 期望输出Agent 代理 Automated Project: Planning, Estimation, and Allocation Initial Imports 1.本地文件helper.py # Add your utilities or helper functions to…...

Git的.gitignore文件
一、各语言对应的.gitignore模板文件 项目地址:https://github.com/github/gitignore 二、.gitignore文件不生效 .gitignore文件只是ignore没有被追踪的文件,已被追踪的文件,要先删除缓存文件。 # 单个文件 git rm --cached file/path/to…...

网站安全,WAF网站保护暴力破解
雷池的核心功能 通过过滤和监控 Web 应用与互联网之间的 HTTP 流量,功能包括: SQL 注入保护:防止恶意 SQL 代码的注入,保护网站数据安全。跨站脚本攻击 (XSS):阻止攻击者在用户浏览器中执行恶意脚本。暴力破解防护&a…...

深度学习:梯度下降算法简介
梯度下降算法简介 梯度下降算法 我们思考这样一个问题,现在需要用一条直线来回归拟合这三个点,直线的方程是 y w ^ x b y \hat{w}x b yw^xb,我们假设斜率 w ^ \hat{w} w^是已知的,现在想要找到一个最好的截距 b b b。 一条…...

SparkSQL整合Hive后,如何启动hiveserver2服务
当spark sql与hive整合后,我们就无法启动hiveserver2的服务了,每次都要先启动hive的元数据服务(nohup hive --service metastore)才能启动hive,之前的beeline命令也用不了,hiveserver2的无法启动,这也导致我…...

前端路由如何从0开始配置?vue-router 的使用
在 Web 开发中,路由是指根据 URL 的不同部分将请求分发到不同的处理函数或页面的过程。路由是单页应用(SPA, Single Page Application)和服务器端渲染(SSR, Server-Side Rendering)应用中的一个重要概念。 在开发中如何…...

Java中的运算符【与C语言的区别】
目录 1. 算术运算符 1.0 赋值运算符: 1.1 四则运算符: - * / % 【取余与C有点不同】 1.2 增量运算符: - * / % * 【右侧运算结果会自动转换类型】 1.3 自增、自减:、-- 2. 关系运算符 3. 逻辑运算符 3.1 短路求值 3.2 【…...

二、基础语法
入门了解 注释 **作用:**在代码中加一些注释和说明,方便自己或者其他程序员阅读代码 两种格式: 单行注释:// 描述信息 通常放在一行代码的上方,或者一条语句的末尾,对该行代码进行说明 多行注释&#x…...

DB-GPT系列(一):DB-GPT能帮你做什么?
DB-GPT是一个开源的AI原生数据应用开发框架(AI Native Data App Development framework with AWEL and Agents),围绕大模型提供灵活、可拓展的AI原生数据应用管理与开发能力,可以帮助企业快速构建、部署智能AI数据应用,通过智能数据分析、洞察…...

【Python各个击破】numpy
简介 NumPy是一个开源的Python库,它提供了一个强大的N维数组对象和许多用于操作这些数组的函数。它是大多数Python科学计算的基础,包括Pandas、SciPy和scikit-learn等库都建立在NumPy之上。 安装 !pip install numpy导入 import numpy as np用法 # …...

【STM32 Blue Pill编程实例】-4位7段数码管使用
4位7段数码管使用 文章目录 4位7段数码管使用1、7段数码介绍2、硬件准备与接线3、模块配置4、代码实现在本文中,我们将介绍如何将 STM32 Blue Pill开发板与 4 位 7 段数码管连接,并在 STM32CubeIDE 中对其进行编程。 在文章中首先将介绍 4 位 7 段数码管及其与 STM32 Blue Pi…...

[进阶]java基础之集合(三)数据结构
文章目录 数据结构概述常见的数据结构数据结构(栈)数据结构(队列)数据结构(数组)数据结构(链表) 数据结构 概述 数据结构是计算机底层存储、组织数据的方式。是指数据相互之间是以什么方式排列在一起的。数据结构是为了更加方便的管理和使用数据,需要结合具体的业…...

《Apache Cordova/PhoneGap 使用技巧分享》
一、引言 在移动应用开发的领域中,Apache Cordova(也被称为 PhoneGap)是一个强大的工具,它允许开发者使用 HTML、CSS 和 JavaScript 等 Web 技术来构建跨平台的移动应用。这种方式不仅能够提高开发效率,还能降低开发成…...

SCP(Secure Copy
SCP(Secure Copy)是Linux系统下基于SSH协议的安全文件传输工具,用于在本地和远程主机间安全、快速地传输文件和目录。SCP命令通过加密传输确保数据的安全性,并且不占用过多系统资源。 SCP的基本用法 基本语法:…...

uniApp 省市区自定义数据
关于自定义省市区选择 其实也是用了 uniApp的内置组件 picker <picker mode"multiSelector" change"bindRegionChange" columnchange"bindMultiPickerColumnChange" :value"valueRegion" :range"multiArray"><v…...

图解Redis 06 | Hash数据类型的原理及应用场景
介绍 Hash 类型特别适合存储对象,例如用户信息等。 String类型也可以用于存储用户信息,Hash与String存储用户信息的区别如下图所示: 内部实现 Hash 类型 的底层数据结构是通过压缩列表(Ziplist)或哈希表ÿ…...

在 Windows 系统上设置 MySQL8.0以支持远程连接
在 Windows 系统上设置 MySQL8.0以支持远程连接的步骤如下: 步骤1: 修改 MySQL 配置文件1. 找到配置文件: MySQL 的配置文件通常为 my.ini,通常位于 C:\ProgramData\MySQL\MySQL Server8.0\(确保查看隐藏文件和文件夹)…...

四种基本的编程命名规范
目前,共有四种基本的编程命名规范,分别是匈牙利命名法、驼峰式命名法、帕斯卡命名法和下划线命名法,其中前三种命名法较为流行。 例如:iMyData是一个匈牙利命名法;myData是一个驼峰式命名法;MyData是一个帕…...

【前端】在 TypeScript 中使用 AbortController 取消异步请求
在 TypeScript 中使用 AbortController 来取消异步请求,尤其是像 fetch 这样的请求,可以提供一种优雅的方式来中止长时间运行的操作。下面是一个详细的步骤说明,展示如何在 TypeScript 中使用 AbortController 取消 fetch 请求。 步骤 1&…...

k8s知识点总结
docker 名称空间 分类 Docker中的名称空间用于提供进程隔离,确保容器之间的资源相互独立。主要分类包括: PID Namespace:进程ID隔离,使每个容器有自己的进程树,容器内的进程不会干扰其他容器或主机上的进程。 NET Nam…...

论文阅读:三星-TinyClick
《Single-Turn Agent for Empowering GUI Automation》 赋能GUI自动化的单轮代理 摘要 我们介绍了一个用于图形用户界面(GUI)交互任务的单轮代理,使用了视觉语言模型Florence-2-Base。该代理的主要任务是识别与用户指令相对应的UI元素的屏幕…...

Windows on ARM上使用sherpa-onnx实现语音识别
Windows on ARM上使用sherpa-onnx实现语音识别 下载模型准备声音文件测试下载模型 模型所在的地址在这里(),通过git命令将模型下载下来 模型:hfd地址 git clone https://hf-mirror.com/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en将如下的代码保存成一个…...

Unity 打包AB Timeline 引用丢失,错误问题
1、裁剪 在 link.xml 添加 <assembly fullname"Unity.Timeline" preserve"all"/> 上面这一步我其实做了,但还是不行,各种搜索,不得解,还有创建一个空的Timeline 放到 Resources目录下的,也…...

【Kettle的安装与使用】使用Kettle实现mysql和hive的数据传输(使用Kettle将mysql数据导入hive、将hive数据导入mysql)
文章目录 一、安装1、解压2、修改字符集3、启动 二、实战1、将hive数据导入mysql2、将mysql数据导入到hive 一、安装 Kettle的安装包在文章结尾 1、解压 在windows中解压到一个非中文路径下 2、修改字符集 修改 spoon.bat 文件 "-Dfile.encodingUTF-8"3、启动…...

STM32的hal库在实现延时函数(例如:Delay_ms 等)为什么用滴答定时(Systick)而不是定时器定时中断,也不是RTC?
STM32的HAL库在实现延时函数(如Delay_ms等)时选择使用滴答定时器(Systick)而非定时器定时中断或RTC(实时时钟),主要基于以下几个原因: Systick定时器的优势 集成在NVIC中ÿ…...

刚刚买的域名被DNS劫持了怎么处理
在当今数字化的时代,域名作为网络世界的重要标识,对于个人和企业的在线业务都至关重要。然而,有时会遭遇令人头疼的问题,比如新买的域名被DNS劫持。这不仅会影响网站的正常访问,还可能导致用户信息泄露、业务受损等严重…...

递归 算法专题
递归题目技巧 什么是递归 函数自己调用自己的情况为什么会用到递归 本质: 主问题, 可以拆分成相同的子问题 子问题, 又可以拆分出相同的子问题如何理解递归? 宏观的看待递归的过程 1)不要在意递归的细节展开图 2)把递归的函数当成一个黑盒 3)相信这个黑盒一定能够完成这个任务…...

Logstash 迁移索引元数据(设置和映射)
https://help.aliyun.com/zh/es/use-cases/use-logstash-to-migrate-full-or-incremental-data-from-self-managed-elasticsearch-to-alibaba-cloud-elasticsearch 在进行数据迁移时,Logstash会帮助您自动创建索引,但是自动创建的索引可能与您待迁移的索…...

用python将pdf转成图片转换成对应的word文件
*科管系统**报告只能上传word,但是有些盖章文件只有pdf版本,因此有这个需求,目前市面上没这软件,只能自己python写一个。 要将PDF中的页面以图片的形式存储到Word文档中,你需要完成以下几个步骤: 从PDF中…...

list(c++)
list介绍 list是STL容器中的容器,且元素在容器中的位置是分散的并与大小无关。list的底层是双向链表,其优势是在任意位置插入和删除元素的时间复杂度为O(1),但无法通过“下标[ ]”直接访问元素,需要通过从头(尾&#…...