Elasticsearch 开放 inference API 增加了对 OpenAI chat completions 的支持

这篇具有很好参考价值的文章主要介绍了Elasticsearch 开放 inference API 增加了对 OpenAI chat completions 的支持。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

作者:Tim Grein

Elasticsearch 开放 inference API 增加了对 OpenAI chat completions 的支持,Elasticsearch,AI,Elastic,elasticsearch,大数据,搜索引擎,人工智能,全文检索

我们很高兴地宣布在 Elasticsearch 中推出的最新创新:在 Elastic 的 inference API 中集成了 OpenAI Chat Completions 功能。这一新特性标志着我们在整合尖端人工智能能力至 Elasticsearch 的旅程中又迈出了一步,提供了生成类人文本完成等更多易于使用的功能。

更多关于 OpenAI Chat Completions 的用法,请阅读文章 “ChatGPT 和 Elasticsearch:OpenAI 遇见私有数据(二)”

Elastic 持续创新的本质

Elastic 在所有的人工智能领域都进行了大量投资。我们最近发布了许多新功能和令人振奋的集成:

  • Elasticsearch 的开发 inference API 增加了对 Cohere 嵌入的支持
  • 引入 Elasticsearch 向量数据库到 Azure OpenAI 服务的数据上(预览版)
  • 加速多图向量搜索
  • ……探索更多 Elasticsearch labs 的内容,了解最近的发展情况。

我们的 inference API 中的新 completion 任务类型,作为第一个支持提供商,已经在我们的 Elastic Cloud 的 stateless 提供中可用。它将很快在我们的下一个版本中向所有人提供。

使用新的 completion API

在这个简短的指南中,我们将展示如何在文档摄入过程中使用 inference API 中的新 completion task 类型的简单示例。请参考 Elastic Search Labs 的 GitHub 仓库以获取更深入的指南和交互式笔记本。

要使以下指南工作,你需要拥有一个活跃的 OpenAI 账户并获取一个 API 密钥。请参考 OpenAI 的快速启动指南了解你需要遵循的步骤。你可以选择 OpenAI 的多种模型中的一种。在以下示例中,我们使用了 gpt-3.5-turbo

在 Kibana 中,你将可以使用控制台输入以下步骤到 Elasticsearch,无需设置 IDE。

首先,你需要配置一个将执行 completion 任务的模型:

PUT _inference/completion/openai_chat_completions
{
    "service": "openai",
        "service_settings": {
        "api_key": <api-key>,
        "model_id": "gpt-3.5-turbo"
    }
}

运行此命令后,你应该会看到相应的 200 OK 状态,表明模型已正确设置,可以对任意文本进行推理。

现在,你可以调用配置的模型对任意文本输入进行推理:

POST _inference/completion/openai_chat_completions
{
    "input": "What is Elastic?"
}

你将收到一个类似于下面的带有状态码 200 OK 的响应:

{
    "completion": [
        {
            "result": "Elastic is a software company that provides a range of products and solutions for search, logging, security, and analytics. Its flagship product, Elasticsearch, is a distributed, RESTful search and analytics engine that is used for full-text search, structured search, and analytics. Elastic also offers other products such as Logstash for log collection and parsing, Kibana for data visualization and dashboarding, and Beats for lightweight data shippers. These products can be combined to create powerful data analysis and monitoring solutions for organizations of all sizes."
        }
    ]
}

下一个命令创建了一个示例文档,我们将使用刚刚配置的模型对其进行总结:

POST _bulk
{ "index" : { "_index" : "docs" } }
{"content": "You know, for search (and analysis) Elasticsearch is the distributed search and analytics engine at the heart of the Elastic Stack. Logstash and Beats facilitate collecting, aggregating, and enriching your data and storing it in Elasticsearch. Kibana enables you to interactively explore, visualize, and share insights into your data and manage and monitor the stack. Elasticsearch is where the indexing, search, and analysis magic happens. Elasticsearch provides near real-time search and analytics for all types of data. Whether you have structured or unstructured text, numerical data, or geospatial data, Elasticsearch can efficiently store and index it in a way that supports fast searches. You can go far beyond simple data retrieval and aggregate information to discover trends and patterns in your data. And as your data and query volume grows, the distributed nature of Elasticsearch enables your deployment to grow seamlessly right along with it. While not every problem is a search problem, Elasticsearch offers speed and flexibility to handle data in a wide variety of use cases: Add a search box to an app or website Store and analyze logs, metrics, and security event data Use machine learning to automatically model the behavior of your data in real time Use Elasticsearch as a vector database to create, store, and search vector embeddings Automate business workflows using Elasticsearch as a storage engine Manage, integrate, and analyze spatial information using Elasticsearch as a geographic information system (GIS) Store and process genetic data using Elasticsearch as a bioinformatics research tool We’re continually amazed by the novel ways people use search. But whether your use case is similar to one of these, or you’re using Elasticsearch to tackle a new problem, the way you work with your data, documents, and indices in Elasticsearch is the same."}

为了总结多个文档,我们将使用一个 ingest pipeline,其中包含脚本处理器、推理处理器和删除处理器,来设置我们的摘要管道。

PUT _ingest/pipeline/summarization_pipeline
{
    "processors": [
        {
            "script": {
                "source": "ctx.prompt = 'Please summarize the following text: ' + ctx.content"
            }
        },
        {
            "inference": {
                "model_id": "openai_chat_completions",
                "input_output": {
                    "input_field": "prompt",
                    "output_field": "summary"
                }
            }
        },
        {
            "remove": {
                "field": "prompt"
            }
        }
  ]
}

该管道简单地在内容中加上了指令 “Please summarize the following text: ”,放在一个临时字段中,这样配置的模型就知道该如何处理文本了。当然,你可以根据需要更改这个文本,这就可以解锁各种其他流行的用例:

  • 问答
  • 翻译
  • ...等等!

管道在执行推理后删除临时字段。

现在,我们通过调用 reindex API 将我们的文档(们)通过摘要管道发送出去。

POST _reindex
{
    "source": {
        "index": "docs",
        "size": 50
    },
    "dest": {
        "index": "docs_summaries",
        "pipeline": "summarization_pipeline"
    }
}

你的文档现已被总结,可以进行搜索了。

POST docs_summaries/_search
{
    "query": {
        "match_all": { }
    }
}

这就是全部内容了, 你只需通过几个简单的 API 调用就创建了一个强大的摘要化流水线,可与任何摄取机制一起使用!摘要化非常实用,例如在生成语义嵌入或将大段文本转换为简洁摘要之前,对大段文本进行摘要化。这可以降低存储成本,提高价值交付速度,例如,如果你只对大型文档的摘要感兴趣等。顺便说一句,如果你想从二进制文档中提取文本,可以查看我们的开源数据提取服务!

前景令人兴奋

但我们不会止步于此。我们正在将 Cohere 的聊天功能作为我们的 completion 任务的另一个提供商进行整合。我们还在积极探索与 completion API 结合的新的检索和摄取用例。现在就将 Elastic Search Labs 加入书签,随时获取最新信息!

准备在你的应用中构建 RAG 吗?想尝试使用向量数据库的不同 LLMs 吗? 请查看我们在 Github 上的 LangChain、Cohere 等样本 notebooks,并加入即将开始的 Elasticsearch 工程师培训!

原文:Elasticsearch open inference API adds support for OpenAI chat completions — Elastic Search Labs文章来源地址https://www.toymoban.com/news/detail-856783.html

到了这里,关于Elasticsearch 开放 inference API 增加了对 OpenAI chat completions 的支持的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • openai开放gpt3.5-turbo模型api,使用python即可写一个基于gpt的智能问答机器人

    使用 pip 安装openai库,注意 gpt3.5-turbo 模型需要 python=3.9 的版本支持,本文演示的python版本是 python==3.10.10 需要提前在 openai 官网上注册好账号,然后打开 https://platform.openai.com/account/api-keys 就可以创建接口 keys 每个账号注册完成会有18美元在里面,每次调用api,就会花费里面的

    2024年02月06日
    浏览(39)
  • 王炸!微软Bing Chat全面开放!

    大家注意:因为微信最近又改了推送机制,经常有小伙伴说错过了之前被删的文章,比如前阵子冒着风险写的爬虫,再比如一些限时福利,错过了就是错过了。 所以建议大家加个星标,就能第一时间收到推送。👇 大家好,我是爱搞事情的了不起! 没有一点点防备,新 Bing

    2024年02月12日
    浏览(33)
  • 端口错误配置:开放了不应该开放的端口,增加安全风险

    **防火墙策略管理、分析与解决方案:端口错误配置与安全风险** **一、引言** 在计算机网络安全领域,防火墙是一种重要的防护设备,它可以有效控制进出网络的数据传输,防止未经授权的访问和恶意攻击。然而,如果防火墙的配置不当,可能会造成安全风险。本文将讨论如

    2024年02月02日
    浏览(37)
  • 用ChatGPT方式编程!GitHub Copilot Chat全面开放使用

    全球著名开源分享平台GitHub在官网宣布,经过几个月多轮测试的GitHub Copilot Chat,全面开放使用,一个用ChatGPT方式写代码的时代来啦! 据悉,Copilot Chat是基于OpenAI的GPT-4模型,再结合其海量、优质的代码数据开发而成,通过文本问答的方式就生成、分析、审核代码等。 例如,

    2024年02月03日
    浏览(34)
  • Springboot接入OpenAi/Chat GPT的三种方式

    由于现在网上的相关教程并不多外加没有使用代理的demo,所以抛砖引玉,写了三种调用方式,分别是直接访问、非官方SDK访问、官方开源的SDK访问 1、导入pom文件(2023.3.30最新版本) 2、入参 这里的TalkDto 还可以入参maxToken,用于返回最大量的数据,官方计算token大小的方式:

    2023年04月19日
    浏览(41)
  • 全面开放!微软 Bing Chat 人人可用,还要做搜索引擎的「App Store」

    没有一点点防备,新 Bing 就悄悄地突然向所有人开放了。 或许微软是想要给每个耐心等待的用户一点回报,伴随着此次开放,微软还给 Bing 安排了一次大更新,现在你不仅可以用 Bing Chat 搜索、聊天,还能用它生图、读网页、甚至帮你订餐馆。 不得不说,微软确实是把搜索引

    2024年02月04日
    浏览(33)
  • 【必看!】阿里云推出QWen-7B和QWen-7b-Chat,开放免费商用!

    阿里云于8月3日宣布开源两款重要的大型模型——QWen-7B和QWen-7b-Chat。这两款模型的参数规模达到了令人瞩目的70亿,并且已经在Hugging Face和ModelScope平台上开放,并可免费商用。以下是相关链接: GitHub项目主页:https://github.com/QwenLM/Qwen-7B Hugging Face:https://huggingface.co/Qwen/Qwen-7

    2024年02月14日
    浏览(36)
  • [一周AI简讯]OpenAI宫斗;微软Bing Chat更名Copilot;Youtube测试音乐AI

    OpenAI宫斗,奥特曼被解雇,董事会内讧 Sam Altman被解雇,不再担任CEO,董事会的理由是奥特曼在与董事会的沟通中始终不坦诚,阻碍了董事会履行职责的能力。原首席技术官Mira Murati担任新CEO。OpenAI宫斗剧远未结束,各方还在讨论奥特曼回归的可能性。 ChatGPT 暂停新用户订阅

    2024年02月05日
    浏览(38)
  • AI日报:OpenAI向新用户重新开放ChatGPT Plus订阅

    欢迎订阅专栏 《AI日报》 获取人工智能邻域最新资讯 ChatGPT Plus再次向新用户开放,但目前每三小时限制发送40条消息。 OpenAI还宣布拨款1000万美元用于开发安全的人工智能,因为它相信人工智能超级智能将在10年后出现。 在暂停注册一个月后,OpenAI重新向新用户开放了其Cha

    2024年02月04日
    浏览(44)
  • 重磅!openAI开放chatGPT模型APIgpt-3.5-turbo,成本直降90%!

    ChatGPT API,千呼万唤终于来了。 chatGPT不仅开放 成本还直降90%! 全新API基于“gpt-3.5-turbo”模型,其基础是支持ChatGPT的GPT 3.5模型,取代了此前的“text-davinci-003.”。这款名为“gpt-3.5-turbo”的模型,定价为 0.002美元/每1000 tokens 。这“比我们现有的GPT-3.5模型便宜 10 倍”,部分原

    2023年04月09日
    浏览(31)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包