translation

This is an AI translated post.

해리슨 블로그

When JSON breaks in Gemini (or other LLMs)

  • Writing language: Korean
  • Base country: All countries country-flag

Select Language

  • English
  • 汉语
  • Español
  • Bahasa Indonesia
  • Português
  • Русский
  • 日本語
  • 한국어
  • Deutsch
  • Français
  • Italiano
  • Türkçe
  • Tiếng Việt
  • ไทย
  • Polski
  • Nederlands
  • हिन्दी
  • Magyar

Summarized by durumis AI

  • When generating JSON from LLMs, it is possible that incorrect characters are included, causing the output to break.
  • Using YAML, you can output stably and convert it back to JSON to solve this problem.
  • When outputting YAML, outputting values on individual lines can still cause errors, so you need to output them on the next line.

When generating JSON from LLMs such as Gemini Pro, Flash, etc., there are cases where the output is broken due to incorrect characters.



In cases like this, when trying to use JSON.parse, it will throw an error because there is another " inside the "(quotation mark).

In such cases, let's try using yaml.

- key : |-

If you request output as yaml like this, it can be output stably, and the output yaml can be converted back to json.

But there is one caveat here.

If you output it as a value on a single line, there can still be " inside the ", so you need to change it to the next line.

Add the following prompt.


해리슨
해리슨 블로그
해리슨의 깜짝 블로그
해리슨
Gemini 1.5 Flash, GPT-4o, and Pricing of Other LLMs Compare the performance and pricing of the latest AI models such as GPT-4o, Gemini 1.5 Pro, Claude 3 Haiku, and Gemini 1.5 Flash. We will guide you on how to choose the right model for you. Consider input token size, output ratio, task difficulty, etc. to

May 18, 2024

durumis Development - Part 3: Gemini Pro durumis has developed various features using Google's next-generation LLM 'Gemini Pro'. By applying AI technology such as automatic URL generation, summarization, writing descriptions, generating topics, and automatic classification, we have efficientl

February 3, 2024

Claude 3 vs Gemini Price Comparison Anthropic's Claude 3 Haiku model is now available on GCP, and H2O.ai's evaluation using RAG shows that it outperforms Gemini in terms of price-to-performance. Claude 3 Haiku is the cheapest based on input and output costs per million tokens.

April 7, 2024

[Next.js] Runtime env injection Learn how to set environment variables in Next.js after build time. We introduce how to install cross-env and modify scripts that even Windows users can easily follow. It can be effectively used for setting various environment variables such as local, de
Sunrabbit
Sunrabbit
Sunrabbit
Sunrabbit

March 20, 2024

What is LLM (Large Language Model)? Large Language Models (LLMs) are a core technology in artificial intelligence, learning from vast amounts of text data to acquire language processing abilities similar to humans. They can be used in various fields such as chatbots, translation, and text g
세상 모든 정보
세상 모든 정보
세상 모든 정보
세상 모든 정보

April 1, 2024

[Observability] Vector, the log collector challenge Vector, a log collection and processing tool developed by DataDog, is written in Rust, making it easier to write log conversion code than Otel, and supports integration with Loki in Kubernetes environments using Helm. However, it can be difficult to use d
Sunrabbit
Sunrabbit
Sunrabbit
Sunrabbit
Sunrabbit

March 9, 2024

2024.01.23 (Tue) Operational Update The operational update on January 23, 2024 includes various changes such as improved reading and writing features, design revisions, deployment error fixes, and SEO enhancements.
durumis-release
durumis-release
durumis-release
durumis-release

January 23, 2024

Writing my first post on durumis durumis is a platform that automatically translates articles into 18 languages and provides various formatting functions such as bold, italic, and underline. While it does not yet support adding spaces between code blocks and quotes, you can use Shift+Ent
이것저것 잡다한 이야기
이것저것 잡다한 이야기
이것저것 잡다한 이야기
이것저것 잡다한 이야기

April 14, 2024

Mr. Know-All Issue 6 - March 2024 We introduce LM Studio, a platform that allows you to run open source LLMs such as LLaMa, Falcon, MPT, and StarCoder locally, and various AI tools and services such as Devin, an AI software engineer, and crewAI, a multi-agent automation platform. We also
Pilot AISmrteasy
Pilot AISmrteasy
Pilot AISmrteasy
Pilot AISmrteasy

March 21, 2024