Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.61k stars 5.01k forks source link

Azure OpenAI REST API extensions completions returning 'NoneType' object has no attribute 'get' for multi-turn conversations #27368

Closed carolinedpena closed 8 months ago

carolinedpena commented 8 months ago

Using API version 2023-06-01-preview.

API call to POST {your-resource-name}/openai/deployments/{deployment-id}/extensions/chat/completions responds with: {"error": {"requestid": "2867bb5c-a1aa-471a-8af0-b6f80682c65a", "code": 500, "message": "'NoneType' object has no attribute 'get'"}} if messages array is contains more than one message.

Body that responds with 200: {'messages': [{'role': 'user', 'content': 'what is data governance'}], 'temperature': 0.0, 'max_tokens': 800, 'top_p': 1.0, 'stop': None, 'stream': False, 'dataSources': [{'type': 'AzureCognitiveSearch', 'parameters': {'endpoint': {AZURE_OPENAI_ENDPOINT}, 'key': {AZURE_SEARCH_KEY}, 'indexName': {AZURE_SEARCH_INDEX}, 'fieldsMapping': {FIELD_MAPPINGS}, 'inScope': True, 'topNDocuments': '5', 'queryType': 'semantic', 'semanticConfiguration': {AZURE_SEMANTIC_CONFIG}, 'roleInformation': '{AZURE_OPENAI_SYSTEM_MESSAGE', 'embeddingEndpoint': '{AZURE_OPENAI_EMBEDDING_ENDPOINT}, 'embeddingKey': {AZURE_OPENAI_EMBEDDING_KEY}}]}

Body that responds with 500 and message NoneType has no attribute 'get': {'messages': [{'role': 'user', 'content': 'what is data governance'}, {'role': 'assistant', 'content': "Data governance refers to the management of the availability, usability, integrity, and security of data in an organization. It involves a set of processes, roles, policies, standards, and metrics that ensure the effective and efficient use of information in enabling an organization to achieve its goals. It includes the use of technologies like Machine Learning and Artificial Intelligence to automatically classify, extract, and enrich physical and digital content and data. This means software can be trained to understand the meaning and context of information, classify it into categories, and automatically apply governance categories and retention schedules[doc5]. \n\nIn the context of AvePoint's Cloud Governance, data governance involves the lifecycle management of collaborative objects and spaces. It allows an organization to take a holistic approach to lifecycle management, including the creation of renewal processes, the configuration of renewal triggers based on inactivity, and the management of both active and inactive workspaces. It also includes the ability to configure outreach communications to users in multiple regions with language-specific renewal process direction and guidance[doc1]. \n\nMoreover, data governance also involves auditing the company's data before migration, which can save time, reduce the attack threat surface, and ensure the new system is secure, efficient, and in compliance. This process includes file analysis and tagging and classifying sensitive data[doc2]. \n\nIn summary, data governance is a comprehensive approach to managing, securing, and utilizing data effectively in an organization."}, {'role': 'user', 'content': 'summarize that into bullet points'}], 'temperature': 0.0, 'max_tokens': 800, 'top_p': 1.0, 'stop': None, 'stream': False, 'dataSources': [{'type': 'AzureCognitiveSearch', 'parameters': {'endpoint': {AZURE_OPENAI_ENDPOINT}, 'key': {AZURE_SEARCH_KEY}, 'indexName': {AZURE_SEARCH_INDEX}, 'fieldsMapping': {FIELD_MAPPINGS}, 'inScope': True, 'topNDocuments': '5', 'queryType': 'semantic', 'semanticConfiguration': {AZURE_SEMANTIC_CONFIG}, 'roleInformation': '{AZURE_OPENAI_SYSTEM_MESSAGE', 'embeddingEndpoint': '{AZURE_OPENAI_EMBEDDING_ENDPOINT}, 'embeddingKey': {AZURE_OPENAI_EMBEDDING_KEY}}]}

This error just appeared today

nipun-threestops commented 8 months ago

I got the same error 3 days back. Screenshot from 2024-01-15 10-55-12 When I send tools along with previous messages , got the desired response from azure openai. Previously I was sending messages array without these tools object(its heavier). I think now they made this tools object mandatory for request api , (without any information!!)

here is an example messgaes :

`"messages": [ { "role": "user", "content": "What is physical equilibrium" }, { "index": 0, "role": "tool", "content": "{\"citations\": [{\"content\": \",\nCO2 (gas) CO2 (in solution)\nThis equilibrium is governed by Henry’s \nlaw, which states that the mass of a gas \ndissolved in a given mass of a solvent at \nany temperature is proportional to the \npressure of the gas above the solvent. \nThis amount decreases with increase of \ntemperature. The soda water bottle is sealed \nunder pressure of gas when its solubility in \nwater is high. As soon as the bottle is opened, \nsome of the dissolved carbon \nSpecies Conjugate Conjugate \n acid base\nH2O H3O\n+ OH–\nHCO3\n– H2CO3 CO3\n2–\nHSO4\n– H2SO4 SO4\n2–\nNH3 NH4\n+ NH2\n–\nSvante Arrhenius\n(1859-1927)\nIt can be seen in the above equation, that \nwater acts as a base because it accepts the \nproton. The species H3O\n+ is produced when \nwater accepts a proton from HCl. Therefore, \nCl– is a conjugate base of HCl and HCl is the \nconjugate acid of base Cl–\", \"id\": null, \"title\": \"Unit 6\", \"filepath\": \"kech106 (1).pdf\", \"url\": \"https://buddiz.blob.core.windows.net/promoise-10-chemistry/kech106%20(1).pdf\", \"metadata\": {\"chunking\": \"orignal document size=1007. Scores=1.6036518Org Highlight count=12.\"}, \"chunk_id\": \"9\"}, {\"content\": \"Unit 6\nEqUilibriUm\nChemical equilibria are important in numerous biological \nand environmental processes. For example, equilibria \ninvolving O2 molecules and the protein hemoglobin play \na crucial role in the transport and delivery of O2 from \nour lungs to our muscles. Similar equilibria involving CO \nmolecules and hemoglobin account for the toxicity of CO.\nWhen a liquid evaporates in a closed container, \nmolecules with relatively higher kinetic energy escape \nthe liquid surface into the vapour phase and number of \nliquid molecules from the vapour phase strike the liquid \nsurface and are retained in the liquid phase. It gives rise \nto a constant vapour pressure because of an equilibrium in \nwhich the number of molecules leaving the liquid equals the \nnumber returning to liquid from the vapour. We say that \nthe system has reached equilibrium state at this stage. \nHowever, this is not static equilibrium and there is a lot of \nactivity at the boundary between the liquid and the vapour. \nThus, at equilibrium, the rate of evaporation is equal to the \nrate of condensation. It may be represented by\nH2O (l) H2O (vap)\nThe double half arrows indicate that the processes \nin both the directions are going on simultaneously. The \nmixture of reactants and products in the equilibrium state \nis called an equilibrium mixture.\nEquilibrium can be established for both physical \nprocesses and chemical reactions. The reaction may be \nfast or slow depending on the experimental conditions and \nthe nature of the reactants. When the reactants in a closed \nvessel at a particular temperature react to give products, \nthe concentrations of the reactants keep on decreasing, \nwhile those of products keep on increasing for some time \nafter which there is no change in the concentrations \nof either of the reactants or products. This stage of the \nsystem is the dynamic equilibrium and the rates of the \nforward and reverse reactions become equal. It is due to \nAfter studying this unit you will be \nable to \n• identify dynamic nature of \nequilibrium involved in physical \nand chemical processes;\n• state the law of equilibrium; \n• explain characterist ics of \nequilibria involved in physical \nand chemical processes;\n• write expressions for equilibrium \nconstants; \n• establish a relationship between \nKp and Kc;\n• explain various factors that \naffect the equilibrium state of a \nreaction;\n• classify substances as acids or \nbases according to Arrhenius, \nBronsted-Lowry and .\nThe extent of a reaction in equilibrium \nvaries with the experimental conditions such \nas concentrations of reactants, temperature, \netc. Optimisation of the operational conditions \nis very important in industry and laboratory \nso that equilibrium is favorable in the \ndirection of the desired product\", \"id\": null, \"title\": \"Unit 6\", \"filepath\": \"kech106 (1).pdf\", \"url\": \"https://buddiz.blob.core.windows.net/promoise-10-chemistry/kech106%20(1).pdf\", \"metadata\": {\"chunking\": \"orignal document size=997. Scores=2.2566125Org Highlight count=33.\"}, \"chunk_id\": \"4\"}, {\"content\": \"Some \nimportant aspects of equilibrium involving \nphysical and chemical processes are dealt in \nthis unit along with the equilibrium involving \nions in aqueous solutions which is called as \nionic equilibrium.\n6.1 EqU il ibr iUm in PHYS iCAl \nPrOCESSES\nThe characteristics of system at equilibrium \nare better understood if we examine some \nphysical processes. The most familiar examples \nare phase transformation processes, e.g.,\n solid liquid \n liquid gas\n solid gas\022 15:48:33\nRationalised 2023-24\n186 chemistry\nAddition of hydrogen at equilibrium \nresults in value of Qc being less than Kc . Thus, \nin order to attain equilibrium again reaction \nmoves in the forward direction. Similarly, \nwe can say that removal of a product also \nboosts the forward reaction and increases \nthe concentration of the products and this \nhas great commercial application in cases \nof reactions, where the product is a gas or a \nvolatile substance. In case of manufacture of \nammonia, ammonia is liquified and removed \nfrom the reaction mixture so that reaction \nkeeps moving in forward direction. Similarly, \nin the large scale production of CaO (used \nas important building material) from CaCO3, \nconstant removal of CO2 from the kiln drives \nthe reaction to completion\", \"id\": null, \"title\": \"Unit 6\", \"filepath\": \"kech106 (1).pdf\", \"url\": \"https://buddiz.blob.core.windows.net/promoise-10-chemistry/kech106%20(1).pdf\", \"metadata\": {\"chunking\": \"orignal document size=1001. Scores=3.674184Org Highlight count=37.\"}, \"chunk_id\": \"0\"}], \"intent\": \"[\\"What is physical equilibrium?\\"]\"}", "end_turn": false }, { "index": 1, "role": "assistant", "content": "Physical equilibrium refers to the state of a system in which opposing physical processes occur at equal rates, resulting in a stable condition [doc1]. It is only possible in a closed system at a given temperature, with all measurable properties of the system remaining constant [doc1]. Examples of physical equilibria include solid-liquid equilibrium, liquid-vapour equilibrium, and dissolution of gases in liquids [doc1]. In solid-liquid equilibrium, there is only one temperature at which the two phases can coexist, and the melting point is fixed at constant pressure [doc1]. In liquid-vapour equilibrium, the vapour pressure is constant at a given temperature [doc1]. For dissolution of gases in liquids, the concentration of a gas in liquid is proportional to the pressure of the gas over the liquid [doc1].", "end_turn": true }, { "role": "user", "content": "What is chemical equilibrium" }

]`

carolinedpena commented 8 months ago

Thanks, @nipun-threestops! Sending the tool messages corrected the issue and seems like they're required now.