ChatGPT Plugin发布,这东西到底是干嘛的?里面的逻辑是什么?

前言
目前的明显问题是不能够获取新知识,也没有办法和外界交互,而就是来解决这个问题的 。
-- 插件的基本信息
这是最新开源的一个,里面有几个核心点
第一个是插件的定义
我不逐句翻译了,大概意思就是可以扩展,这样就可以试用外部的资料和调用外部的服务了 。
然后又说明了一个插件需要的三个部分
需要一个API需要一个API的定义需要一个描述这个插件的json文件 插件和之间的核心逻辑
这个图其实就是插件与的一个核心交互模式 。
解释下里面的的核心点:是如何和工具进行交互的 。
这里就涉及到刚才插件要求的三个要素,Api、Api文档、插件描述 。
我们核心看插件描述和API文档
api-.json
{"schema_version": "v1","name_for_model": "retrieval","name_for_human": "Retrieval Plugin","description_for_model": "Plugin for searching through the user's documents (such as files, emails, and more) to find answers to questions and retrieve relevant information. Use it whenever a user asks something that might be found in their personal information.","description_for_human": "Search through your documents.","auth": {"type": "user_http","authorization_type": "bearer"},"api": {"type": "openapi","url": "https://your-app-url.com/.well-known/openapi.yaml","has_user_authentication": false},"logo_url": "https://your-app-url.com/.well-known/logo.png","contact_email": "hello@contact.com", "legal_info_url": "hello@legal.com"}
.yaml
openapi: 3.0.2info:title: Retrieval Plugin APIdescription: A retrieval API for querying and filtering documents based on natural language queries and metadataversion: 1.0.0servers:- url: https://your-app-url.compaths:/query:post:summary: Querydescription: Accepts search query objects array each with query and optional filter. Break down complex questions into sub-questions. Refine results by criteria, e.g. time / source, don't do this often. Split queries if ResponseTooLargeError occurs.operationId: query_query_postrequestBody:content:application/json:schema:$ref: "#/components/schemas/QueryRequest"required: trueresponses:"200":description: Successful Responsecontent:application/json:schema:$ref: "#/components/schemas/QueryResponse""422":description: Validation Errorcontent:application/json:schema:$ref: "#/components/schemas/HTTPValidationError"security:- HTTPBearer: []components:schemas:DocumentChunkMetadata:title: DocumentChunkMetadatatype: objectproperties:source:$ref: "#/components/schemas/Source"source_id:title: Source Idtype: stringurl:title: Urltype: stringcreated_at:title: Created Attype: stringauthor:title: Authortype: stringdocument_id:title: Document Idtype: stringDocumentChunkWithScore:title: DocumentChunkWithScorerequired:- text- metadata- scoretype: objectproperties:id:title: Idtype: stringtext:title: Texttype: stringmetadata:$ref: "#/components/schemas/DocumentChunkMetadata"embedding:title: Embeddingtype: arrayitems:type: numberscore:title: Scoretype: numberDocumentMetadataFilter:title: DocumentMetadataFiltertype: objectproperties:document_id:title: Document Idtype: stringsource:$ref: "#/components/schemas/Source"source_id:title: Source Idtype: stringauthor:title: Authortype: stringstart_date:title: Start Datetype: stringend_date:title: End Datetype: stringHTTPValidationError:title: HTTPValidationErrortype: objectproperties:detail:title: Detailtype: arrayitems:$ref: "#/components/schemas/ValidationError"Query:title: Queryrequired:- querytype: objectproperties:query:title: Querytype: stringfilter:$ref: "#/components/schemas/DocumentMetadataFilter"top_k:title: Top Ktype: integerdefault: 3QueryRequest:title: QueryRequestrequired:- queriestype: objectproperties:queries:title: Queriestype: arrayitems:$ref: "#/components/schemas/Query"QueryResponse:title: QueryResponserequired:- resultstype: objectproperties:results:title: Resultstype: arrayitems:$ref: "#/components/schemas/QueryResult"QueryResult:title: QueryResultrequired:- query- resultstype: objectproperties:query:title: Querytype: stringresults:title: Resultstype: arrayitems:$ref: "#/components/schemas/DocumentChunkWithScore"Source:title: Sourceenum:- email- file- chattype: stringdescription: An enumeration.ValidationError:title: ValidationErrorrequired:- loc- msg- typetype: objectproperties:loc:title: Locationtype: arrayitems:anyOf:- type: string- type: integermsg:title: Messagetype: stringtype:title: Error Typetype: stringsecuritySchemes:HTTPBearer:type: httpscheme: bearer