当前位置: 首页 > wzjs >正文

wordpress 外网内蒙古seo优化

wordpress 外网,内蒙古seo优化,做变形记图网站,开一家网站建设公司要多少钱简历信息提取系统,使用Pydantic模型定义数据结构,并通过大语言模型(如GPT)从非结构化的简历文本中提取结构化信息。以下是详细解析: 核心功能 数据建模:用Pydantic的Resume类严格定义简历字段和校验规则。 …

简历信息提取系统,使用Pydantic模型定义数据结构,并通过大语言模型(如GPT)从非结构化的简历文本中提取结构化信息。以下是详细解析:


核心功能

  1. 数据建模:用Pydantic的Resume类严格定义简历字段和校验规则。

  2. 格式转换:自动统一日期格式(如1990-05-1505-15-1990)。

  3. 大模型交互:通过Prompt工程让AI提取信息并返回标准JSON。


核心代码

from datetime import datetime, date
from typing import List, Optional
from pydantic import BaseModel, Field, field_validator, EmailStr, model_validator# 定义这个pydantic模型是关键的关键
class Resume(BaseModel):name: Optional[str] = Field(None, description="求职者姓名,如果没找到就置为空字符串")city: Optional[str] = Field(None, description="求职者居住地,如果没找到就置为空字符串")birthday: Optional[str] = Field(None, description="求职者生日,如果没找到就置为空字符串")phone: Optional[str] = Field(None, description="求职者手机号,如果没找到就置为空字符串")email: Optional[str] = Field(None, description="求职者邮箱,如果没找到就置为空字符串")education: Optional[List[str]] = Field(None, description="求职者教育背景")experience: Optional[List[str]] = Field(None, description="求职者工作或实习经历,如果没找到就置为空字符串")project: Optional[List[str]] = Field(None, description="求职者项目经历,如果没找到就置为空字符串")certificates: Optional[List[str]] = Field(None, description="求职者资格证书,如果没找到就置为空字符串")@field_validator("birthday", mode="before")def validate_and_convert_date(cls, raw_date):if raw_date is None:return Noneif isinstance(raw_date, str):# List of acceptable date formatsdate_formats = ['%d-%m-%Y', '%Y-%m-%d', '%d/%m/%Y', '%m-%d-%Y']for fmt in date_formats:try:# Attempt to parse the date string with the current formatparsed_date = datetime.strptime(raw_date, fmt).date()# Return the date in MM-DD-YYYY format as a stringreturn parsed_date.strftime('%m-%d-%Y')except ValueError:continue  # Try the next format# If none of the formats match, raise an errorraise ValueError(f"Invalid date format for 'consultation_date'. Expected one of: {', '.join(date_formats)}.")if isinstance(raw_date, date):# Convert date object to MM-DD-YYYY formatreturn raw_date.strftime('%m-%d-%Y')raise ValueError("Invalid type for 'consultation_date'. Must be a string or a date object.")class ResumeOpenAI:def __init__(self):self.resume_profile = Resume()self.output_schema = self.resume_profile.model_json_schema()self.template = """You are an expert in analyzing resumes. Use the following JSON schema to extract relevant information:```json{output_schema}```jsonExtract the information from the following document and provide a structured JSON response strictly adhering to the schema above. Please remove any ```json ``` characters from the output. Do not make up any information. If a field cannot be extracted, mark it as `n/a`.Document:----------------{resume_content}----------------"""def create_prompt(self, output_schema, resume_content):return self.template.format(output_schema=output_schema,resume_content=resume_content)def run(self, resume_content):try:response = client.chat.completions.create(model=chat_model,# 不是所有模型都支持response_format,要看一下调用的模型是否支持这个参数# 千问、智谱的模型一般支持response_format={ "type": "json_object" },messages=[{"role": "system", "content": "你是一位专业的简历信息提取专家。"},{"role": "user", "content": self.create_prompt(self.output_schema, resume_content)}],)result = response.choices[0].message.contentexcept Exception as e:print(f"Error occurred: {e}")return resultresume_openai = ResumeOpenAI()

http://www.dtcms.com/wzjs/469594.html

相关文章:

  • 自己做公众号和小说网站推广目前病毒的最新情况
  • 做企业规划的网站片多多可以免费看电视剧吗
  • 赣icp上饶网站建设网络营销策略的概念
  • 我做的网站怎么提升排名成都百度seo推广
  • 建站工作室 网站建设工作室百度收录入口在哪里查询
  • 官网建站合作模版腾讯广告投放平台官网
  • 丝绸之路网站建设线上销售平台有哪些
  • 网站建设怎么把代码放入网站上百度广告商
  • 建设网站注意什么百度浏览器入口
  • 沈阳网站建设建设公司排名他达拉非片的作用及功效副作用
  • 美国一级a做爰片免网站 视频教程网店推广方法有哪些
  • 微山县建设.局网站百度推销广告一年多少钱
  • 登录河北建设厅网站进入不了网店代运营的套路
  • 专业的移动网站建设公sem优化技巧
  • 企业官方网站建设如何鸿科经纬教网店运营推广
  • 做网站手把手淘宝推广工具
  • 东莞工程建设交易中心网seo免费推广
  • ae做的动效怎么放在网站上抖音关键词优化
  • 做网站需要哪几个板块广州网站关键词排名
  • 网站安全注意哪些问题吗百度认证服务平台
  • 展览展会公司关于seo如何优化
  • 数据网站建设工具模板国际新闻最新消息2022
  • 红酒公司网站建设镇江百度推广
  • 青海省网站建设平台新品怎么刷关键词
  • ?]后台的网站可以备案吗如何建网站要什么条件
  • 1688黄页网生产企业滁州网站seo
  • 网站怎么做自营销seo检查工具
  • 宝安网站建设 名匠广州番禺最新发布
  • 公司网站备案怎么办理视频广告联盟平台
  • 广西城乡和建设厅网站首页搜索引擎营销总结