Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive an uncomplete JSON from /analyse #43

Closed
Tracked by #71
Youllou opened this issue Jun 5, 2024 · 3 comments
Closed
Tracked by #71

Receive an uncomplete JSON from /analyse #43

Youllou opened this issue Jun 5, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Youllou
Copy link
Member

Youllou commented Jun 5, 2024

Description

I sometimes receive an uncomplete JSON from /analyse
Sometimes it ends with ... indicating a probable issue with GPT being "lazy" but sometimes it doesnt.

Here is an example of a JSON I received from sending this picture
MicrosoftTeams-image

{
    "company_name": "CAMERON MICRONUTRIENTS",
    "company_address": "830 Old Dil Road. Suffolk VA 23434 LISA",
    "company_phone_number": "(757) 437-0656",
    "manufacturer_name": "Cameron Chemicals, Inc.",
    "manufacturer_address": "830 Old Dil Road. Suffolk VA 23434 LISA",
    "manufacturer_phone_number": "(757) 437-0656",
    "fertiliser_name": "ZINC 20% GRANULAIRE",
    "fertiliser_registration_number": "2015045B",
    "fertiliser_lot_number": "LOT 31923352",
    "fertiliser_npk": "N/A",
    "fertiliser_precautionary_fr": "Éviter de respirer les poussières/ fumées / gaz / brouillards / vapeurs / aérosols",
    "fertiliser_precautionary_en": "Avoid breathing dust/fume/pas/misti vapors/spray.",
    "fertiliser_instructions_fr": "Laver la peau soigneusement après manipulation. Utiliser seulement en plein air ou dans un endroit bien ventilé. Porter des gants de protection (des vêtements de protection des yeux / protection / du visage). Conserver dans un endroit bien ventilé. Conserver le récipient bien fermé. Garder sous clef.",
    "fertiliser_instructions_en": "Wash skin thoroughly after handling. Use only outdoors or in a well-ventilated area. Wear protective gloves/protective clothing/eye protection/face protection. Store in a well-ventilated place. Keep container tightly closed. Store locked up.",
    "fertiliser_ingredients_fr": "Frabriqué à partir de : sulfate de Zinc, Oxide de zinc",
    "fertiliser_ingredients_en": "DERIVED FROM: Zinc Sulphate and Zinc Oxide",
    "fertiliser_specifications_fr": "Aucun connu.",
    "fertiliser_specifications_en": "None known.",
    "fertiliser_cautions_fr": "AVERTISSEMENT Cet engrais renferme du Zinc et Soufre et ne doit être employé que de la manière recommandée. Il peut être nocif s'il est employé mal à propos. L'application de ce produit devrait être basée sur les résultats des analyses du sol et/ou tissue.",
    "fertiliser_cautions_en": "CAUTION this fertilizer contains Zinc and Sulphur and should be used only as recommended. It may prove harmful when misused. Applications of this product should be based on the results of soil and/or tissue analysis.",
    "fertiliser_recommendation_fr": "POUR EMPLOI EN MELANGE D'ENGRAIS POUR APPLICATION AU SOL SEULEMENT",
    "fertiliser_recommendation_en": "TO BE USED ONLY IN BLENDING FERTILIZER FOR SOIL APPLICATIONS",
    "fertiliser_first_aid_fr": "PREMIERS SECOURS\n· Si sur la peau. Laver avec beaucoup d'eau\n· En cas d'inhalation : Trareporter la personne à l'air frais et la garder confortablement respirer\n· Si dans les yeux : Rincer avec précaution à l'eau pendant plusieurs minutes. Enlever les lentilles de contact, si présentes et faciles à faire. Continuer à rincer. Appeler immédiatement un centre antipoison / médecin.\n· Traitement spécifique (voir les articles 4 à 8 de cette FOS et toute information supplémentaire sur cette étiquette)\n· En cas d'irritation cutanée : des conseils médicaux / attention\n· Enlever les vêtements contaminés et les laver avant de les réutiliser.",
    "fertiliser_first_aid_en": "FIRST AID\n· If on skin. Wash with plenty of water\n· If inhaled: Remove person to fresh air and keep comfortable for breathing.\n· If in eyes: Rinse cautiously with water for several minutes. Remove contact lenses, if present and easy to do. Continue rinsing. Immediately call a poison center/doctor.\n· Specific treatment (see sections 4 to 8 on this SDS and any additional information on this label)\n· If skin irritation occurs: Get medical advice/attention. Take off contaminated clothing and wash it before reuse.",
    "fertiliser_warranty_fr": "La garantie accordée par le vendeur se limite à ce qui est énoncé sur l'étiquette et sous réserve de ce qui précède, l'acheteur assume les risques pour les personnes ou les biens découlant de l'utilisation ou de la manipulation de ce produit et accepte le produit dans ces conditions.",
    "fertiliser_warranty_en": "Salon's Guarantee shall be limited to the terms set out on the label and subject to the foregoing, the buyer assumes the risk to persons or property arising from the use or handling of this product and accepts the product on that condition.",
    "fertiliser_danger_fr": "DANGER\nProvoque une irritation de la peau. Provoque une irritation des yeux. Peut irriter les voies respiratoires.",
    "fertiliser_danger_en": "DANGER\nCauses skin irritation. Causes serious eye irritation. May cause respiratory irritation.",
    "fertiliser_guaranteed_analysis": {
        "nutrient_in_guaranteed_analysis": [
            "Sulphur (S)",
            "Zinc (Zn)"
        ],
        "percentage_in_guaranteed_analysis": [
            "3.00%",
            "20.00%"
        ]
    },
    "fertiliser_weight": "2000 lbs (907kg)",
    "fertiliser_density": null,
    "fertiliser_volume": null,
    "fertiliser_label_all_other_text_fr": {
        "other_text_fr_1": "CONSEILS DE PRUDENCE\n· Éviter de respirer los poussières/ fumées / gaz / brouillards / vapeurs / aérosols\n· Laver la peau soigneusement après manipulation. Ufiser seulement en plein air ou dans un endroit bien ventilé. Porter des gants de protection ( des vêtements de protection des yeux / protection / du visage. Conserver dans un endroit bien ventilé. Conserver le récipient bien fermé. Garder sous clef.",
        "other_text_fr_2": "PREMIERS SECOURS\n· Si sur la peau. Laver avec beaucoup d'eau\n· En cas d'inhalation : Trareporter la personne à l'air frais et la garder confortablement respirer\n· Si dans les yeux : Rincer avec précaution à l'eau pendant plusieurs minutes. Enlever les lentiles de contact, si présentes et faciles à faire. Continuer à rncer. Appeler immédiatement un centre antipoison / médecin.\n· Traitement spécifique (voir les articles 4 à 8 de cette FOS et toute information supplémentaire sur cette coquette\n· En cas d'irritation cutanée : des conseils médicaux / atenton\n· Enlever les vétaments contaminés et laver avant de les réutiliser."
    },
    "fertiliser_label_all_other_text_en": {
        "other_text_en_1": "PRECAUTIONARY STATEMENTS\n· Avoid breathing dust/fume/pas/misti vapors/spray.\n· Wash skin thoroughly after handling. Use only outdoors or in a well-ventilated prea\n· Wear protective gloves/protective clothingleye protectioni\"ace protection\n· Store in e well-ventilated place. Keep container tightly closed. Store locked up - Dispose of contents/containers to an approved disposal site in accordance with iorsingle sinsinnalinizunational regulations.\n· If on skin. Wash with plenty of water\n· If inhaled: Remove person to fresh air and kapp comfortable for breathing.\n· If in eyes: Rinse cautiously with water for several minutes.R
@snakedye snakedye added the bug Something isn't working label Jun 5, 2024
@snakedye snakedye self-assigned this Jun 5, 2024
@snakedye
Copy link
Contributor

Should be fixed by setting the response_format to json.

@snakedye
Copy link
Contributor

Upon further investigation this seems to be also tied to the token limit. If the prompt has too much tokens, the response will be cropped. Updating our models should both allow us to force JSON and have a bigger token window.

@Endlessflow @SamuelPelletierEvraire

@Endlessflow
Copy link
Contributor

The new sanity checks we've implemented have mostly addressed the issue. Realistically, there's not much more we can do to overcome the remaining limitations, which include:

  • the model's occasional decision to summarize
  • the model's occasional production of invalid JSON

The first issue is too complex to resolve and falls beyond our immediate scope. The second will resolve itself once Azure updates the GPT-3.5 model to the newer versions that support JSON mode.

Considering this, I'll mark this issue as resolved for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants