这是用户在 2024-6-13 10:54 为 https://app.immersivetranslate.com/word/ 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?

Microsoft Build
Microsoft构建

May 21-23, 2024
2024 年 5 月 21 日至 23 日

Session: BRK114
会议:BRK114

Speakers: Seth Juarez, Leah Bar On Simmons
主讲人:Seth Juarez、Leah Bar On Simmons

Seth Juarez: Hello, my friends.
塞思·华雷斯:你好,我的朋友们。

How is it going?
事情进行的怎么样了?

(applause) SETH JUAREZ: It's Day 3.
(掌声)塞思·华雷斯:现在是第三天。

I know there's a lot of glossy eyes out there, but we're going to be talking about some amazing stuff today, and we want all of your feedback on this stuff.
我知道外面有很多光鲜亮丽的眼睛,但我们今天要讨论一些令人惊奇的东西,我们希望你们对这些东西的所有反馈。

We're doing practical end to end AI development using Prompty and AI Studio.
我们正在使用 Prompty 和 AI Studio 进行实用的端到端 AI 开发。

It's a cool thing.
这是一件很酷的事情。

We want to get your feedback.
我们希望得到您的反馈。

If you have any questions, we want to take them all.
如果您有任何问题,我们想一一回答。

But this is what we're doing today, and we decided to go all out with a fun logo.
但这就是我们今天正在做的事情,我们决定全力以赴,用一个有趣的标志。

We got to make stickers and T shirts and hats.
我们得制作贴纸、T恤和帽子。

If anyone wants those, let me know.
如果有人想要这些,请告诉我。

Oh, thank you.
谢谢。

Getting started with LLMs, we're going to talk about the Prompty spec because it's actually a specification.
首先LLMs,我们将讨论 Prompty 规范,因为它实际上是一个规范。

We're going to talk about getting started with Prompty in VisualStudio code, and then we're going to talk about developing an app with Prompty and what it looks like.
我们将讨论如何在 VisualStudio 代码中开始使用 Prompty,然后我们将讨论使用 Prompty 开发应用及其外观。

The reality is that I thought I would start with how I think about LLMs.
现实情况是,我以为我会从我的想法LLMs开始。

It's funny, I think.
我觉得这很有趣。

This is the AI Studio, and this is the chat playground, as you've seen and so the way I like to think about LLMs is a little bit different and hopefully you'll follow along with me.
这是 AI 工作室,这是聊天游乐场,正如你所看到的,所以我喜欢思考LLMs的方式有点不同,希望你能跟着我一起走。

I like to think of LLMs as giant language calculators.
我喜欢把它想象LLMs成巨大的语言计算器。

Let me show you what I mean.
让我告诉你我的意思。

So anyone here, European?
那么这里有人吗,欧洲人?

The Eurovision Song Contest just recently started.
欧洲歌唱大赛最近刚刚开始。

It's the pageantry, the costumes, the joie de vivre for French people out there.
这是法国人的盛会、服装和生活乐趣。

What we're going to do is we're going to make a little C Copilot that helps us with the Eurovision Song Contest.
我们要做的是制作一个小小的 C Copilot,帮助我们举办欧洲歌唱大赛。

You are an AI assistant that helps people find information about the Eurovision Song Contest.
您是一名 AI 助手,可帮助人们查找有关欧洲歌唱大赛的信息。

One of the warnings that I have is you should never think of these things as databases.
我的警告之一是,你永远不应该把这些东西看作是数据库。

LLMs are not databases, they're language calculators.
LLMs不是数据库,而是语言计算器。

Let me show you what I mean.
让我告诉你我的意思。

I'm going to ask here who won the first ESC.
我要在这里问谁赢得了第一个ESC。

Now, when I went to school, this ESC thing and Eurovision Song Contest, the official term for this in LP is coreference resolution and many PHDs were milled in this particular field of study, but the LLM does not care about our PhDs.
现在,当我上学的时候,这个ESC的事情和欧洲歌唱大赛,LP的官方术语是共指解析,许多博士都是在这个特定的研究领域磨练的,但他们LLM并不关心我们的博士。

Notice it did a good job, but you're like, but wait, Seth, I thought you said don't treat these things as databases.
注意它做得很好,但你就像,但是等等,Seth,我以为你说过不要把这些东西当作数据库。

You're right.
你是对的。

Let me show you why.
让我告诉你为什么。

Who won ESC in 2023?
谁赢得了 2023 年的 ESC?

I hopefully, I didn't train the model more since then.
我希望从那以后我没有更多地训练模型。

Oh, looks like it does though.
哦,看起来确实如此。

Let's see.
我看看。

Who won ESC in 2024?
谁赢得了 2024 年的 ESC?

We asked the question.
我们问了这个问题。

Did anyone win it yet, by the way?
顺便说一句,有人赢了吗?

Someone won it already?
有人赢了吗?

How come it doesn't know?
怎么不知道?

Because it's not a database.
因为它不是一个数据库。

It's a language calculator and when we trained it, I say we as in Real Madrid, we won the game kind of thing.
这是一个语言计算器,当我们训练它时,我说我们就像在皇家马德里一样,我们赢得了比赛。

When we trained it, we gave it the Internet, and we tried to predict the next token.
当我们训练它时,我们给它互联网,我们试图预测下一个代币。

That's what actually happened and so, along the way it learned things about language, but it also learned some stuff.
这就是实际发生的事情,所以,一路上它学到了关于语言的东西,但它也学到了一些东西。

But that's not the stuff that we want.
但这不是我们想要的东西。

Let me see.
让我想想。

Do we know who won Eurovision 2024?
我们知道谁赢得了 2024 年欧洲歌唱大赛吗?

Someone want to shout it out for me.
有人想为我大声喊出来。

Speaker 1: Switzerland's Nemo.
演讲者1:瑞士的尼莫。

Seth Juarez: It's about time.
塞思·华雷斯:是时候了。

So Malmo Eurovision 2024, here it is, Wikipedia 2024.
所以马尔默欧洲电视网 2024,这里是维基百科 2024。

I'm just going to control, see this and then I'm going to go over here and I'm going to say this is what you know.
我只是要控制,看到这个,然后我要走到这里,我要说这就是你所知道的。

I'll put that on there, apply changes, and now I'm going to say who won ESC in 2024 and I'm crossing my fingers.
我会把它放在那里,应用更改,现在我要说谁在 2024 年赢得了 ESC,我正在交叉手指。

Did it get it right?
做对了吗?

Speaker 2: Yes.
演讲者2:是的。

Seth Juarez: It did.
Seth Juarez:确实如此。

That's cool.(applause) An LLM that can be taught.
很酷。(掌声)一个LLM可以教的。

You're looking at this, and you're like, that's fairly unremarkable, Seth.
你看着这个,你会觉得,这很不起眼,赛斯。

You gave it an answer and then asked the answer to the question.
你给了它一个答案,然后问了问题的答案。

What I've just shown you is retrieval augmented generation.
我刚才向你们展示的是检索增强生成。

However, I did it artisanally with my fingers and Wikipedia.
然而,我用手指和维基百科手工做到了。

This is what this thing is.
这就是这个东西。

You give it a paragraph and you give it another paragraph and you tell it to generate a thing.
你给它一个段落,你给它另一个段落,你告诉它生成一个东西。

That's what retrieval augmented generation is.
这就是检索增强生成。

It's just that we make it so fancy that it's like, oh, that's for smart people.
只是我们把它弄得太花哨了,就像,哦,那是给聪明人的。

But hey, if I can do it with artisanally with my fingers, it's not as bad.
但是,嘿,如果我能用手指手工完成,那就没那么糟糕了。

What about this?
这又如何呢?

What should I put on my tacos?
我应该在炸玉米饼上放什么?

That's a really good question.
这是一个很好的问题。

Whoa.
哇。

What is the best style of dance.
什么是最好的舞蹈风格。

Why is it saying that?
为什么这么说呢?

Speaker 3: Because you told it to.
演讲者3:因为你告诉了它。

Seth Juarez: Because I told it to.
塞思·华雷斯:因为我告诉过它。

Yes.
是的。

Look at this.
看看这个。

I sneakily put this thing in here.
我偷偷地把这个东西放在这里。

You can see salsa, and now you're starting to get a sense for this thing really is a giant language calculator.
你可以看到莎莎,现在你开始感觉到这个东西真的是一个巨大的语言计算器。

I could tell it paragraph A plus paragraph B minus paragraph C, and then you get a response out and I was thinking about this, I was like, oh, why don't we make an abstraction that puts this back as the priority of the thing.
我可以告诉它 A 段加上 B 段减去 C 段,然后你会得到一个回应,我在想这个问题,我想,哦,我们为什么不做一个抽象,把它作为事情的优先级。

Why don't we put the prompt back in prompt engineering and make it a first class asset and thing and so that's where Prompty came about.
我们为什么不把提示放回提示工程中,让它成为一流的资产和东西,这就是 Prompty 的由来。

So that's my cheesy demo.
这就是我俗气的演示。

We measure skillfulness of talks on TTD time to demo.
我们衡量 TTD 演示时间的谈话技巧。

That was really fast.
这真的很快。

What is Prompty?
什么是提示?

It's actually three things.
这实际上是三件事。

It is a specification, a standard format that unifies the prompt and how it's executed in one package.
它是一种规范,一种标准格式,将提示及其执行方式统一在一个包中。

That way you can experiment and work with it quickly.
这样,您就可以快速进行试验和使用它。

The second thing it is, it's some tooling, tooling that enables you in your own environment to work with these prompts at a high level and the last thing is it's a run time.
第二件事是,它是一些工具,工具使您能够在自己的环境中以高级别处理这些提示,最后一件事是运行时。

Let's talk about each one of these things.
让我们来谈谈这些事情中的每一个。

Prompty is basically a language agnostic prompt asset.
提示基本上是一种与语言无关的提示资产。

We have a specification for it, what goes in where and whatever.
我们有一个规范,什么在什么地方,什么。

We would love every language in the universe to use this so that now the prompt becomes the thing that you work on, because if you've ever done, LangChain or Semantic Kernel or even prompt flow, you know that it's the prompt that you need to change a lot.
我们希望宇宙中的每一种语言都使用它,这样现在提示就变成了你正在做的事情,因为如果你曾经做过,LangChain或语义内核,甚至是提示流,你就会知道这是你需要改变很多的提示。

That's the thing that you're actually working on and so why not bring that to the surface to the top.
这就是你真正在做的事情,所以为什么不把它带到表面到顶峰。

The goal is to simplify the actual workflow.
目标是简化实际的工作流程。

In VisualStudio code we made a Prompty extension that does a bunch of stuff.
在 VisualStudio 代码中,我们制作了一个 Prompty 扩展,它可以做很多事情。

It does some auto complete.
它会自动完成一些操作。

It does some color syntax in highlighting.
它在突出显示时会执行一些颜色语法。

It does validation, quick run, cogeneration.
它进行验证、快速运行、热电联产。

We're looking at other stuff to put in there that makes you more productive as a developer.
我们正在寻找其他东西,让你作为一个开发人员更有效率。

But as you look at this Prompty file, the reason why it looks so familiar is because it's just marked down.
但是当你看到这个 Prompty 文件时,它之所以看起来如此熟悉,是因为它只是被标记下来了。

With front matter stuff that tells it, hey, what should I put in there?
有了前面的东西,嘿,我应该放什么?

Last, but not least, Prompty as a runtime library, it's more of like, you know how people are like, it's more of like a lifestyle.
最后但并非最不重要的一点是,Prompty 作为一个运行时库,它更像是,你知道人们是什么样的,它更像是一种生活方式。

I don't want to be that guy, so I won't say that.
我不想成为那个人,所以我不会这么说。

But it's basically a specification, some tooling and how you should write a runtime if you want to do it.
但它基本上是一个规范,一些工具,以及如果你想写一个运行时,你应该如何编写它。

The runtimes that we currently support are prompt flow and LangChain.
我们目前支持的运行时是 prompt flow 和 LangChain。

If you're working with prompties, you can totally continue to use your LangChain code, it will work just fine.
如果你正在使用提示,你完全可以继续使用你的LangChain代码,它会很好用。

In C Sharp, there's support for this in semantic kernel, and we'll continue to make it more available in more languages, or maybe you will, because thank you, we want you to.
在 C Sharp 中,语义内核对此进行了支持,我们将继续在更多语言中提供更多支持,或者你可能会,因为谢谢你,我们希望你这样做。

We're also looking at TypeScript and JavaScript because if you look at the extension itself, you may not know this, but the extension is written in TypeScript and JavaScript and all of the nuances there work.
我们也在研究 TypeScript 和 JavaScript,因为如果你看一下扩展本身,你可能不知道这一点,但扩展是用 TypeScript 和 JavaScript 编写的,那里的所有细微差别都有效。

We haven't released that one yet.
我们还没有发布那个。

We're going to show you mostly everything in prompt flow because that's how we understand things, but we would love for this to be extended and to be something in your language.
我们将以快速流程向您展示大部分内容,因为这是我们理解事物的方式,但我们希望它能够扩展并成为您的语言。

I would love to see a rust Prompty library, or if someone's using scheme in the back, don't be ashamed.
我很想看到一个生锈的 Prompty 库,或者如果有人在后面使用方案,请不要感到羞耻。

It's a beautiful language.
这是一种美丽的语言。

So stuff like that.
所以像这样的东西。

That's what that's all about.
这就是全部的意义所在。

Where does Prompty actually fit, though?
不过,Prompty 实际上适合在哪里?

It's like, oh, jeez, Seth, another orchestrator?
这就像,哦,天哪,赛斯,另一个管弦乐队?

I like to think of orchestrators in terms of a spectrum.
我喜欢从频谱的角度来考虑编排器。

I'm going to use this thing.
我要用这个东西。

Let's see if it works.
让我们看看它是否有效。

I like to think of this left hand as orchestration of prompts together.
我喜欢把这只左手看作是一起编排提示。

Who is in charge?
谁负责?

Is it you completely, or is it some library?
是你完全的,还是某个图书馆?

At the bottom level, I like to think of a use case.
在底层,我喜欢考虑一个用例。

Is it super non specific or super specific?
是超级非特异性还是超级特异性?

If any of you have used TypeScript or TypeChat, TypeChat, what it does is it uses an LLM to force your responses into a particular JSON schema.
如果你们中的任何人使用过 TypeScript 或 TypeChat,TypeChat,它的作用是使用 an LLM 将您的响应强制转换为特定的 JSON 模式。

Very use case specific, all orchestrated in a library.
非常特定于用例,所有这些都在库中编排。

Does that make sense?
这有意义吗?

The second one that I'd like to talk about is the most generic kind, which is a pure API call.
我想谈的第二个是最通用的类型,它是一个纯粹的 API 调用。

The API call is the most generic and you do all the work.
API 调用是最通用的,您可以完成所有工作。

Prompt flow is a little bit higher because you need to write your prompts and you need to do the orchestration yourself.
提示流稍微高一点,因为您需要编写提示,并且需要自己进行业务流程。

As you go all the way to the top with agentic based things like autogen notice that the orchestration is handled in the library, and there's places for all of these things.
当你使用基于代理的东西(如autogen)一路走到顶部时,请注意编排是在库中处理的,并且所有这些东西都有地方。

Prompty lives about a half step up from an API call, half step up and there's four things that it does in any run time.
Prompty 的生存距离 API 调用大约是半步,是 API 调用的一半,它在任何运行时都会做四件事。

Now, the run time will decide how to do this, but what it will do, was it will take inputs.
现在,运行时将决定如何执行此操作,但它将做什么,它将接受输入。

It will render the actual markdown so that it's actually the text that you want.
它将呈现实际的 Markdown,以便它实际上是您想要的文本。

It will parse it into the shape that the LLM needs it.
它会将其解析为LLM需要的形状。

You know how you have to have a user assistant, user system.
你知道你必须有一个用户助手,用户系统。

It will parse that for you.
它将为您解析。

It will execute the LLM call and sometimes it will do some post processing.
它将执行LLM调用,有时它会进行一些后处理。

This is what we suggest you should do.
这就是我们建议你应该做的。

The required one time methods have to have some shape or form of a load of Prompty, execute a Prompty and trace it.
所需的一次性方法必须具有某种形状或形式的 Prompty 加载,执行 Prompty 并跟踪它。

This is the developer flow we see.
这就是我们看到的开发人员流程。

If you're looking at this, and you're like, wow, that looks like a regular developer flow it is, we're only going to be covering the top half because we're dubbing this the unofficial Prompty keynote non keynote.
如果你正在看这个,你会想,哇,这看起来像一个常规的开发人员流程,我们只会涵盖上半部分,因为我们称之为非官方的 Prompty 主题演讲非主题演讲。

We're going to talk about starting developing and we're going to get into evaluating.
我们将讨论开始开发,我们将进入评估。

But there's a lot of more sessions that you've probably seen.
但是您可能已经看过更多的会议。

There's Prompty in there a little bit sprinkled in evaluation and other things.
这里面有 Prompty,在评估和其他事情上有一点点。

We'll get to that soon.
我们很快就会谈到这一点。

Now, I think we need to get into Prompty so just take a look at Prompty.
现在,我认为我们需要进入 Prompty,所以看看 Prompty。

I'm going to invite Leah to come on stage.
我要邀请莉亚上台。

Leah.
利亚。

Oh, and since this is semi keynote, I have to do the music.
哦,既然这是半主题演讲,我必须做音乐。

So let's clap.
所以让我们鼓掌吧。

(applause) LEAH BAR ON SIMMONS: Thanks, Seth.
(掌声)LEAH BAR ON SIMMONS:谢谢,Seth。

I'm Leah.
我是莉亚。

I'm a product manager on the Azure AI team, and today, I'm here to show you what it looks and feels like to develop with Prompty.
我是 Azure AI 团队的产品经理,今天,我在这里向你展示使用 Prompty 进行开发的外观和感觉。

Wake up my screen here.
在这里唤醒我的屏幕。

Seth Juarez: I got you.
Seth Juarez:我明白了。

Ooh.
哦。

Leah Bar On Simmons: We can see it.
Leah Bar On Simmons:我们可以看到。

Seth Juarez: I got an assist, and I'm not even a sportsman.
塞斯·华雷斯:我得到了一个助攻,我甚至不是一个运动员。

Leah Bar On Simmons: Thank, Seth.
Leah Bar On Simmons:谢谢,Seth。

How it looks and feels to develop with Prompty, and the spoiler alert here is it's pretty dang easy.
使用 Prompty 开发的外观和感觉如何,这里的剧透警报是它非常容易。

As you saw in the keynote yesterday, we could bring a Prompty from AI Studio.
正如您在昨天的主题演讲中所看到的,我们可以带来来自 AI Studio 的 Prompty。

But for today, we're going to start in my local development environment and just build this up from scratch.
但今天,我们将从我的本地开发环境开始,从头开始构建它。

You can even do this with me.
你甚至可以和我一起做这件事。

You can follow along.
你可以跟着做。

We're going to use the Prompty extension in VS code.
我们将在 VS 代码中使用 Prompty 扩展。

You can see my screen here from the marketplace, I've installed the Prompty extension, and I can get started right away.
你可以从市场上看到我的屏幕,我已经安装了 Prompty 扩展,我可以立即开始。

I'm going to right click here and select new Prompty.
我将右键单击此处并选择新的提示。

Now, for those that have been following along in the session so far at Build, you probably have seen some of these files pop up here and there, and we're really building with Prompty throughout our applications.
现在,对于那些在 Build 中一直关注会话的人来说,您可能已经看到其中一些文件在这里和那里弹出,并且我们在整个应用程序中确实使用 Prompty 进行构建。

What we're looking at here is a markdown file that has a system prompt that probably people are pretty familiar with.
我们在这里看到的是一个 Markdown 文件,它有一个系统提示符,人们可能非常熟悉。

But it has a modified front matter that lets us define and amel some of the specifications, and the Prompty runtime and the extension will help us run this.
但是它有一个修改的前端,让我们可以定义和修改一些规范,而 Prompty 运行时和扩展将帮助我们运行它。

We all know and love Seth, but it's not always all about Seth.
我们都知道并喜欢赛斯,但这并不总是关于赛斯的全部。

So let's make a few updates here.
因此,让我们在这里进行一些更新。

What we're looking at is we can see this configuration here that we can specify that we want to connect to a chat completion model.
我们看到的是,我们可以在这里看到这个配置,我们可以指定我们想要连接到聊天完成模型。

I'm using an Azure OpenAI model that I have deployed in my Azure AI project.
我正在使用已在 Azure AI 项目中部署的 Azure OpenAI 模型。

Let's bring in some things here to make this work.
让我们在这里引入一些东西来完成这项工作。

As you'll see, I'm going to go through this and show you little pieces that I did to set up my development environment.
正如你所看到的,我将介绍这一点,并向你展示我为设置我的开发环境所做的一些小部分。

But there's very little that I did, and I'll highlight it as we go.
但是我做的很少,我会在我们进行时强调它。

Let me bring this in here.
让我把这个带进来。

Then we're going to use GPT-4.
然后我们将使用 GPT-4。

But of course, across all the sessions, you've seen a lot of examples of some really cool and fun models that you can use to play with us.
但是,当然,在所有课程中,您已经看到了很多非常酷和有趣的模型示例,您可以使用它们与我们一起玩。

We can also update some parameters, and the extension gives us some helpful completions here.
我们还可以更新一些参数,扩展在这里为我们提供了一些有用的完成。

So I can see the options that I have to update parameters.
因此,我可以看到必须更新参数的选项。

In this case, let's update the temperature because we want some more creative responses.
在这种情况下,让我们更新温度,因为我们想要一些更有创意的响应。

We're going to keep to the theme of the outdoorsy Contoso as we're doing across the board here.
我们将一如既往地坚持户外 Contoso 的主题。

This will be our outdoorsy prompt, and it's going to use context to ground an incoming question.
这将是我们的户外提示,它将使用上下文来为传入的问题奠定基础。

We can see here that we provide a sample, and this aligns the inputs of what the Prompty expects.
我们可以在这里看到,我们提供了一个样本,这与 Prompty 期望的输入保持一致。

My first name is Leah and then we're giving it some context, and it's going to use that context to ground the question that I asked to ground its response.
我的名字是Leah,然后我们给它一些背景,它将使用这个背景来为我提出的问题奠定基础。

We can preview this and actually see what the model is going to get.
我们可以预览一下,并实际看到模型将得到什么。

What I can see here is that this is the system prompt, and we're going to let the system know it's an assistant to help answer questions, and we're going to ask it to add some personal flare, which is just characteristic of Prompty as an experience.
我在这里可以看到的是,这是系统提示,我们将让系统知道它是一个帮助回答问题的助手,我们将要求它添加一些个人耀斑,这只是提示作为一种体验的特征。

You can see that it filled in the customer details here.
您可以看到它在此处填写了客户详细信息。

The first name was Leah.
第一个名字叫利亚。

It has the context that it needs, and it knows the question that I'm asking.
它有它需要的上下文,它知道我要问的问题。

Because I specified this sample, we can run this right out of the gate.
由于我指定了此示例,因此我们可以直接运行此示例。

What this is going to do is it's going to load and show us the Prompty output, and we'll be able to see the response we get from the model.
这将要做的是加载并向我们显示提示输出,我们将能够看到我们从模型中获得的响应。

Let me give a little more screen here.
让我在这里再给一个屏幕。

We can see that it called the model that I specified and it's referring to me.
我们可以看到它调用了我指定的模型,它指的是我。

It's saying, Hey, Leah, we can see the emojis popping up that are related to the outdoorsy theme.
它说,嘿,莉亚,我们可以看到弹出的表情符号与户外主题有关。

I asked it about tents here.
我问它关于这里的帐篷。

Because the context we've provided was talking about a specific tent, it's grounding its response with that context, so we can see it's responding specifically about the Alpine Explorer tent that it knows about.
因为我们提供的上下文是在谈论一个特定的帐篷,所以它的反应是基于这个背景的,所以我们可以看到它是专门针对它所知道的阿尔卑斯山探险家帐篷的。

Now, if we wanted a little more details about the calls and the requests that are being made, you can use the verbose output with Prompty.
现在,如果我们想要有关调用和正在发出的请求的更多详细信息,则可以将详细输出与 Prompty 一起使用。

But for now, the Prompty output gives us what we want to see.
但就目前而言,Prompty 输出为我们提供了我们想要看到的内容。

You might have noticed that we didn't specify authentication here, we just specified our end point in deployment.
您可能已经注意到,我们没有在此处指定身份验证,我们只是在部署中指定了端点。

This is using Azure Active Directory authentication or AAD, and that's what we recommend for building secure applications.
这是使用 Azure Active Directory 身份验证或 AAD,这是我们建议用于构建安全应用程序的方法。

One thing to note that I did here is I set a role assignment on my Azure OpenAI resource to make this work.
要注意的一件事是,我在我的 Azure OpenAI 资源上设置了一个角色分配来完成这项工作。

Now, if you tried this and you hadn't set up that role, you'd actually get a helpful error message that would walk you through the steps you need to do to set that up, and then you'd be able to run this.
现在,如果您尝试了此操作并且尚未设置该角色,则实际上会收到一条有用的错误消息,该消息将引导您完成设置该角色所需的步骤,然后您就可以运行它了。

Now, we also know that developers like their specific preferences in their development environment, and we want to meet developers where they are.
现在,我们也知道开发人员喜欢他们在开发环境中的特定偏好,我们希望在开发人员所在的地方与他们会面。

The system also can interpret environment variables and.m files in a pretty standard format, and I'm just going to show you here, I have my full samples that I can pull from and just show you an example.
该系统还可以以非常标准的格式解释环境变量和 .m 文件,我将在这里向您展示,我有完整的示例,我可以从中提取并向您展示一个示例。

If I had a.m file that looks something like this with the OpenAI end point that I wanted, I could look at this prompty here, and if I just replaced the end point with this reference to the environment variable, it would be able to pull that in.
如果我有一个看起来像这样的 a.m 文件,其中包含我想要的 OpenAI 端点,我可以在这里查看这个提示,如果我只是用对环境变量的引用替换端点,它将能够将其拉入。

We've looked at these model configurations here.
我们在这里查看了这些模型配置。

But let's say you had multiple promptys that we're going to share configurations, or you wanted to be able to easily switch between configurations.
但是,假设您有多个提示,我们将共享配置,或者您希望能够在配置之间轻松切换。

The Prompty extension has a nice way to do that.
Prompty 扩展有一个很好的方法可以做到这一点。

Down here, I can select my configurations.
在这里,我可以选择我的配置。

I can see the ones that are pre-specified for me, and I could modify them or add new ones.
我可以看到为我预先指定的那些,我可以修改它们或添加新的。

What this is going to do is use the VS code user settings, and it's going to point me to directly the settings.JSON that I want to modify to make this work.
这将要做的是使用 VS 代码用户设置,它将直接指向我设置。我想修改的 JSON 以使其正常工作。

What you can see here is I have my default configuration, looks similar to what I had specified in the Prompty file because I specified the end point and the deployment in the Prompty, it overrides what we see here, but I could fall back to this or use it if I wanted to configure and share configurations.
您可以在这里看到的是我有我的默认配置,看起来类似于我在 Prompty 文件中指定的配置,因为我在 Prompty 中指定了端点和部署,它覆盖了我们在这里看到的内容,但如果我想配置和共享配置,我可以回退到这个或使用它。

If I had a different kind of model connection that I wanted, I could specify something different here in the settings.
如果我想要不同类型的模型连接,我可以在设置中指定不同的内容。

Now, we also know that developers often work in teams and use source control.
现在,我们也知道开发人员经常在团队中工作并使用源代码管理。

An additional property that you can set here is actually a workspace setting.
您可以在此处设置的附加属性实际上是工作区设置。

I'm going to switch to workspace configurations and you'll notice on the left that now, it created a file for me in the VS code settings that I could actually check into my Git repository.
我将切换到工作区配置,您会在左侧注意到,现在,它在 VS 代码设置中为我创建了一个文件,我实际上可以将其签入我的 Git 存储库。

Then my co-workers, my team members could recreate this development environment and run the same application.
然后,我的同事和团队成员可以重新创建这个开发环境并运行相同的应用程序。

Let's customize this and make it a little bit more our own.
让我们自定义它,让它更像我们自己的。

Let's customize this prompt and do a bit of prompt engineering.
让我们自定义此提示并做一些提示工程。

So far we have an outdoorsy prompt, let me give us a little bit more space, that takes in some context and answers a question, and we've asked it to be personable and add some personal flare with the emojis.
到目前为止,我们有一个户外提示,让我给我们多一点空间,它考虑了一些上下文并回答了一个问题,我们要求它风度翩翩,并用表情符号添加一些个人闪光。

We saw that in action.
我们在行动中看到了这一点。

But let's have it tell us a joke as well.
但是让我们也让它给我们讲个笑话。

I'm going to bring in some context here, and we'll walk through the changes that I'm making to the prompt.
我将在这里引入一些上下文,我们将逐步介绍我对提示所做的更改。

What I've added to the system message here is add an outdoorsy joke.
我在这里添加到系统消息中的是添加一个户外笑话。

I'm telling it a little bit about how I want it to phrase the joke, and I'm also asking it to tell a joke that's directly related to the specific question asked.
我告诉它一些关于我希望它如何表达这个笑话,我也要求它讲一个与所问的具体问题直接相关的笑话。

Because I want to be able to parse and see the response in the joke and maybe do some more things with this a little later on, I wanted to respond with a JSON object, and I can specify an additional parameter here to help make this response consistent.
因为我希望能够解析和查看笑话中的响应,并且稍后可能会对此做更多事情,所以我想使用 JSON 对象进行响应,并且我可以在此处指定一个附加参数来帮助使此响应保持一致。

I'll use "Control" "Enter" again, pick response format, and I can specify a JSON object here.
我将再次使用 “Control” “Enter”,选择响应格式,我可以在这里指定一个 JSON 对象。

Let's get this a run.
让我们来试一试。

I'm actually going to use F5 as a shortcut here, and we're going to see if we get back a joke.
实际上,我在这里将使用 F5 作为快捷方式,我们将看看我们是否能开个玩笑。

I can see the response, now we're looking at a JSON object.
我可以看到响应,现在我们正在查看一个 JSON 对象。

The response will look pretty similar because we kept the same content.
响应看起来非常相似,因为我们保留了相同的内容。

But then I get a joke here.
但后来我在这里开了个玩笑。

By the way, why don't tents ever get lonely?
顺便问一下,为什么帐篷永远不会寂寞?

Because they're always pitched in a good location.
因为他们总是在一个好位置。

Not sure how much sense that joke makes.
不知道这个笑话有多大意义。

I get something different every time I run this, but we're going to get to explore and see how either we can make it better or at least know that this joke doesn't make that much sense.
每次运行它时,我都会得到一些不同的东西,但我们将开始探索,看看我们如何让它变得更好,或者至少知道这个笑话没有多大意义。

Here's what we've seen so far.
以下是我们目前所看到的。

We've seen us load up a prompty.
我们已经看到我们加载了一个提示。

We can run it right out of the box.
我们可以开箱即用地运行它。

We can make some changes, customize the details that we have, and set the configurations to fit what we want.
我们可以进行一些更改,自定义我们拥有的详细信息,并设置配置以适合我们想要的配置。

Now as a developer, I'm wondering, how can I integrate this into my code?
现在,作为一名开发人员,我想知道,如何将其集成到我的代码中?

I might want to work with Langchain, so I could right click this prompty and select Add Langchain code.
我可能想使用 Langchain,所以我可以右键单击此提示并选择添加 Langchain 代码。

This is going to show me a code snippet for Langchain that I in my Langchain enabled environment would be able to run out of the box.
这将向我展示 Langchain 的代码片段,我在启用 Langchain 的环境中将能够开箱即用。

I may prefer C# and want to work with Semantic Kernel, and I could load a similar code snippet that's actually quite simple that I would be able to run using Semantic Kernel.
我可能更喜欢 C# 并希望使用语义内核,我可以加载一个类似的代码片段,它实际上非常简单,我可以使用语义内核运行。

But for me as a developer attending Build 2024, it's been so exciting to see the capabilities that prompt flow has around tracing and evaluation.
但对于我来说,作为一名参加 Build 2024 的开发人员,看到 prompt flow 在跟踪和评估方面的功能真是太令人兴奋了。

I want to build this application using prompt flow and get all of that goodness and integrate it with prompty.
我想使用 prompt flow 构建此应用程序,并获得所有这些优点并将其与 prompty 集成。

Let's click and select Add Prompt Flow Code.
让我们单击并选择添加提示流代码。

All of these code snippets are following a very basic, simple, and similar pattern.
所有这些代码片段都遵循一个非常基本、简单和相似的模式。

They're going to load the prompty, execute the prompty with passing it the inputs and context that it needs, and then return the result, and we would be able to parse that result or show it however we want it.
他们将加载提示符,执行提示符,向它传递它需要的输入和上下文,然后返回结果,我们将能够解析该结果或以我们想要的方式显示它。

Now, I mentioned before that I did a little bit of environment setup to make this work, so I just want to highlight exactly what that was.
现在,我之前提到过,我做了一些环境设置来完成这项工作,所以我只想强调一下它到底是什么。

I created a virtual environment here, and all I needed was to install two packages, the prompt flow package and the Azure identity package, and then that means that I'm going to be able to run this out of the box.
我在这里创建了一个虚拟环境,我只需要安装两个包,即提示流包和 Azure 标识包,然后这意味着我将能够开箱即用地运行它。

As a note, I also ran AZ login to authenticate my developed environment to Azure.
请注意,我还运行了 AZ 登录,以向 Azure 验证我开发的环境。

Let's give this a run.
让我们试一试。

I'm going to open back up my prompt flow.
我将打开备份我的提示流。

We'll give this a run.
我们将试一试。

Let's see what I did here.
让我们看看我在这里做了什么。

Did I type something?
我输入了什么吗?

I must have.
我一定有。

Let's find out.
让我们来了解一下。

Can it help me with this error, let's see.
它可以帮助我解决这个错误吗,让我们看看。

Did I make a change?
我做了更改吗?

I don't think I made a change.
我不认为我做了改变。

Let's try to run this again.
让我们尝试再次运行它。

What we're expecting is to actually see a very similar output to what we got when we ran the prompty.
我们期望的是实际上看到与运行提示符时得到的输出非常相似的输出。

But it's just going to be running this Python script with prompt flow, and that's what we get.
但它只是用提示流运行这个 Python 脚本,这就是我们得到的。

We see that we're getting a JSON object back.
我们看到我们正在获取一个 JSON 对象。

We get our response again, and now we have a different joke.
我们再次得到回应,现在我们有一个不同的笑话。

Let's see if it's any better.
让我们看看它是否更好。

By the way, why don't tents ever run away to join the circus?
顺便问一下,为什么帐篷从来不跑去加入马戏团?

Because they can't stand the poles.
因为他们受不了杆子。

That still doesn't make any sense to me, anyone?
这对我来说仍然没有任何意义,有人吗?

No.

We could, of course, do a lot more to make this better.
当然,我们可以做更多的事情来让它变得更好。

But with just a few lines of code that were generated for me, I was able to run this out of the box with a prompt flow implementation that integrated with the prompty that I had.
但是,只需为我生成几行代码,我就能够通过与我拥有的提示集成的提示流实现来开箱即用地运行它。

Hopefully, you've seen so far that prompty is a versatile prompt class and formatting tool.
希望到目前为止,您已经看到 prompty 是一个多功能的提示类和格式化工具。

But because that's all it is and it's that simple, we could use prompty to develop anything that we wanted.
但是因为仅此而已,而且就是这么简单,我们可以使用prompty来开发我们想要的任何东西。

For example, what if we developed a custom evaluator prompty that could test and assess how well the joke that was told was related to the query.
例如,如果我们开发了一个自定义的评估器提示,可以测试和评估所讲述的笑话与查询的相关性。

I'm not going to get into whether it's a good joke or not, but because we ask the prompty, and I can show that again here, the joke should be directly related to the specific question asked.
我不打算讨论这是否是一个好笑话,但因为我们问提示,我可以在这里再次证明,这个笑话应该与提出的具体问题直接相关。

Let's write an evaluator prompty that can help us assess whether that's the case.
让我们写一个评估器提示,可以帮助我们评估是否是这种情况。

Now, normally, I would just click New Prompty and get started, but in the interest of time, I'm going to pull over an evaluator prompty that I wrote before, and we'll walk through it together.
现在,通常情况下,我只需单击“新建提示”即可开始,但为了节省时间,我将拉出我之前编写的赋值器提示,我们将一起完成它。

A lot of this should look very similar.
其中很多看起来应该非常相似。

We have an eval prompty and it's mentioning that this prompty evaluates whether a joke is related to the query.
我们有一个评估提示,它提到这个提示评估一个笑话是否与查询相关。

We have a similar configuration.
我们有一个类似的配置。

We still want to be able to parse out the response consistently, so we're setting that JSON object response format.
我们仍然希望能够一致地解析响应,因此我们设置了 JSON 对象响应格式。

Now, we've also specified inputs here.
现在,我们还在此处指定了输入。

This is something that I can choose to do or not.
这是我可以选择做或不做的事情。

The sample in the first one was able to define those inputs for us but just to be extra explicit here, I can add my inputs that are going to be the query and the joke.
第一个示例中的示例能够为我们定义这些输入,但为了在这里更加明确,我可以添加我的输入,这些输入将成为查询和笑话。

Let's look at the sample here.
让我们看一下这里的示例。

This is a joke that the model gave me before, and I think it's much better.
这是模特之前给我开的玩笑,我觉得好多了。

My query is, do I need any equipment to climb an average mountain?
我的问题是,我需要任何设备来攀登一座普通的山峰吗?

The joke it gave me was, by the way, why do mountains make terrible meteorologists, because they always predict peak conditions.
顺便说一句,它给我的笑话是,为什么山脉会造就可怕的气象学家,因为他们总是预测峰值条件。

I'm a big fan of this one.
我是这个的忠实粉丝。

The system prompt, this is how we get into actually some prompt engineering for a custom evaluator.
系统提示,这就是我们如何为自定义评估器进行一些提示工程。

It's really this simple.
就这么简单。

I'm just using natural language to define what I want this model to do.
我只是使用自然语言来定义我希望这个模型做什么。

I tell the system, I'm an AI tool that determines if a joke is directly related to the main intent of the query.
我告诉系统,我是一个人工智能工具,可以确定一个笑话是否与查询的主要意图直接相关。

I'm going to ask it to score between one and three where one would be a joke entirely unrelated to the query, and three would be a joke that's directly related to the main intent.
我将要求它在 1 到 3 之间得分,其中 1 是与查询完全无关的笑话,3 是与主要意图直接相关的笑话。

I'm also asking it to determine the main intent, and then provide a reasoning for its score.
我还要求它确定主要意图,然后为其分数提供理由。

you can see here that I've asked it to provide a format with a score and reasoning.
你可以在这里看到,我要求它提供一种带有分数和推理的格式。

The reasoning will help you understand a little bit about how the model is behaving and what other prompt engineering you might need to do to make it behave better.
推理将帮助您了解模型的行为方式,以及可能需要执行哪些其他提示工程才能使其行为更好。

Because I've specified a sample here with a query and a joke, I can again run this using the run button and prompty and we can see the response.
因为我在这里指定了一个带有查询和笑话的示例,所以我可以使用运行按钮和提示再次运行它,我们可以看到响应。

Let's give that a look.
让我们来看看。

This pulled back up our prompty output.
这拉回了我们的快速输出。

We can see it's calling that same model that we specified, and we get a score of three.
我们可以看到它调用了我们指定的相同模型,我们得到了 3 分。

It actually provides some very detailed reasoning.
它实际上提供了一些非常详细的推理。

The joke is directly related to the query.
这个笑话与查询直接相关。

The query is about climbing mountains, and it references mountains and plays on the term peak conditions.
该查询是关于爬山的,它引用了山脉并发挥了术语峰值条件的作用。

It's really giving us a lot of details here.
它真的给了我们很多细节。

It also says it pertains to weather predictions that might be considered during mountain climbing.
它还表示,它与登山期间可能考虑的天气预报有关。

That's a pretty good response, and we've been able to validate it directly using prompty and now we want to integrate this back into our prompt flow code.
这是一个很好的响应,我们已经能够直接使用 prompty 验证它,现在我们想将其集成回我们的提示流代码中。

Let me pull back up our code, and I'm actually going to split screen and close a few things so we can take a look at this together.
让我回过头来拉回我们的代码,我实际上要分屏并关闭一些东西,这样我们就可以一起看一下。

This is the code that we'd written before, and now, because this is just another prompty, the code pattern is going to be very similar.
这是我们之前编写的代码,现在,因为这只是另一个提示,所以代码模式将非常相似。

Like we said before, we loaded the prompty and we provided it the context that it needed and parsed the result.
就像我们之前说的,我们加载了提示,并为其提供了所需的上下文并解析了结果。

Because we're going to add some more logic here, I'm going to print out the question that we're going to ask, and I'm going to print out the result.
因为我们要在这里添加更多的逻辑,所以我要打印出我们要问的问题,我要打印出结果。

Now we can get started integrating with the new evaluator prompty that we want to include.
现在,我们可以开始与要包含的新赋值器提示集成。

I'm also going to simplify this so that we're doing all of our printing inside the main function here.
我还将简化这一点,以便我们在这里的 main 函数中完成所有打印。

Path to prompty, I can update that just directly in the in the code.
提示的路径,我可以直接在代码中更新它。

Of course, it's very hard to type when there's a lot of eyes on you, /eval.prompty.
当然,当有很多眼睛盯着你时,输入是非常困难的,/eval.prompty。

Then I want to load this.
然后我想加载这个。

This is going to be our eval_flow, and I'm going to say prompty.load, and I can pass that path to prompty in here.
这将是我们eval_flow,我要说 prompty.load,我可以在这里传递该路径到 prompty。

Then I want to parse this result.
然后我想解析这个结果。

Let me say eval.response.
让我说 eval.response。

Now, I know, looking on the left, what this expects.
现在,我知道,从左边看,这期待什么。

We know that the inputs it needs are a query and a joke, so our query is going to be that question that we asked before and we're printing out here, and then we need to pass it a joke.
我们知道它需要的输入是一个查询和一个笑话,所以我们的查询将是我们之前问过的那个问题,我们在这里打印出来,然后我们需要给它一个笑话。

Now, this joke, we haven't defined yet, so that's something that we need to extract from the result of the first flow.
现在,这个笑话,我们还没有定义,所以这是我们需要从第一个流程的结果中提取的东西。

Let's go ahead and do that.
让我们继续这样做。

I know that the result was that JSON object that had the response and the joke in it.
我知道结果是JSON对象有响应和笑话。

Let's say this.
让我们这样说。

Now, so that we can really clearly see what comes back, let's say evaluation results.
现在,为了让我们能够真正清楚地看到结果,让我们说一下评估结果。

I don't think there's anything harder than coding when people are watching you, and then we'll print out eval_response.
我不认为有什么比编码更难的了,当人们看着你时,我们会打印出eval_response。

Now, this is the same prompt flow code that we ran before.
现在,这与我们之前运行的提示流代码相同。

All we've done is added some extra logic, so let's give this a run.
我们所做的只是添加了一些额外的逻辑,所以让我们试一试。

Now, some of you that are very familiar with Python may notice something that's not quite right with one of these lines of code.
现在,你们中的一些人非常熟悉 Python 可能会注意到其中一行代码不太对劲。

This run is going to fail, but it's going to give me an opportunity to show you just how easy it is to debug.
这次运行会失败,但它会给我一个机会,向你展示调试是多么容易。

I get an attribute error here, and because it's telling me that the dict object has no attribute joke, it makes me think that there's something not quite right on Line 30.
我在这里遇到一个属性错误,因为它告诉我 dict 对象没有属性笑话,所以它让我认为第 30 行有些不太对劲。

I'm going to place a breakpoint here and I'm going to debug this file.
我将在此处放置一个断点,并调试此文件。

For those familiar with VS Code, this is going to launch up the debugger experience.
对于熟悉 VS Code 的用户,这将启动调试器体验。

What I expect is that the execution is going to pause on Line 30 where I set this breakpoint.
我所期望的是,执行将在我设置此断点的第 30 行暂停。

We can see that's what happens.
我们可以看到这就是发生的事情。

So we see in the output the question was printed.
因此,我们在输出中看到问题已打印出来。

What can you tell me about your tense?
你能告诉我你的时态吗?

The response that has both the response and the joke was printed there.
既有回应又有笑话的回应就印在那里。

Now, if I go to the debug console, I can verify that this is actually the line that's causing the issue.
现在,如果我转到调试控制台,我可以验证这实际上是导致问题的行。

So result joke clearly is outputting that same attribute error that I got before.
所以结果笑话显然是输出了我之前得到的相同属性错误。

I know now the mistake that I made, and I can validate that this is the correct syntax by seeing that that parses out the joke.
我现在知道我犯了什么错误,我可以通过看到它解析出笑话来验证这是正确的语法。

By the way, why don't tens ever get lonely.
顺便说一句,为什么十个人永远不会感到孤独。

This is one that we've sort of seen before.
这是我们以前见过的。

So now that I know this line of code is good, let me bring it back in here.
所以现在我知道这行代码很好,让我把它带回这里。

We should be good to give this a run.
我们应该好好试一试。

So what we're expecting to see here just like before, is the Oh, I'm still in a debugger I.
因此,我们期望在这里看到的就像以前一样,是哦,我仍然在调试器中。

Let's give this a pause and give it another run now.
让我们暂停一下,现在再运行一次。

I might have double run this, so we'll see what happens.
我可能已经运行了两次,所以我们会看到会发生什么。

But regardless, we're going to be loading the prompt.
但无论如何,我们将加载提示符。

We're going to get the response, which is what we just see here.
我们将得到回应,这就是我们在这里看到的。

Now we expect it to do a little bit more.
现在我们预计它会做得更多一点。

It's going to give us the evaluation result, and we expect to see a score and reasoning.
它将给我们评估结果,我们希望看到分数和推理。

The score is a three, and the reasoning, the joke is directly related to the query, as it specifically mentions tense, which is the main subject of the query.
分数是三分,推理,笑话与查询直接相关,因为它特别提到了时态,这是查询的主要主题。

That's been the basics of developing with prompt and prompt flow.
这是使用快速和快速流程进行开发的基础。

Look, we even got two different responses here.
看,我们甚至在这里得到了两种不同的回应。

It's actually really interesting.
这其实真的很有趣。

The first time it gave a three, the second time it gave a two.
第一次给了三分,第二次给了两分。

That's an exact example of how you might go back to your evaluator, do some more prompt engineering to get the results that you expect.
这是一个确切的例子,说明你如何回到你的评估者那里,做一些更及时的工程设计,以获得你所期望的结果。

That's been the basics.
这是最基本的。

Of course, there's so much more that we could do with prompt engineering data prep evaluation, but for now, I'm going to pass back to Seth to dive deeper into an end to end application that showcases how prompty can help you slay your AI dragons.
当然,通过及时的工程数据准备评估,我们可以做更多的事情,但现在,我将回到 Seth 那里,更深入地研究一个端到端的应用程序,展示 prompty 如何帮助你杀死你的 AI 龙。

Seth Juarez: Let's give her a hand.
塞思·华雷斯:让我们帮她一把。

Isn't that fantastic?
这不是太棒了吗?

Thank you so much, Leah.
非常感谢你,莉亚。

Hopefully you saw that basically you are working with prompts as if you would work with a function.
希望您看到基本上您正在处理提示,就好像您将使用函数一样。

Are you seeing that?
你看到了吗?

I hope you're feeling that because the thing about prompt engineering to me is that we want prompt engineering to actually be prompt engineering, where you're typing things.
我希望你有这种感觉,因为对我来说,关于提示工程的事情是,我们希望提示工程实际上是提示工程,你正在输入东西。

You're looking at things in the preview.
你正在预览中查看内容。

You're running it quickly.
你运行得很快。

You're putting it into code.
你正在把它放到代码中。

You're debugging it the way you debug stuff.
你正在以调试东西的方式调试它。

Even though the response is stochastic, I had to use a $5 word once because this is the non keynote keynote.
尽管响应是随机的,但我不得不使用一次 5 美元的单词,因为这是非主题演讲的主题演讲。

Even though the response is stochastic, the way we deal with it as developers should not be that way.
尽管响应是随机的,但我们作为开发人员处理它的方式不应该是这样的。

It should not be that way.
不应该是那样的。

It's something that we want to do.
这是我们想做的事情。

You saw the coolest part, I think, as I was watching Leah present was It was basically code.
你看到了最酷的部分,我想,当我看着莉亚在场时,它基本上是代码。

You saw how to develop with prompty.
你看到了如何迅速发展。

By the way, we have a really important question at the end.
顺便说一句,我们最后有一个非常重要的问题。

Using Prompt DVS code extension.
使用提示 DVS 代码扩展。

We showed you how to add code snippets, because one of the things is once you get this new stuff, it's like, Well, how do I even to write anything?
我们向你展示了如何添加代码片段,因为其中一件事是一旦你得到了这些新东西,就像,好吧,我该如何编写任何东西?

We put it right in the extension so you can see an example.
我们把它放在扩展中,这样你就可以看到一个例子。

Do you have to use that code?
你必须使用该代码吗?

No.

But it definitely will get you started quicker, and you'll be able to do something faster.
但它肯定会让你更快地开始,你将能够更快地做一些事情。

You saw that we had lag chain.
你看到我们有滞后链。

We had semantic kernel, and, of course, prompt flow.
我们有语义内核,当然还有快速流。

You also saw her writing a custom evaluator.
您还看到她编写了一个自定义评估器。

Did you know that the way that you evaluate these prompts is with other prompts?
您是否知道评估这些提示的方式是与其他提示一起评估的?

Those are called GPT star metrics, and they work really well.
这些被称为 GPT 星级指标,它们效果非常好。

Like when you hear about evaluation and all of our sessions, and you hear about groundedness or fluency or relevance, those are all prompts that are looking at input and measure exactly what she did.
就像当你听到评估和我们所有的会议时,你听到脚踏实地、流利度或相关性,这些都是在查看输入并准确衡量她所做的事情的提示。

But it was more near and dear to my heart because it was a dad joke evaluator.
但它更贴近我的心,因为它是一个爸爸笑话评估器。

She didn't want to say it, but she is the best dad joke giver of them all.
她不想说,但她是他们所有人中最好的爸爸笑话提供者。

So just be aware, so ask her for one.
所以要注意,所以问她一个。

Then the last thing we saw is that she would integrate multiple promptys into a single piece of code.
然后我们看到的最后一件事是她会将多个提示集成到一段代码中。

That's, I think the most interesting part.
我认为这是最有趣的部分。

Because you hear about this development that's called agentic, and you're like, wow, that feels like for some data scientist or someone smarter than me.
因为你听说过这种被称为代理的发展,你会觉得,哇,这感觉就像是一些数据科学家或比我聪明的人。

But it turns out that agentic programming is basically making a prompt, looking at the response, and writing the code to do something after that.
但事实证明,代理编程基本上是发出提示,查看响应,然后编写代码来做一些事情。

Then sometimes you put it in a loop, sometimes the prompt decides when to break out of the loop.
然后有时你把它放在一个循环中,有时提示决定何时打破循环。

When you think of it like that as a programmer, all of a sudden, the possibilities of doing things just increase.
当你像程序员这样想时,突然之间,做事的可能性就增加了。

So I thought I would show you an agentic app.
所以我想我会向你展示一个代理应用程序。

The GitHub repo is there.
GitHub 存储库就在那里。

I'm going to be honest.
我要说实话。

I finished it last night just for you, but Cassie has built a better example that I'll give you the link to that has everything you have.
我昨晚只为你完成了它,但 Cassie 建立了一个更好的例子,我会给你一个链接,其中包含你所拥有的一切。

I want to do something a little bit smaller.
我想做一些小一点的事情。

We're going to write a multi agent application that will basically, given a few instructions, will write blog posts for the Contoso outdoor company.
我们将编写一个多代理应用程序,该应用程序基本上会为Contoso户外公司编写博客文章。

You know how you're like, this is going to solve the blank page problem.
你知道你是什么样的人,这将解决空白页问题。

How about we start solving the blank page problem right now.
不如我们现在就开始解决空白页问题。

This is a real app, so much so that you can see it like literally running right here.
这是一个真正的应用程序,以至于你可以看到它就像在这里运行一样。

This is VT and in the back end, there's a flask.
这是 VT,在后端,有一个烧瓶。

It looks like something, I'm going to stop this here because it looks like I need to PF service, service stop.
它看起来像是一些东西,我将在这里停止它,因为看起来我需要 PF 服务,服务停止。

Then I'll start it again.
然后我会重新开始。

I must have worked it.
我一定已经成功了。

I'm so sorry.
我很抱歉。

PF service, start.
PF 服务,启动。

Now I'm going to go back and I'm going to start my flask gap.
现在我要回去,我要开始我的烧瓶间隙。

Basically, this is a flask application running on the back end.
基本上,这是一个在后端运行的烧瓶应用程序。

With a Vet front end.
带有 Vet 前端。

Because I wanted to do a UI.
因为我想做一个UI。

So here we go.
所以,我们开始吧。

This is starting, very nice.
这是开始,非常好。

Everything's going.
一切都在进行中。

Let me go to my node application, and my vet application, and there you go.
让我去我的节点应用程序和我的兽医应用程序,然后你就可以了。

You're like, "Oh, no, Seth, it's broken." No, I am all about the minimalness here.
你会说,“哦,不,赛斯,它坏了。不,我在这里只关注极简。

So you can see, right here, this is my entire app.
所以你可以看到,就在这里,这是我的整个应用程序。

Yeah, isn't it great?
是的,不是很好吗?

Can we get a hand for just getting out of the way?
我们能得到帮助,让开吗?

Yes.
是的。

That's the beauty of Prompty.
这就是 Prompty 的美妙之处。

What I'm going to do is I'm going to say, "Hey, can you find the latest camping trends and what folks are doing in the winter?" That's the research agent.
我要做的是,我要说,“嘿,你能找到最新的露营趋势以及人们在冬天做什么吗?那是研究代理人。

Then we're going to say, "Hey, marketing person.
然后我们会说,“嘿,营销人员。

Can you find a selection of tents and sleeping bags." Imagine someone going, "Hey, I want you to write an article on latest camping trends and how they use our tents." This is basically an instruction a human would give you.
你能找到各种帐篷和睡袋。想象一下,有人说:“嘿,我想让你写一篇关于最新露营趋势以及他们如何使用我们的帐篷的文章。这基本上是人类给你的指令。

I'm going to go ahead and I'm going to run this, and let's cross our fingers here that everything's working.
我要继续,我要运行这个,让我们在这里交叉手指,一切正常。

You're going to see each agent start to do some work.
你会看到每个代理开始做一些工作。

So here's the research agent.
所以这是研究代理。

It went out on Bing and I was like, Oh, let's look up some camping activities.
它在 Bing 上消失了,我想,哦,让我们查一些露营活动。

The second agent is going to go and look for some tents.
第二个特工要去寻找一些帐篷。

Then the last agent is going to write the post.
然后最后一个代理将写帖子。

You're looking at this, and you're like, "Wow, this feels like the future." It is, but it's three prompty files and code with each one.
你看着这个,你会想,“哇,这感觉就像未来。是的,但它是三个提示文件和每个文件的代码。

This agent takes a little bit longer because it has more tokens.
此代理需要更长的时间,因为它具有更多令牌。

But I think it's done.
但我认为它已经完成了。

Shall we take a look at the work that I did and what was that, like, 60 seconds?
让我们看看我所做的工作,那 60 秒是什么样的?

Winter is coming.
冬天来了。

I wish we had music bringing with it a unique opportunity to experience the great outdoors in a whole new.
我希望我们的音乐能带来一个独特的机会,以全新的方式体验户外活动。

Doesn't that feel like, wow.
是不是感觉像,哇。

Notice that read more about Quincy Building here.
请注意,在此处阅读有关昆西大厦的更多信息。

It has links.
它有链接。

Then it starts to say, you should gear up.
然后它开始说,你应该做好准备。

Here's some of our stuff.
这是我们的一些东西。

That's impressive.
这令人印象深刻。

That's something that you can use right now.
这是您现在可以使用的东西。

But generally, this feels like it's something that's out of reach for developers because you got to write some complicated thing.
但总的来说,这感觉像是开发人员无法企及的东西,因为你必须编写一些复杂的东西。

Let me show you that it isn't with Prompty.
让我告诉你,它不是 Prompty。

When I go to Prompty, notice that this is how I like to here, let me get this out of the way, so you don't see that.
当我去 Prompty 时,请注意这是我喜欢在这里的方式,让我把它弄出来,这样你就不会看到它。

This is how I like to formulate my code with Prompty.
这就是我喜欢用 Prompty 编写代码的方式。

There is an agent for product.
有产品代理。

There is an agent for research, and there's an agent for writing.
有一个研究代理,也有一个写作代理。

You're seeing some JSON files there.
你在那里看到一些JSON文件。

Let me explain what that means.
让我解释一下这意味着什么。

Because what's happening is one of the agents gets a job and get some output.
因为正在发生的事情是其中一个代理得到了一份工作并得到了一些输出。

Another agent gets a job and gets some output, and then the third agent needs both outputs.
另一个代理获得作业并获得一些输出,然后第三个代理需要两个输出。

How do you model that when you're doing prompting?
当你做提示时,你如何建模?

I'll show you.
我给你看。

The first one is a pretty easy one.
第一个很简单。

Let me minimize this so you can see it a little bit better.
让我最小化这一点,这样你就可以更好地看到它。

You're an A assistant that helps people find information in the search index.
您是帮助用户在搜索索引中查找信息的 A 助理。

If you get a query, come up with a list of things to search for.
如果您收到查询,请列出要搜索的内容。

It's like the marketing person that asked that.
这就像营销人员问这个问题一样。

In the code behind, you're going to look at this.
在后面的代码中,您将看到这个。

We basically do rag with vector indexes, but it's just code.
我们基本上对向量索引做 rag,但这只是代码。

Here's generate embeddings.
这里是生成嵌入。

Here's me retrieving products.
这是我检索产品。

If you're looking at it like, well, that's a lot of code, it's not.
如果你看它,嗯,这是很多代码,它不是。

It's just the code you would use to query Cosmos DB or SQL Server.
它只是用于查询 Cosmos DB 或 SQL Server 的代码。

It's your code.
这是你的代码。

Just because this is an index doesn't make it any more special than your 30 year old Oracle database, which is still useful and still used and still needed to ground your models.
仅仅因为这是一个索引,并不能使它比你有 30 年历史的 Oracle 数据库更特别,它仍然有用,仍在使用,仍然需要为模型奠定基础。

As I scroll down, you'll see the part where we actually do the prompting.
当我向下滚动时,你会看到我们实际进行提示的部分。

I wish it was more exciting than that.
我希望它比这更令人兴奋。

The fact that it isn't should be super happy news for everybody.
事实上,这对每个人来说都应该是一个超级好消息。

Remember, this other prompt requires the inputs of the other prompts from before.
请记住,这个其他提示需要前面其他提示的输入。

We have a facility here where you can actually do stuff like this, where you can pass input from a previous prompt.
我们这里有一个工具,你可以在那里做这样的事情,你可以从前面的提示中传递输入。

Literally what I'm doing is I'm iterating on a prompt, looking at the answer, getting the response right.
从字面上看,我正在做的是迭代提示,查看答案,获得正确的响应。

Once I get a response I like, and I need to start working on another prompt, what I do is I take the output of the previous prompt and I put it into a JSON file.
一旦我得到我喜欢的响应,并且我需要开始处理另一个提示,我所做的就是获取上一个提示的输出并将其放入 JSON 文件中。

To test the next prompt to quick iterate.
测试下一个快速迭代提示。

Then I put some code under it.
然后我在它下面放了一些代码。

Then once we get the whole thing working, we can start building evaluation prompts with prompts and using our evaluator SDK to load evaluations directly from Prompty.
然后,一旦我们让整个事情正常工作,我们就可以开始使用提示构建评估提示,并使用我们的评估器 SDK 直接从 Prompty 加载评估。

Do you see this?
你看到了吗?

Effectively, this multi agent app that does something that, it's quite surprising, was done with three Prompty files, each one representing an agent that has not only the prompt, has the way to run it, but also has the code behind it to support that prompt.
实际上,这个多代理应用程序做了一些令人惊讶的事情,它是用三个提示文件完成的,每个文件都代表一个代理,该代理不仅具有提示,具有运行它的方式,而且还具有支持该提示的代码。

The reason why the orchestration is going to look a little more is because I wanted to yield so you could see those things happening.
编排之所以看起来更多一点,是因为我想让步,这样你就可以看到这些事情的发生。

But this is the entire thing.
但这就是全部。

You get the research context, product context, and assignment, and we just research, we find products, and we write.
你得到研究背景、产品背景和任务,我们只是研究,我们找到产品,然后我们写作。

That's it.
就是这样。

It's cool.
这很酷。

That's the beautiful thing about using this approach is that now we can be coders again, but with a special superpower of using LLMs as a function.
使用这种方法的美妙之处在于,现在我们可以再次成为编码员,但具有作为函数使用LLMs的特殊超能力。

You can look at up there.
你可以看看上面。

What did I just see multi agent writing system?
我刚刚看到了什么多智能体书写系统?

Refine prompt, use the output.
优化提示符,使用输出。

Just treat the Prompty as a different function.
只需将 Prompty 视为不同的功能即可。

As you do, you can do that.
当你这样做时,你可以做到这一点。

There's other sessions where you can see how this thing traces out.
在其他会话中,您可以看到这个东西是如何追踪的。

I started the trace server and you can totally trace all of these things, how they're running.
我启动了跟踪服务器,你可以完全跟踪所有这些东西,它们是如何运行的。

Everything else is basically whatever else you do as a dev, which I think is the best part.
其他一切基本上都是你作为开发人员所做的任何其他事情,我认为这是最好的部分。

Let's just summarize here in the last minute.
让我们在最后一分钟总结一下。

We showed you how to get started with LMS.
我们向您展示了如何开始使用 LMS。

We talked about what Prompty is, the three things.
我们讨论了什么是提示,这三件事。

We talked about how to get started with Prompty.
我们讨论了如何开始使用 Prompty。

Leah masterfully showed us every single thing in there.
莉亚巧妙地向我们展示了那里的每一样东西。

Hopefully, you saw, I can do this.
希望你看到了,我能做到。

The last thing is I showed you a multi agent app with three prompt files and some code.
最后一件事是我向你展示了一个包含三个提示文件和一些代码的多代理应用程序。

There's a lot of other information.
还有很多其他信息。

Like, if you want to start some of the other Prompty samples that we've seen throughout the conference, you can go to aka.ms/azd-ai-templates.
比如,如果你想开始我们在整个会议中看到的其他一些 Prompty 示例,你可以去 aka.ms/azd-ai-templates。

You can also see prompt based evaluators that we have in our evaluation, SDK.
您还可以在评估 SDK 中看到基于提示的评估器。

If you want to send us feedback about Prompty, because again, it's still early.
如果您想向我们发送有关 Prompty 的反馈,因为现在还为时过早。

We're trying to make this work.
我们正在努力实现这一目标。

Let us know.
请告诉我们。

Give us feedback, Microsoft.github.io/prompty.
Microsoft.github.io/prompty 给我们反馈。

Just start putting stuff into the issues, and we are excited to make this work for you.
只要开始把东西放到问题中,我们很高兴能为你工作。

Then there's a bunch of other sessions that you can go to or you can find online to learn more about how this integrates.
然后,您可以参加许多其他会议,或者您可以在线查找以了解有关如何集成的更多信息。

But the most important thing is, tell us what you want to do here.
但最重要的是,告诉我们你想在这里做什么。

Because we want to empower developers to use this wonderful new technology in the least disruptive way possible in a way that helps you stay in your flow and yet deliver magical experiences.
因为我们希望让开发人员能够以尽可能少的破坏性方式使用这项出色的新技术,从而帮助您保持流畅,同时提供神奇的体验。

This is the most important question that I was going to leave, everybody.
这是我要离开的最重要的问题,各位。

If there's a plural of this, should it be Prompties or Promptys?
如果有复数形式,应该是 Prompties 还是 Promptys?

We don't know.
不知道。

Speaker 4: The second one SETH JUAREZ: The second one.
演讲者4:第二个 塞思·华雷斯:第二个。

Thank you.
谢谢。

Yes.
是的。

Second one?
第二个?

Okay.
好。

That's what I thought.
我就是这么想的。

I told everyone, but people argued with me.
我告诉了所有人,但人们与我争论。

Also, if you want to access Azure ML Insiders, you can go here.
此外,如果要访问 Azure ML 预览体验成员,可以转到此处。

Azure ML is where we do all of this stuff at the base layer.
Azure ML 是我们在基础层执行所有这些操作的地方。

Hopefully, this is helpful.
希望这对您有所帮助。

Thank you so much for your time.
非常感谢您抽出时间接受采访。

END