---
title: "Discussion on \"Extracting and Generating JSON Data with OpenAI GPT, LangChain, and Python\" | Hashnode"
description: "Discussion on \"Extracting and Generating JSON Data with OpenAI GPT, LangChain, and Python\". Manipulating Structured Data (from PDFs) with the Model behind ChatGPT, LangChain, and Python for Powerful AI-driven Applications"
url: "https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Extracting and Generating JSON Data with OpenAI GPT, LangChain, and Python](https://horosin.com/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python?utm_source=hashnode&utm_medium=feed)

Manipulating Structured Data (from PDFs) with the Model behind ChatGPT, LangChain, and Python for Powerful AI-driven Applications

Sep 11, 2023 · 8 min read · horosin.com  
Read the article

-   [#langchain](https://hashnode.com/tag/langchain)
-   [#python](https://hashnode.com/tag/python)
-   [#programming](https://hashnode.com/tag/programming)
-   [#ai](https://hashnode.com/tag/ai)
-   [#llm](https://hashnode.com/tag/llm)

## Written by

[Karol Horosin](https://hashnode.com/@horosin)

@horosin

  
[View profile](https://hashnode.com/@horosin)

Software Lead

Engineer, Builder, Writer

## Responses 3

Markdown supported · ⌘↵ to post

[Arwa Saqabi](https://hashnode.com/@arwa336)

[Sep 26, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6512b60d2bb1a6545331673c)

it's a detailed article with all useful information. i fine-tuned gpt3.5 with train and valid sets, i got the result file but i don't know how to analyse it! as the train accuracy column values fluctuate with 0.333 - 0.66 - 0,66-0- 0,66- 1e-05- 0-0.66-0.7-1 . does this mean i need more samples for training ?

[Arwa Saqabi](https://hashnode.com/@arwa336)

[Sep 26, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6512b60d2bb1a6545331673c#reply-6512d4b0616acf53c14bbf14)

i training gpt3.5 for binary classification task i would like to know the accuracy of fine-tuned model. i got a csv file which include 4 columns \[step train\_loss train\_accuracy valid\_loss valid\_mean\_token\_accuracy\] but the accuracy values is fluctuated is that mean my model doesn't work as appropriate ?

[Karol Horosin](https://hashnode.com/@horosin)

[Karol Horosin](https://hashnode.com/@horosin)

[Sep 27, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6512b60d2bb1a6545331673c#reply-6513e4e3a80ded5c381ef6ef)

Ware you following any tutorial? How big is your set? Do results look OK when you test manually? Hard to help with limited info!

[Arwa Saqabi](https://hashnode.com/@arwa336)

[Arwa Saqabi](https://hashnode.com/@arwa336)

[Sep 27, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6512b60d2bb1a6545331673c#reply-6513e79748a8545cd89925e6)

[Karol Horosin](https://hashnode.com/@horosin) sorry it wasn't your tutorial. I was confused. but kindly if you have knowledge about fine-tune gpt3.5 on binary classification task. i have a more than 200 000 samples. i think i will need just part of it.

[Kavir Kaycee](https://hashnode.com/@kavir)

[Sep 21, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/650c94796e010e234b1d0746)

Thanks for sharing this detailed breakdown! Sure it'll be useful for a lot of folks building similar apps in AI

[Karol Horosin](https://hashnode.com/@horosin)

[Sep 22, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/650c94796e010e234b1d0746#reply-650d2a20721e3f2693c451da)

Yeah there's still very limited resources on these tools. Especially there's a lack of good examples online

[Akinfolarin](https://hashnode.com/@fosty)

[Sep 16, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6505d7d44f2724f559f24dd6)

have.9.62

[Akinfolarin](https://hashnode.com/@fosty)

[Sep 16, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6505d7c3dbce26f1bafa0b06)

very, y tr h jnn j

[Coder Bible](https://hashnode.com/@coderbible)

[Sep 12, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6500381c703e32bdbc1d2253)

Good one, how about using function calling?

[Karol Horosin](https://hashnode.com/@horosin)

[Sep 12, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6500381c703e32bdbc1d2253#reply-65007ed1d3da8dcacfaa8c07)

This is a great approach but not flexible between LLMs. It should bo more optimal prompt size wise. For function calling, I would use openai Python package directly.

[Coder Bible](https://hashnode.com/@coderbible)

[Sep 16, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6500381c703e32bdbc1d2253#reply-65052286dbce26f1baf9f771)

[Karol Horosin](https://hashnode.com/@horosin) any tips on how to do this right?

[Karol Horosin](https://hashnode.com/@horosin)

[Sep 22, 2023](https://hashnode.com/posts/extracting-and-generating-json-data-with-openai-gpt-langchain-and-python/64ffa38cdc0c7065275f11e3/comment/6500381c703e32bdbc1d2253#reply-650d2a9f721e3f2693c45201)

[Coder Bible](https://hashnode.com/@coderbible) Ill think about a separate article. In the meantime, I've prepared a demo of function calling. Not for data extraction but instead of calling a function you can just take the input and use it in your application.

[github.com/horosin/openai-functions-demo](https://github.com/horosin/openai-functions-demo)
