import openai openai.api_key = "your_sk" # prompt (assuming md_resume and job_desciption have been defined) prompt = f""" I have a resume formatted in Markdown and a job description. \ Please adapt my resume to better align with the job requirements while \ maintaining a professional tone. Tailor my skills, experiences, and \ achievements to highlight the most relevant points for the position. \ Ensure that my resume still reflects my unique qualifications and strengths \ but emphasizes the skills and experiences that match the job description. ### Here is my resume in Markdown: {md_resume} ### Here is the job description: {job_desciption} Please modify the resume to: - Use keywords and phrases from the job description. - Adjust the bullet points under each role to emphasize relevant skills and achievements. - Make sure my experiences are presented in a way that matches the required qualifications. - Maintain clarity, conciseness, and professionalism throughout. Return the updated resume in Markdown format. """ # 堆代码 duidaima.com # make api call response = openai.chat.completions.create( model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": prompt} ], temperature = 0.25 ) # extract response resume = response.choices[0].message.content通过这种方式,你可以显著提升调整简历的效率,同时确保内容与职位需求高度匹配。
4.使用 OpenAI 的 Python API 将整个流程自动化。
import re from youtube_transcript_api import YouTubeTranscriptApi youtube_url = "video link here" # extract video ID with regex video_id_regex = r'(?:v=|\/)([0-9A-Za-z_-]{11}).*' match = re.search(video_id_regex, youtube_url) if match: return match.group(1) else: return None # extract transcript text_list = [transcript[i]['text'] for i in range(len(transcript))] transcript_text = '\n'.join(text_list)通过这种工具,你可以快速生成技术演讲的摘要和要点,大幅提高信息获取的效率。
4.为每个聚类创建一个文件夹,并将相应的文件移动到对应的文件夹中。
from sentence_transformers import SentenceTransformer # load embedding model model = SentenceTransformer("all-MiniLM-L6-v2") # store abstracts in a list abstract_list = ["abstract 1", "abstract 2"] # calculate embeddings embeddings = model.encode(abstract_list)通过此工具,你可以快速整理并分类大量技术论文,轻松管理和查找所需的文档内容。
6.返回相似度得分最高的前 k 个结果。
import fitz # PyMuPDF def extract_text_chunks(pdf_path, chunk_size, overlap_size): # Open the PDF file pdf_document = fitz.open(pdf_path) chunks = [] # Iterate through each page in the PDF for page_num in range(len(pdf_document)): page = pdf_document[page_num] page_text = page.get_text() # Split the text from the current page into chunks with overlap start = 0 while start < len(page_text): end = start + chunk_size chunk = page_text[start:end] # Store the page number with the chunk chunks.append((page_num + 1, chunk)) # Move to the next chunk with the overlap start += chunk_size - overlap_size return chunks # Parameters for extraction pdf_path = "your_file.pdf" chunk_size = 1000 # Size of each text chunk in characters overlap_size = 200 # Overlap size in characters text_chunks = extract_text_chunks_with_page_numbers(pdf_path, chunk_size, overlap_size) # Display the chunks with page numbers for i, (page_number, chunk) in enumerate(text_chunks): print(f"Chunk {i + 1} (Page {page_number}):\n{chunk}\n{'-' * 50}")通过这种多模态搜索工具,你可以显著提升在技术报告、研究论文等复杂文档中查找关键内容的效率。将图表和文本结合起来,可以更全面地捕捉有价值的信息。
import gradio as gr import time def generate_response(message, history): """ Your code for generating a response """ return response demo = gr.ChatInterface( fn=generate_response, examples=[{"text": "Hello", "files": []}], title="Echo Bot", multimodal=True) demo.launch()通过这种问答系统,用户可以轻松地查询知识库中的相关信息并获得直接的回答。这种多模态 RAG 系统结合了图像与文本处理能力,适用于技术文档、研究报告或企业内部知识库的复杂查询需求。