openapi:3.0.3info:title:Q&AAssistant-Servicedescription:>- This API provides service interfaces for the Question and Answer (Q&A) Assistant, enabling users to submit query requests to a configured Q&A assistant and obtain answers generated based on the knowledge base and Large Language Model (LLM). It is suitable for scenarios such as building intelligent question-answering systems and customer service bots that require real-time responses to user inquiries. It must follow RFC 3339 and must have time zone. Recommended format is yyyy-MM-dd'T'HH:mm:ss.SSSZ.## Security and AuthenticationThis API uses OAuth 2.0 with OpenID Connect for authentication. The following scope is required:-qa-assistant-service:answer:read-Permissiontoqueryassistants# Authorization and authenticationThe"Camara Security and Interoperability Profile"providesdetailsofhowanAPIconsumerrequestsanaccesstoken.PleaserefertoIdentityandConsentManagement(https://github.com/camaraproject/IdentityAndConsentManagement/)forthereleasedversionoftheprofile.Thespecificauthorizationflowstobeusedwillbeagreeduponduringtheonboardingprocess,happeningbetweentheAPIconsumerandtheAPIprovider,takingintoaccountthedeclaredpurposeforaccessingtheAPI,whilstalsobeingsubjecttotheprevailinglegalframeworkdictatedbylocallegislation.IncaseswherepersonaldataisprocessedbytheAPIanduserscanexercisetheirrightsthroughmechanismssuchasopt-inand/oropt-out,theuseofthree-leggedaccesstokensismandatory.ThisensuresthattheAPIremainsincompliancewithprivacyregulations,upholdingtheprinciplesoftransparencyanduser-centricprivacy-by-design.# Additional CAMARA error responsesThelistoferrorcodesinthisAPIspecificationisnotexhaustive.ThereforetheAPIspecificationmaynotdocumentsomenon-mandatoryerrorstatusesasindicatedin`CAMARAAPIDesignGuide`.Pleaserefertothe`CAMARA_common.yaml`oftheCommonalitiesReleaseassociatedtothisAPIversionforacompletelistoferrorresponses.TheapplicableCommonalitiesReleasecanbeidentifiedinthe`APIReadinessChecklist`documentassociatedtothisAPIversion.Asaspecificrule,error`501-NOT_IMPLEMENTED`canbeonlyapossibleerrorresponseifitisexplicitlydocumentedintheAPI.# Further info and support(FAQswillbeaddedinalaterversionofthedocumentation)license:name:Apache2.0url:https://www.apache.org/licenses/LICENSE-2.0.htmlversion:0.1.0x-camara-commonalities:0.6externalDocs:description:ProductdocumentationatCAMARAurl:https://github.com/camaraproject/ModelAsAServiceservers:-url:'{apiRoot}/qa-assistant-service/v0.1'variables:apiRoot:default:http://localhost:9091description:APIroot,definedbytheserviceprovider,e.g.`api.example.com`or`api.example.com/somepath`paths:/answer:post:operationId:queryAssistantsummary:GetananswerfromaQAassistantdescription:| Queries a configured QA assistant to generate answers using knowledge bases and LLMs.**KeyFeatures:**-Utilizespre-configuredassistantsettings(prompts,modelparameters)-Leveragesassociatedknowledgebasesforcontextualresponses-Providesterminationstatusforanswergeneration**KeyRules:**-RequiresvalidUUID`assistantId`-`prompt`mustbe1-1000characters-Needs`qa-assistant-service:answer:read`scope-Assistantmustbeproperlyconfiguredandaccessible**ResponseCharacteristics:**-**200OK**:Returns`QueryResponse`withanswertextandterminationstatus-`finished`indicatesgenerationcompletionreason(Stop/Length/Error/Filter)-`reference`showsknowledgebasesourcewhenavailable-**400BadRequest**:-Missing/invalidprompt-InvalidassistantIdformat-Promptlengthexceedslimits-**401Unauthenticated**:Missing/invalidcredentials-**403Forbidden**:-Missingrequiredscope-Token/assistantIdmismatch-**404NotFound**:-Assistantdoesn'texist-Identifiernotfound-**500InternalServerError**:-LLMprocessingfailure-Knowledgebaseaccesserrortags:-Queryparameters:-$ref:'#/components/parameters/x-correlator'# Added correlatorsecurity:-openId:-qa-assistant-service:answer:readrequestBody:required:truecontent:application/json:schema:$ref:'#/components/schemas/QueryRequest'responses:'200':description:Successfulanswerretrievalheaders:x-correlator:$ref:'#/components/parameters/x-correlator'content:application/json:schema:$ref:'#/components/schemas/QueryResponse''400':$ref:'#/components/responses/Generic400''403':$ref:'#/components/responses/Generic403''404':$ref:'#/components/responses/Generic404''500':$ref:'#/components/responses/Generic500'components:securitySchemes:openId:type:openIdConnectopenIdConnectUrl:https://example.com/.well-known/openid-configurationdescription:OpenIDConnectauthenticationparameters:x-correlator:name:x-correlatorin:headerdescription:CorrelationIDforrequesttracingschema:$ref:"#/components/schemas/XCorrelator"headers:x-correlator:description:Correlationidforthedifferentservicesschema:$ref:"#/components/schemas/XCorrelator"schemas:XCorrelator:type:stringpattern:^[a-zA-Z0-9-_:;.\/<>{}]{0,256}$example:"b4333c46-49c0-4f62-80d7-f0ef930f1c46"QueryRequest:type:objectrequired:-assistantId-promptproperties:assistantId:type:stringformat:uuiddescription:UniqueidentifieroftheQAassistantexample:"a1b2c3d4-5678-90ab-cdef-1234567890ab"prompt:type:stringminLength:1maxLength:1000description:Theuser'squestionorqueryexample:"How do I reset my password?"QueryResponse:type:objectrequired:-success-finished-answerTextproperties:success:type:booleandescription:Indicateswhetherthequerywasprocessedsuccessfullyfinished:type:stringdescription:Terminationstatusoftheresponsegenerationenum:-Stop-Length-Error-Filterexample:"Stop"answerText:type:stringdescription:Theassistant'sgeneratedanswerexample:"To reset your password, go to settings > security..."reference:type:stringdescription:Optionalreferencetotheknowledgebasesourceexample:"kb123_section5"ErrorInfo:type:objectrequired:-status-code-messageproperties:status:type:integerdescription:HTTPstatuscodecode:type:stringdescription:Errorcodeidentifiermessage:type:stringdescription:Human-readableerrormessageresponses:Generic400:description:Badrequestduetoinvalidinputheaders:x-correlator:$ref:'#/components/parameters/x-correlator'content:application/json:schema:allOf:-$ref:'#/components/schemas/ErrorInfo'-type:objectproperties:status:enum:-400code:enum:-MISSING_PROMPT-INVALID_ASSISTANT_ID-INVALID_ARGUMENT-OUT_OF_RANGEexamples:GENERIC_400_MISSING_PROMPT:description:Missingrequiredpromptparametervalue:status:400code:MISSING_PROMPTmessage:"Required parameter 'prompt' is missing"GENERIC_400_INVALID_ASSISTANT_ID:description:InvalidassistantIDformatvalue:status:400code:INVALID_ASSISTANT_IDmessage:"Assistant ID must be a valid UUID"GENERIC_400_INVALID_ARGUMENT:description:Invalidargumentvalue:status:400code:INVALID_ARGUMENTmessage:"Client specified an invalid argument"GENERIC_400_OUT_OF_RANGE:description:Parametervalueoutofrangevalue:status:400code:OUT_OF_RANGEmessage:"Prompt length exceeds maximum allowed characters"Generic403:description:Forbiddenheaders:x-correlator:$ref:'#/components/parameters/x-correlator'content:application/json:schema:allOf:-$ref:'#/components/schemas/ErrorInfo'-type:objectproperties:status:enum:-403code:enum:-PERMISSION_DENIED-INVALID_TOKEN_CONTEXTexamples:GENERIC_403_PERMISSION_DENIED:description:Userlacksrequiredpermissionsvalue:status:403code:PERMISSION_DENIEDmessage:UserlacksrequiredpermissionstoquerythisassistantGENERIC_403_INVALID_TOKEN_CONTEXT:description:Tokencontextinconsistencyvalue:status:403code:INVALID_TOKEN_CONTEXTmessage:"Assistant ID is not consistent with access token"Generic404:description:Resourcenotfoundheaders:x-correlator:$ref:'#/components/parameters/x-correlator'content:application/json:schema:allOf:-$ref:'#/components/schemas/ErrorInfo'-type:objectproperties:status:enum:-404code:enum:-NOT_FOUND-ASSISTANT_NOT_FOUND-IDENTIFIER_NOT_FOUNDexamples:GENERIC_404_NOT_FOUND:description:Resourceisnotfoundvalue:status:404code:NOT_FOUNDmessage:Thespecifiedresourceisnotfound.GENERIC_404_ASSISTANT_NOT_FOUND:description:Assistantnotfoundvalue:status:404code:ASSISTANT_NOT_FOUNDmessage:"Specified assistant ID does not exist"GENERIC_404_IDENTIFIER_NOT_FOUND:description:Identifiernotfoundvalue:status:404code:IDENTIFIER_NOT_FOUNDmessage:Assistantidentifiernotfound.Generic500:description:Internalservererrorheaders:x-correlator:$ref:'#/components/parameters/x-correlator'content:application/json:schema:allOf:-$ref:'#/components/schemas/ErrorInfo'-type:objectproperties:status:enum:-500code:enum:-INTERNAL_SERVER_ERROR-INTERNALexamples:GENERIC_500_INTERNAL_SERVER_ERROR:description:Unexpectedservererrorvalue:status:500code:INTERNAL_SERVER_ERRORmessage:"Unexpected server error occurred while processing query"GENERIC_500_INTERNAL:description:Internalservererrorvalue:status:500code:INTERNALmessage:Unknownservererror