Digivate-Labs-Pvt-Ltd / AI-based-form-filling-Azure-replication

0 stars 0 forks source link

Azure LLM responses in-case of negative scenarios #9

Open dvl-pavansriram opened 2 hours ago

dvl-pavansriram commented 2 hours ago
  1. In case of api-key missing RequestBody:
    curl --location 'https://generalllm.openai.azure.com/openai/deployments/generalLLM/chat/completions?api-version=2024-02-15-preview' \
    --header 'Content-Type: application/json' \
    --data '{
    "messages": [
        {
            "role": "system",
            "content": [
                {
                    "type": "text",
                    "text": "As an expert in entity extraction, you parse text to identify and organize specific entities from diverse sources into structured formats, following detailed guidelines for clarity and completeness."
                }
            ]
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "प्रधान ग्राम पंचायत पिपरा कनक जनपद .. कुशीनगर द्वारा जारी\nपहचान व जाति प्रमाण पत्र\nप्रमाणित किया जाता है कि श्री/श्रीमती/कु0 प्रकाश राय ...\nपिता/पति का नाम श्री. रविन्द्र कुमार आयु .. 24 वर्ष ग्राम. पिपरा कनक ग्राम पंचायत पिपरा कनक पोस्ट .. अमावा. महंथ ...... तहसील. तमकुही .... जनपद कुशीनगर पिकनोड ... 274407 मो० ....... को मैं भली भाँति जानता हूँ तथा इनकी जाति अनुसूचित जाति और उपजाति ... बाल्मीकि .... है ।\nL\nदिनांक 20-01-2009\nग्रामप्रधान\nनोट :- उपरोक्त प्रमाण पत्र में कटिंग या सफेदा लकगार लिखा गया प्रमाण पत्र मान्य नहीं होगा !"
                },
                {
                    "type": "text",
                    "text": "You are a document entity extraction specialist. Always generate a response as per the given JSON schema. Given a caste certificate, your task is to extract the text value of the following entities,\n[{\"questionCategory\": \"casteCertificate\",\"info\": [{\"question\": \"applicantName\",\"response\": \"\"},{\"question\": \"guardianName\",\"response\": \"\"},{\"question\": \"caste\",\"response\": \"\"},{\"question\": \"subcaste\",\"response\": \"\"}]} ]"
                }
            ]
        }
    ],
    "temperature": 0,
    "top_p": 0.4,
    "max_tokens": 800
    }'

ResponseBody:

{
    "error": {
        "code": "401",
        "message": "Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."
    }
}
dvl-pavansriram commented 2 hours ago
  1. In case of api-version is missing RequestBody:
    curl --location 'https://generalllm.openai.azure.com/openai/deployments/generalLLM/chat/completions' \
    --header 'api-key: a67380a9f0114fc4b4053b4df9ed2f08' \
    --header 'Content-Type: application/json' \
    --data '{
    "messages": [
        {
            "role": "system",
            "content": [
                {
                    "type": "text",
                    "text": "As an expert in entity extraction, you parse text to identify and organize specific entities from diverse sources into structured formats, following detailed guidelines for clarity and completeness."
                }
            ]
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "प्रधान ग्राम पंचायत पिपरा कनक जनपद .. कुशीनगर द्वारा जारी\nपहचान व जाति प्रमाण पत्र\nप्रमाणित किया जाता है कि श्री/श्रीमती/कु0 प्रकाश राय ...\nपिता/पति का नाम श्री. रविन्द्र कुमार आयु .. 24 वर्ष ग्राम. पिपरा कनक ग्राम पंचायत पिपरा कनक पोस्ट .. अमावा. महंथ ...... तहसील. तमकुही .... जनपद कुशीनगर पिकनोड ... 274407 मो० ....... को मैं भली भाँति जानता हूँ तथा इनकी जाति अनुसूचित जाति और उपजाति ... बाल्मीकि .... है ।\nL\nदिनांक 20-01-2009\nग्रामप्रधान\nनोट :- उपरोक्त प्रमाण पत्र में कटिंग या सफेदा लकगार लिखा गया प्रमाण पत्र मान्य नहीं होगा !"
                },
                {
                    "type": "text",
                    "text": "You are a document entity extraction specialist. Always generate a response as per the given JSON schema. Given a caste certificate, your task is to extract the text value of the following entities,\n[{\"questionCategory\": \"casteCertificate\",\"info\": [{\"question\": \"applicantName\",\"response\": \"\"},{\"question\": \"guardianName\",\"response\": \"\"},{\"question\": \"caste\",\"response\": \"\"},{\"question\": \"subcaste\",\"response\": \"\"}]} ]"
                }
            ]
        }
    ],
    "temperature": 0,
    "top_p": 0.4,
    "max_tokens": 800
    }'

ResponseBody:

{
    "error": {
        "code": "404",
        "message": "Resource not found"
    }
}
dvl-pavansriram commented 2 hours ago
  1. In case of incorrect document path. RequestBody:
    curl --location 'https://generalllm.openai.azure.com/openai/deployments/generalLLM/chat/completions?api-version=2024-02-15-preview' \
    --header 'Content-Type: application/json' \
    --header 'api-key: a67380a9f0114fc4b4053b4df9ed2f08' \
    --data '{
    "messages": [
        {
            "role": "system",
            "content": [
                {
                    "type": "text",
                    "text": "As an expert in document entity extraction, you parse documents to identify and organize specific entities from diverse sources into structured formats, following detailed guidelines for clarity and completeness."
                }
            ]
        },
        {
            "role": "user",
            "content": [
                {"type":"image_url","image_url":{"url":"https://pancardstorage.blob.core.windows.net/testdocuments/castecertificate/Kartik Caste form 1 2"}},
                {
                    "type": "text",
                    "text": "You are a document entity extraction specialist. Always generate a response as per the given JSON schema. Given a caste certificate document, your task is to extract the text value of the following entities,\n[{\"questionCategory\": \"casteCertificate\",\"info\": [{\"question\": \"applicantName\",\"response\": \"\"},{\"question\": \"guardianName\",\"response\": \"\"},{\"question\": \"caste\",\"response\": \"\"},{\"question\": \"subcaste\",\"response\": \"\"}]} ]"
                }
            ]
        }
    ],
    "temperature": 0,
    "top_p": 0.1,
    "max_tokens": 800
    }'

ResponseBody:

{
    "error": {
        "code": "BadRequest",
        "message": "The provided image url can not be accessed. status code: 404.",
        "param": null,
        "type": null
    }
}
dvl-pavansriram commented 2 hours ago
  1. In case of an empty document path RequestBody:
    curl --location 'https://generalllm.openai.azure.com/openai/deployments/generalLLM/chat/completions?api-version=2024-02-15-preview' \
    --header 'Content-Type: application/json' \
    --header 'api-key: a67380a9f0114fc4b4053b4df9ed2f08' \
    --data '{
    "messages": [
        {
            "role": "system",
            "content": [
                {
                    "type": "text",
                    "text": "As an expert in document entity extraction, you parse documents to identify and organize specific entities from diverse sources into structured formats, following detailed guidelines for clarity and completeness."
                }
            ]
        },
        {
            "role": "user",
            "content": [
                {"type":"image_url","image_url":{"url":""}},
                {
                    "type": "text",
                    "text": "You are a document entity extraction specialist. Always generate a response as per the given JSON schema. Given a caste certificate document, your task is to extract the text value of the following entities,\n[{\"questionCategory\": \"casteCertificate\",\"info\": [{\"question\": \"applicantName\",\"response\": \"\"},{\"question\": \"guardianName\",\"response\": \"\"},{\"question\": \"caste\",\"response\": \"\"},{\"question\": \"subcaste\",\"response\": \"\"}]} ]"
                }
            ]
        }
    ],
    "temperature": 0,
    "top_p": 0.1,
    "max_tokens": 800
    }'

ResponseBody:

{
    "error": {
        "code": "BadRequest",
        "message": "Invalid image URL. The URL must be a valid HTTP or HTTPS URL, or a data URL with base64 encoding.",
        "param": null,
        "type": null
    }
}