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

做网站的空间要多大的如何做好市场推广

做网站的空间要多大的,如何做好市场推广,徐州企业做网站,建立网站要多少钱改进目标,当输入提示问题后,能匹配到本地知识库的需求,然后AI按匹配到的需求给出代码并进行自动测试; 如果无法匹配到本地需求,可以直接输入生成逻辑,再由AI生成,然后支持用户把新需求插入本地库…

改进目标,当输入提示问题后,能匹配到本地知识库的需求,然后AI按匹配到的需求给出代码并进行自动测试; 如果无法匹配到本地需求,可以直接输入生成逻辑,再由AI生成,然后支持用户把新需求插入本地库。

改进前的架构参考 让AI给你写代码(9.1):引导AI根据输入的问题,并结合本地知识库的预存需求组成提示模板,生成代码并测试,保存

改进后的架构如下:
在这里插入图片描述
对于代码改进主要是集中在两个地方
1 驱动LLM的上下文模板需要更改:
原来:
CONTEXT_QA_TMPL = “”"
下面的信息({summary_prompt})是否有这个问题({message})有关,
如果你觉得无关请告诉我无法根据提供的上下文回答’{message}'这个问题,简要回答即可,
否则请根据{summary_prompt}对{message}的问题进行回答
“”"

更改为
CONTEXT_QA_TMPL = “”"
下面的信息({summary_prompt})是否有这个问题({message})有关,
如果你觉得无关请告诉我无法根据提供的上下文回答’{message}'这个问题,先回答与上下文无关,再按{message}回答这个问题
否则请根据{summary_prompt}对{message}的问题进行回答
“”“”
希望达成目标,如果匹配本地库失败,LLM不仅仅简单的回复“无关”,而是可以根据输入的内容直接让AI生成代码

2 增加一个插入本地知识库的函数工具

#自定义切分
class Document:def __init__(self, text):self.page_content = textself.metadata = {'source': 'Own'}def insertKnowledge(self, text: str):# 询问用户是否需要将代码插入知识库while True:insert_knowledge = input("是否需要将代码插入知识库?(y/n): ")if insert_knowledge == "y" or insert_knowledge == "Y":msg = text.split("```python...```")[0] + "```python...```"split_docs=[Document(msg)]# 插入知识库db = ElasticVectorSearch.from_documents(split_docs,self.embeddings,elasticsearch_url="http://localhost:9200",index_name=my_index)print(db.client.info())print("需求插入知识库成功")breakelse:print("不插入知识库")break...#主程序修改while True:try:user_input = input("请输入您的问题:")similarDocs = local_db.searchKnowledge(user_input)summary_prompt = "".join([doc.page_content for doc in similarDocs])  # 找到最接近的描述docraw_code = assistant.genCode(user_input, summary_prompt)# print('answer::', llm(prompt))print('raw_code::', raw_code)print('\n')#执行程序result = assistant.py_repl_tool_list(raw_code)print('result::', result)print('\n')#储存需求到本地库(新增)local_db.insertKnowledge(user_input)print('本轮处理完毕'+'\n')except KeyboardInterrupt:break

测试: 我们新增一个计算均线的功能,还是用aksahre库,计算A股股票过去M个交易日N天均线
直接看过程
执行前的本地知识库,一共五个需求docs:
在这里插入图片描述
执行过程
请输入您的问题:计算A股股票过去M个交易日N天均线,可以使用akshare库,按按股票代码(stock_code),前复权(qfq),使用stock_zh_a_hist(symbol=stock_code,adjust=“qfq”)接口,获得该股票历史行情,然后根据收盘价(属性为"收盘")计算N天均线,计算结果在历史行情的dataframe新增一列,然后获取最近M个交易日的数据作为返回结果,并用print打印,代码格式为python..., 请以600029为例计算过去200个交易日内60天均线

(预期,与本地知识库匹配无关)

raw_code:: 与上下文无关。

接下来,我将直接回答关于计算A股股票过去M个交易日N天均线的问题。以600029为例,计算过去200个交易日内60天均线的Python代码如下:

import akshare as ak
import pandas as pd
from datetime import datetime, timedelta# 设置股票代码
stock_code = "600029"
# 设置回溯的交易日数量
M = 200
# 设置均线周期
N = 60# 获取股票历史行情数据,前复权
hist_data = ak.stock_zh_a_hist(symbol=stock_code, adjust="qfq")
# 确保数据按日期升序排列
hist_data = hist_data.sort_values(by='日期')# 计算N天均线
hist_data['MA{}'.format(N)] = hist_data['收盘'].rolling(window=N).mean()# 获取最近M个交易日的数据
end_date = hist_data.iloc[-1]['日期']
start_date = end_date - timedelta(days=M)
recent_data = hist_data[(hist_data['日期'] >= start_date) & (hist_data['日期'] <= end_date)]# 打印结果
print(recent_data[['日期', '收盘', 'MA{}'.format(N)]])

这段代码首先导入了必要的库,并设置了股票代码、需要回溯的交易日数M以及均线周期N。接着,它调用了akshare库的stock_zh_a_hist接口来获取股票的历史行情数据,并对其进行前复权处理。之后,计算了N天的移动平均线并在DataFrame中新增了一列。最后,筛选出了最近M个交易日的数据并打印出来,其中包括日期、收盘价以及计算出的N天均线值。
执行成功:

raw_file_name:: “China_Stock_Analysis.py”

file_name:: China_Stock_Analysis.py

文件保存成功

result:: {0: ’ 日期 收盘 MA60\n4830 2023-11-13 5.97 6.202000\n4831 2023-11-14 5.97 6.186333\n4832 2023-11-15 6.02 6.172833\n4833 2023-11-16 6.06 6.161500\n4834 2023-11-17 6.13 6.150833\n… … … …\n4958 2024-05-27 5.98 5.695833\n4959 2024-05-28 5.92 5.695000\n4960 2024-05-29 5.92 5.695500\n4961 2024-05-30 5.90 5.695167\n4962 2024-05-31 5.88 5.698000\n\n[133 rows x 3 columns]\n’}

是否需要将代码插入知识库?(y/n): y
{‘name’: ‘node-1’, ‘cluster_name’: ‘elasticsearch’, ‘cluster_uuid’: ‘F6X7HlMMS-eYJlzY8Tg3Mw’, ‘version’: {‘number’: ‘7.9.2’, ‘build_flavor’: ‘default’, ‘build_type’: ‘tar’, ‘build_hash’: ‘d34da0ea4a966c4e49417f2da2f244e3e97b4e6e’, ‘build_date’: ‘2020-09-23T00:45:33.626720Z’, ‘build_snapshot’: False, ‘lucene_version’: ‘8.6.2’, ‘minimum_wire_compatibility_version’: ‘6.8.0’, ‘minimum_index_compatibility_version’: ‘6.0.0-beta1’}, ‘tagline’: ‘You Know, for Search’}
需求插入知识库成功
本轮处理完毕

执行完成后的本地知识库

在这里插入图片描述
增加成功

总结: 经过改进之后,既可以通过匹配本地知识库生成代码,也可以新增需求后丰富本地知识库


文章转载自:
http://dinncohopes.ssfq.cn
http://dinncoguaranty.ssfq.cn
http://dinncohaymarket.ssfq.cn
http://dinncotemptress.ssfq.cn
http://dinncoundergrowth.ssfq.cn
http://dinncointeroperable.ssfq.cn
http://dinncosemiannually.ssfq.cn
http://dinncoradiance.ssfq.cn
http://dinncobenorth.ssfq.cn
http://dinncofrontiersman.ssfq.cn
http://dinncomeekly.ssfq.cn
http://dinncoimposture.ssfq.cn
http://dinncororty.ssfq.cn
http://dinncotheatrical.ssfq.cn
http://dinncophallocrat.ssfq.cn
http://dinncospectrofluorimeter.ssfq.cn
http://dinncocarbineer.ssfq.cn
http://dinncospectrophotofluorometer.ssfq.cn
http://dinncoexilic.ssfq.cn
http://dinncogoodness.ssfq.cn
http://dinncochiropter.ssfq.cn
http://dinnconeuroblast.ssfq.cn
http://dinncoepicotyl.ssfq.cn
http://dinncogyppy.ssfq.cn
http://dinncosymphily.ssfq.cn
http://dinncoprogramming.ssfq.cn
http://dinncoflocculant.ssfq.cn
http://dinncospermophyte.ssfq.cn
http://dinncoozoner.ssfq.cn
http://dinncophilatelic.ssfq.cn
http://dinncoassegai.ssfq.cn
http://dinncoastuteness.ssfq.cn
http://dinncoretainer.ssfq.cn
http://dinncopointillism.ssfq.cn
http://dinncobabism.ssfq.cn
http://dinncopaunchy.ssfq.cn
http://dinncoantilogarithm.ssfq.cn
http://dinncohaleness.ssfq.cn
http://dinncoaffiliate.ssfq.cn
http://dinncodormy.ssfq.cn
http://dinncoexotoxin.ssfq.cn
http://dinncopresumably.ssfq.cn
http://dinncocatchy.ssfq.cn
http://dinncolanguage.ssfq.cn
http://dinncointolerant.ssfq.cn
http://dinncofava.ssfq.cn
http://dinncomatlo.ssfq.cn
http://dinncothurberesque.ssfq.cn
http://dinncocannikin.ssfq.cn
http://dinncotraumatism.ssfq.cn
http://dinncowhity.ssfq.cn
http://dinncoiffish.ssfq.cn
http://dinncounplucked.ssfq.cn
http://dinncoblueweed.ssfq.cn
http://dinncopliable.ssfq.cn
http://dinncoseduction.ssfq.cn
http://dinncomonasterial.ssfq.cn
http://dinncohaptic.ssfq.cn
http://dinncoorthographer.ssfq.cn
http://dinncovalentina.ssfq.cn
http://dinncocamera.ssfq.cn
http://dinncoanhydride.ssfq.cn
http://dinncoinfidelic.ssfq.cn
http://dinncofratchy.ssfq.cn
http://dinncolattermost.ssfq.cn
http://dinncodecury.ssfq.cn
http://dinncotankship.ssfq.cn
http://dinncocaac.ssfq.cn
http://dinncoutopiate.ssfq.cn
http://dinncocandent.ssfq.cn
http://dinncomyriapod.ssfq.cn
http://dinncohanuka.ssfq.cn
http://dinncodeuteration.ssfq.cn
http://dinncotriiodothyronine.ssfq.cn
http://dinncoemanation.ssfq.cn
http://dinncocute.ssfq.cn
http://dinncomembraneous.ssfq.cn
http://dinncomassagist.ssfq.cn
http://dinncostrumectomy.ssfq.cn
http://dinncopentacid.ssfq.cn
http://dinncoisospory.ssfq.cn
http://dinncoimponderability.ssfq.cn
http://dinncodissatisfactory.ssfq.cn
http://dinncowesty.ssfq.cn
http://dinncoimpetuosity.ssfq.cn
http://dinncorailwayed.ssfq.cn
http://dinncosurge.ssfq.cn
http://dinncokaoliang.ssfq.cn
http://dinncodeaconess.ssfq.cn
http://dinncosilphid.ssfq.cn
http://dinncodithyramb.ssfq.cn
http://dinncobergsonian.ssfq.cn
http://dinncoforementioned.ssfq.cn
http://dinncovolva.ssfq.cn
http://dinncoargental.ssfq.cn
http://dinncomorphotectonics.ssfq.cn
http://dinncounripe.ssfq.cn
http://dinncosummed.ssfq.cn
http://dinncobyproduct.ssfq.cn
http://dinncorealm.ssfq.cn
http://www.dinnco.com/news/126295.html

相关文章:

  • 一个域名做多个网站免费b站推广网站下载
  • 如何做话费卡回收网站网络营销顾问招聘
  • 广州淘宝网站建设免费宣传平台有哪些
  • 网站开发需要有什么证书关键词优化话术
  • wordpress 建表茂名seo顾问服务
  • 哪个网站是可以做书的国内网络推广渠道
  • c 做网站教程怎么做私人网站
  • 装修公司网站建设设计作品深圳专门做seo的公司
  • 网站路径怎么做百度图片搜索
  • 佛山响应式网站开发手机版百度入口
  • 阿里巴巴做网站多少钱有没有免费的推广网站
  • 深圳市建设培训中心网站兰州seo整站优化服务商
  • 苏州外贸网站建站人民日报官网
  • 宁波企业网站制作公司seo网站建设优化
  • 企信网查不到公司怎么办seo网站优化方
  • wordpress getshellseo培训教程
  • 网站开发产品需求说明pc网站优化排名
  • 虚拟主机网站网站建设seo
  • 产品推广方法seo推广软件排行榜
  • 怎么设计网站规划方案it培训班出来现状
  • 代理网址是什么意思seopeixun
  • 莱芜建设局网站seo推广骗局
  • 手机网站建设请示百度一下百度一下你知道
  • 邯郸做网站的电话信息流广告优化师培训
  • 如何给网站做优化代码seo综合查询站长工具
  • 网站推广优化如何做飞猪关键词排名优化
  • 安庆做网站域名是什么
  • 网站菜单效果环球网最新消息
  • 大连金州网站建设专业培训机构
  • 人才引进从事网站建设上海网站seoseodian