API
How to guides
Create a doc_qa Digital Human
7min
this section is meant to help you create a new digital human leveraging the doc qa operationmode 1\ create head the complete process is done using the post /head/create endpoint the following code snipped shows you how to create a very simple digital human operating in document based q\&a mode please refer to the for more details and create a digital human docid\ hoboropyem9tuenmqcf s for more infomation of the post endpoint curl x 'post' \\ 'https //platform api unith ai/head/create' \\ h 'accept application/json' \\ h 'authorization bearer exampletoken' \\ h 'content type application/json' \\ d '{ "headvisualid" "examplevisualid", "name" "lev", "alias" "lev", "languagespeechrecognition" "en us", "langcode" "en us", "ttsprovider" "audiostack", "operationmode" "doc qa", "ocprovider" "playground", "ttsvoice" "kelso", "greetings" "hi there" }'{ "id" "generatedid", "createdat" "2024 04 05t08 26 22 616z", "updatedat" "2024 04 05t08 26 22 616z", "name" "lev", "publicid" "lev 123", "publicurl" "https //chat unith ai/\[org] \[num]/lev 123?api key=orgapikey", "fileurl" null, "alias" "lev", "documentjsondto" null, "documenturl" null, "promptconfig" { "system prompt" \[ "" ], "qa prompt" { "introduction" "", "personality" "act as a brand ambassador your objective is to provide concise responses maintain an enthusiastic, polite and helpful tone in your responses ", "qa instructions" "use context search tool to retrieve the response do not retry the search if the information is not contained in the context respond with respond with i'm sorry, but it seems like i couldn't find a match for your query if you have any other questions or need assistance with a different topic, feel free to ask! all responses should not exceed 30 words in length and keep the answer as concise as possible if asked about any specific people (by name), places or telephone numbers not mentioned in the document, state that you are not allowed to speak about people due to privacy in case a user poses a question not related to the document address the query accurately, then smoothly redirect the conversation back to context " }, "intentions" \[] }, "greetings" "hi there", "language" "en gb", "languagespeechrecognition" "en gb", "phrases" \[], "encodedpath" "asdfasgsfsdfgdsgfdfg", "ttsprovider" "audiostack", "operationmode" "doc qa", "ocprovider" "playground", "ttsvoice" "kelso", "iconconfig" null, "customwords" {}, "headvisualid" "65bfab67 6e3e 4408 b994 05b06e565ace", "isactive" true, "voiceflowapikey" null, "avatar" null, "pluginoperationalmodeconfig" null, "israndomsuggestions" true } result at this point, your digital human is now live and can be accessed via the url found in the publicurl property of the response { "publicid" "headid", "publicurl" "https //chat unith ai/\[org id]/\[head id]?api key=\[org api key]", } take note of th generated headid which you will use for the following steps, and any time you need to update a digital human docid\ gjy qc6alw5tk6sscxrpp while you can access your digital human, it is still not functional at this stage , since it does not have a knowledge base document provided 2\ upload document all doc qa digital humans require a knowledge document to be uploade to do so, you then need to use the document upload endpoint curl x 'post' \\ 'https //platform api unith ai/document/file' \\ h 'accept / ' \\ h 'x head talking head id headidfromaboveheadcreate' \\ h 'authorization bearer hiamastring' \\ h 'content type multipart/form data' \\ f 'document=@unith product highlights pdf;type=application/pdf'201 at this point, your digital human is now live and can be accessed via the url found in the publicurl property of the create head response { "publicid" "generatedpublicid", "publicurl" "https //chat unith ai/\[org id]/\[head id]?api key=\[org api key]", } 2 1 refine generated suggestions retrieve head information using get head/{id} curl x 'get' \\ 'https //platform api unith ai/head/\<headid>' \\ h 'accept application/json' \\ h 'authorization bearer \<uniquetoken>' in the response, review the dynamically generated suggestions and update a digital human docid\ gjy qc6alw5tk6sscxrpp them as required { "id" "\<headid>", "documentjsondto" { "summary" "the relationship between human rights, democracy, and climate change is complex the effects of climate change can lead to a \\"climate apartheid\\" where the wealthy can escape its impacts while the rest of the world suffers poorer countries, who contribute less to climate change, are often the most affected and have limited resources to mitigate its effects climate change can also exacerbate poverty, trapping families in a cycle of disadvantage for generations however, current tools for addressing climate change often do not consider issues of just distribution and the impact on human rights ", "suggestions" \[ "what is the potential impact of climate change on human rights and democracy, according to united nations special rapporteur philip alston?", "how did the effects of superstorm sandy in 2012 highlight the unequal distribution of resources during natural disasters?", "how can controlling the price of carbon potentially lead to a \\"climate apartheid\\" between richer and poorer countries?", "in what ways do countries in the global south bear the burden of natural disasters and weather extremes, despite contributing less to the global carbon footprint?", "how do poverty and climate change exacerbate each other, according to a 2020 world bank paper?", "what is the definition of the \\"cycle of poverty\\" and how does it relate to the potential negative impacts of climate change?", "how do tools for addressing climate change often overlook questions of just distribution and the environmental effects on human rights?", "how many additional people are estimated to be pushed into extreme poverty by 2030 due to climate change, according to the world bank?" ] }, } 2 2 refine prompt converse with your digital human at this point, your digital human is fully converational live and can be accessed via the url found in the publicurl property of the response