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

南川网站建设公司网页设计图片轮播代码

南川网站建设公司,网页设计图片轮播代码,建筑图纸字母代表大全图解,网站开发 在线报名感觉这个目前没有什么用#xff0c;因为客户可以直接问通用chatGPT#xff0c;实时了解你网站内的信息#xff0c;除非你的网站chatGPT无法访问。 不过自动预订、买票等用嵌入还是挺有用的。 什么是嵌入#xff1f; OpenAI的嵌入#xff08;embeddings#xff09;是一种…感觉这个目前没有什么用因为客户可以直接问通用chatGPT实时了解你网站内的信息除非你的网站chatGPT无法访问。 不过自动预订、买票等用嵌入还是挺有用的。 什么是嵌入 OpenAI的嵌入embeddings是一种技术它能够将文本、代码或者其他类型的数据转换成数值向量。这些数值向量捕捉了原始数据的关键特征和含义使得计算机和算法能更有效地处理和分析数据。 将数据传递给模型的过程通常涉及以下几个步骤 数据准备首先您需要准备您想要分析或处理的数据。这可能是文本、图片、音频或其他类型的数据。 格式转换将数据转换成模型能够理解的格式。对于文本数据这通常意味着将其转换为字符串形式。 使用API如果您使用OpenAI的API您需要按照API的要求格式化您的数据并通过HTTP请求将其发送给API。这通常涉及到编写一些代码使用像Python这样的编程语言。 处理响应模型会处理您的数据并以某种形式返回结果。这个结果通常也是一个数值向量或者是其他类型的数据例如生成的文本、图片等。 后处理根据您的需求您可能需要对模型的输出进行进一步的处理或分析。 对于不同类型的数据和不同的应用场景这个过程可能会有所不同但基本的原则是相似的。如果您具体想知道如何使用某个特定的OpenAI模型或API通常最好的做法是查阅该模型或API的官方文档那里会有详细的说明和示例代码。 构建一个可以回答有关您网站问题的 AI步骤 1抓取网站 从根 URL 开始访问每个页面查找其他链接并访问这些页面。 爬网程序遍历所有可访问的链接并将这些页面转换为文本文件去掉html的tag。 内容如果太长需分解成更小的块 转为csv结构。 2使用 Embeddings API 将抓取的页面转换为嵌入 第一步是将嵌入转换为 NumPy 数组基它形式的也可以 import numpy as np from openai.embeddings_utils import distances_from_embeddingsdfpd.read_csv(processed/embeddings.csv, index_col0) df[embeddings] df[embeddings].apply(eval).apply(np.array)df.head()关于NumPy 数组 Certainly! Here’s a simple example using NumPy, a powerful library for numerical processing in Python. This example will demonstrate how to create a NumPy array and perform some basic operations: # Creating a simple NumPy array array np.array([1, 2, 3, 4, 5]) print(Original Array:, array)# Performing basic operations # Adding a constant to each element added_array array 10 print(Array after adding 10 to each element:, added_array)# Multiplying each element by 2 multiplied_array array * 2 print(Array after multiplying each element by 2:, multiplied_array)# Computing the mean of the array mean_value np.mean(array) print(Mean of the array:, mean_value)# Reshaping the array into a 2x3 matrix # Note: The total number of elements must remain the same. reshaped_array np.reshape(array, (2, 2)) # Only possible with an array of 4 elements print(Reshaped array into a 2x2 matrix:\n, reshaped_array) In this example, we first import the NumPy library. Then, we create a basic array and perform operations like addition, multiplication, and calculating the mean. Finally, we reshape the array into a 2x2 matrix. Keep in mind that the reshape function requires the total number of elements to remain the same, so in this example, you would need to modify the original array or the shape to ensure they match.3创建一个基本的搜索功能允许用户询问有关嵌入信息的问题 现在数据已经准备好了根据检索到的文本生成一个自然的答案。 def create_context(question, df, max_len1800, sizeada ):Create a context for a question by finding the most similar context from the dataframe# Get the embeddings for the questionq_embeddings client.embeddings.create(inputquestion, enginetext-embedding-ada-002)[data][0][embedding]# Get the distances from the embeddingsdf[distances] distances_from_embeddings(q_embeddings, df[embeddings].values, distance_metriccosine)returns []cur_len 0# Sort by distance and add the text to the context until the context is too longfor i, row in df.sort_values(distances, ascendingTrue).iterrows():# Add the length of the text to the current lengthcur_len row[n_tokens] 4# If the context is too long, breakif cur_len max_len:break# Else add it to the text that is being returnedreturns.append(row[text])# Return the contextreturn \n\n###\n\n.join(returns)回答提示将尝试从检索到的上下文中提取相关事实以制定连贯的答案。如果没有相关答案提示将返回“我不知道”。 def answer_question(df,modelgpt-3.5-turbo,questionAm I allowed to publish model outputs to Twitter, without a human review?,max_len1800,sizeada,debugFalse,max_tokens150,stop_sequenceNone ):Answer a question based on the most similar context from the dataframe textscontext create_context(question,df,max_lenmax_len,sizesize,)# If debug, print the raw model responseif debug:print(Context:\n context)print(\n\n)try:# Create a chat completion using the question and contextresponse client.chat.completions.create(modelgpt-3.5-turbo,messages[{role: system, content: Answer the question based on the context below, and if the question cant be answered based on the context, say \I dont know\\n\n},{role: user, fcontent: Context: {context}\n\n---\n\nQuestion: {question}\nAnswer:}],temperature0,max_tokensmax_tokens,top_p1,frequency_penalty0,presence_penalty0,stopstop_sequence,)return response.choices[0].message.strip()except Exception as e:print(e)return 测试问答系统 测试来查看输出的质量。 如果系统无法回答预期的问题则值得搜索原始文本文件以查看预期已知的信息是否实际上最终被嵌入。
http://www.lakalapos1.cn/news/76241/

相关文章:

  • 如何自己制作一个网站网站建设公司公司好
  • 西双网站建设wordpress中文翻译插件
  • 福州企业网站建设专业服务免费建设网站的方法
  • 网站常用英文字体可以做渗透的网站
  • 网上做的比较好的竞彩网站南乐网站建设公司
  • 做业务在那几个网站上找客户端广州网站推广找哪里
  • flash网站制作公司推广赚钱软件排行
  • 企业网站建设方案报价南京网站建设小程序
  • 前潮网络网站建设做公司网站需要什么手续
  • 深圳优秀网站建设价格如何建响应式网站
  • 织梦 做网站 教程html写手机网站吗
  • 南山网站设计费用广东黄页企业名录
  • 运城网站开发公司wordpress 虚拟币
  • 网站虚拟主机是什么网站备案流程和规则
  • 网站建设网络推广公司有哪些做辅食网站
  • 黑龙江省建设集团网站wordpress 多用户模式
  • 基础设施建设的网站国内专业的企业展厅设计
  • 江西省上饶市网站建设公司望野博物馆
  • 龙岗优化网站建设app开发需要哪些知识
  • 杭州做网站的好公司有哪些企业公示信息
  • 深圳科源建设集团有限公司网站深圳龙华区和联社区
  • 网站建设廉政风险点php网站 config
  • qq业务代理网站建设网站开发的技术流程图
  • wordpress多节点seo站长工具查询系统
  • 小辰青岛网站建设创建公司网站需要注意什么
  • 云服务器建立多个网站吗北湖区网站建设哪个好
  • 网站一直没有收录w98免费服务器
  • 把网站做app王野苏婉卿
  • 如何让谷歌收录网站手机上网网站建设
  • 河南开展涉网暴力专项举报工作企业网站优化公司有哪些