成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

新一代的交互形式LUI(language user interface)到來,微軟為它架了一座橋

發布于 2024-7-9 08:17
瀏覽
0收藏

新一代的交互形式LUI(language user interface)到來,微軟為它架了一座橋-AI.x社區

ChatGPT為代表的LLM以其驚艷的自然語言理解能力得到大眾認可之后,一大批基于自然語言的應用被紛紛提上日程,以對話的方式進行人機交互的模式再一次被業內所關注。

大約五六年前,智能音箱因為其自然語言對話的交互形式,掀起了一場智能音箱熱潮,各大公司對其產品給予了厚望,但由于技術不夠成熟,理解和對話能力不夠強,導致了智能音箱始終難以作為大眾消費品獲得成功,而當下基于大模型的語義理解和對話能力有了質的提高,大家對于LUI(language user interface)又有了新的期待,都在等待新的時代到來,類似蘋果通過革命性的電容屏和IOS替代nokia時代的電阻屏和塞班系統帶來的手機體驗變革開啟移動互聯網時代。因此,行業內興起了LUI作為下一代交互體驗變革的研究和應用。

新一代的交互形式LUI(language user interface)到來,微軟為它架了一座橋-AI.x社區

LUI介紹,PPT:https://drive.google.com/file/d/1A6ZkodDUuyQzVE3HCrI8iHs3y-9wDI1t/view

然而,在開發以ChatGPT為代表的大模型作為大腦,對接下游服務的LUI應用時,遇到了一個新矛盾(以前交互方式恰好相反),那就是對用戶友好,但對服務間集成不友好。人和系統的溝通和下達指令的語言是多變的,靈活的,然而系統與系統之間的調用卻希望是格式化的,穩定的。而大模型做到了理解用戶多變的指令的同時,帶來一個問題,就是它自身的輸出同樣會變得多變和不穩定,這就對于系統集成帶來了很大的挑戰。為了解決這一矛盾,langchain這類框架,通過精心構造prompt以及專門設計“Output parsers”來處理各種各樣的輸出,當然也包含之前提到了幾個庫,如guidance,Guardrails,但基于prompt engineering的解決路徑,有一定的缺陷,首先,對于傳統開發者來講,它是一個新物種,比較陌生,有一定的學習門檻,其次,模型輸出具有一定不確定性,隨著類型復雜度越來越高,鏈路也越來越脆弱,經常會因為邊角問題導致系統崩潰。為此,OpenAI自己也開發了function calls功能來提升大模型與系統的對接能力。

新一代的交互形式LUI(language user interface)到來,微軟為它架了一座橋-AI.x社區

近日(7.20),微軟在這一領域又發布了一款新的開源前端庫TypeChat(https://github.com/microsoft/TypeChat),給后續開發者解決這類問題的一個新思路,它的一個創新點是通過schema engineering替代了 prompt engineering,巧妙的借助了typescript的能力,開發者只需定義代表LUI應用所支持的意圖的類型即可。這可以是簡單的情感分類的接口類型,也可以是更復雜的數據類型,如購物車或音樂應用程序的類型。例如,要在schema中添加額外的意圖(intents),開發人員可以在可辨識聯合(Discriminated Unions)添加額外的類型。為使schema具有層次性,開發人員可以使用 "meta-schema",根據用戶輸入選擇一個或多個子schema。定義完類型后,TypeChat 搞定后續工作:

  • 使用類型構建對 LLM 的提示。
  • 驗證 LLM 響應是否符合模式。如果驗證失敗,則通過進一步的語言模型交互來修復不符合要求的輸出。
  • 簡明扼要地總結實例(無需使用 LLM),并確認其符合用戶意圖。

模式對比:

  • prompt 方式

開發者構造prompt,給出示例,要求LLM以JSON格式輸出,然后基于輸出進行后續處理。

User: Provide 3 suggestions for specific places to go to in Seattle on a rainy day. Respond in the form of JSON. The JSON should have the following forma

[
    { "venue": "...", "description": "..." },
    { "venue": "...", "description": "..." }
]

ChatGPT:

{
        "venue": "Seattle Art Museum",
        "description": "The Seattle Art Museum (SAM) is a world-class museum with a diverse collection of art from around the globe. It offers a great indoor activity for a rainy day, allowing you to explore various art exhibitions and displays, including contemporary art, African and Oceanic art, and European painting and sculpture."
    },
    {
        "venue": "Chihuly Garden and Glass",
        "description": "Chihuly Garden and Glass is an extraordinary exhibition showcasing the breathtaking glass artwork of Dale Chihuly. Located at the Seattle Center, this indoor attraction offers a mesmerizing experience as you wander through vibrant glass sculptures and installations. The beautiful interplay of light and color will captivate your senses, making it a perfect rainy day destination."
    },
    {
        "venue": "Museum of Pop Culture",
        "description": "The Museum of Pop Culture (MoPOP) is a vibrant museum dedicated to contemporary pop culture, music, science fiction, and more. It features engaging exhibits that celebrate music icons, explore science fiction themes, and delve into the world of video games. Whether you're a fan of music, movies, or pop culture in general, MoPOP offers an immersive and entertaining experience, making it an ideal choice on a rainy day."
    }
]
  • schema方式

開發者使用熟悉的方式開發,定義類型,TypeChat幫你搞定內部細節。事實上,typechat利用了typescript本身能力,借助TypeScript編譯器來處理covercase,能夠很好消除語言模型響應的一些尖銳邊緣,提高魯棒性。對于開發者本身來講,也可以基于原有開發模式編程,可進一步地進行數據加工和處理,達到1+1>2的效果。

User: Provide 3 suggestions for specific places to go to in Seattle on a rainy day. Respond strictly with JSON. The JSON should be compatible with the TypeScript type Response from the following:?

interface Response {
data: Array<{ venue: string, description: string }>;
}

ChatGPT:

{
"data": [
    {
"venue": "Museum of Pop Culture",
"description": "Explore the fascinating world of popular culture through interactive exhibits, music memorabilia, and multimedia displays at the Museum of Pop Culture."
    },
    {
"venue": "Seattle Art Museum",
"description": "Indulge in the diverse collection of artworks from around the world at the Seattle Art Museum, featuring both contemporary and classical pieces."
    },
    {
"venue": "Pike Place Market",
"description": "Enjoy the vibrant atmosphere of Pike Place Market, where you can wander through covered stalls offering fresh produce, crafts, and delicious food from local vendors."
    }
  ]
}

利用TypeChat做情感分析的例子:

// ./src/sentimentSchema.ts


// The following is a schema definition for determining the sentiment of a some user input.


export interface SentimentResponse {
    /** The sentiment of the text. */
    sentiment: "negative" | "neutral" | "positive";
}




// ./src/main.ts


import * as fs from "fs";
import * as path from "path";
import dotenv from "dotenv";
import * as typechat from "typechat";
import { SentimentResponse } from "./sentimentSchema";


// Load environment variables.
dotenv.config({ path: path.join(__dirname, "../.env") });


// Create a language model based on the environment variables.
const model = typechat.createLanguageModel(process.env);


// Load up the contents of our "Response" schema.
const schema = fs.readFileSync(path.join(__dirname, "sentimentSchema.ts"), "utf8");
const translator = typechat.createJsonTranslator<SentimentResponse>(model, schema, "SentimentResponse");


// Process requests interactively.
typechat.processRequests("??> ", /*inputFile*/ undefined, async (request) => {
    const response = await translator.translate(request);
    if (!response.success) {
        console.log(response.message);
        return;
    }
    console.log(`The sentiment is ${response.data.sentiment}`);
});

結語:

TypeChat是微軟在LUI的一個新的嘗試,通過typeChat可以很好的連接語言和服務,前端開發者可以通過TypeChat將自己過去的軟件改造為新的LUI的交互形式,并且也能夠在此基礎上開發更多功能,而這個開發經驗本身是傳承的,模式是漸進的。目前,該庫支持OPEN API和Azure OpenAI service ,對于其它模型來講,還不支持,期待能夠支持自定義的模型服務能力,當然這也對大模型本身能力有一定的要求。

總之:Types are all you need!

本文轉載自 ??AI工程化??,作者: ully


收藏
回復
舉報
回復
相關推薦
主站蜘蛛池模板: 日韩欧美三级电影 | 欧美男人天堂 | 性色网站 | 中文字幕第十一页 | av片毛片| 色网站在线免费观看 | 日韩另类 | 黄色毛片在线看 | 黄色欧美 | 成人av观看 | 91精品一区二区三区久久久久久 | 国产午夜精品一区二区三区 | 91视视频在线观看入口直接观看 | 99精品亚洲国产精品久久不卡 | 日韩1区| 狠狠做六月爱婷婷综合aⅴ 国产精品视频网 | 福利精品| 日本xx视频免费观看 | 亚洲国产精品suv | 日韩久久久久久久久久久 | www国产亚洲精品久久网站 | 美国av毛片 | 在线观看亚洲精品视频 | 亚洲精品日韩欧美 | 99精品久久久久久中文字幕 | 色爱区综合 | 亚洲 欧美 激情 另类 校园 | 精品一区二区久久久久久久网站 | 男女免费在线观看视频 | 成人在线免费 | 99精品欧美一区二区三区综合在线 | 91精品国产欧美一区二区成人 | 亚州av| 日韩三片| 国产精品一区二区久久精品爱微奶 | 亚洲不卡在线观看 | 黄a网 | 欧美黄在线观看 | 日韩一二区 | 国产一区二区视频在线观看 | 一级免费毛片 |