# Generate code from previous response

**URL:** <https://community.deeplearning.ai/t/generate-code-from-previous-response/404260>\
**Category:** Generative AI with Large Language Models\
**Created:** [August 1, 2023, 8:43am UTC](https://community.deeplearning.ai/t/generate-code-from-previous-response/404260 "2023-08-01T08:43:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabrielavila](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@gabrielavila](https://community.deeplearning.ai/u/gabrielavila)\
**Post date:** [August 1, 2023, 8:43am UTC](https://community.deeplearning.ai/t/generate-code-from-previous-response/404260/1 "2023-08-01T08:43:39Z")

</div>

Hi all,

I’m providing information in prompts to generate python code, but I would like the chat to remember the code in previous responses in order to generate next response. I already did the “LangChain Chat with Your Data” course but trying this with code seems to be not working properly. Does anyone know which is the proper way to do this? Is there any course I can do that would help?

Thank you!

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [August 1, 2023, 9:34am UTC](https://community.deeplearning.ai/t/generate-code-from-previous-response/404260/2 "2023-08-01T09:34:34Z")

</div>

I think they teach this in Prompt Engineering short course. I am not sure though…

---

<div class="post-metadata">

**Author:** ![gabrielavila](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@gabrielavila](https://community.deeplearning.ai/u/gabrielavila)\
**Post date:** [August 3, 2023, 8:52am UTC](https://community.deeplearning.ai/t/generate-code-from-previous-response/404260/3 "2023-08-03T08:52:26Z")

</div>

I’ve seen examples with plain text there but this does not work with code responses, do you know if there is any course working with conversationBufferMemory and code?

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [August 3, 2023, 9:51am UTC](https://community.deeplearning.ai/t/generate-code-from-previous-response/404260/4 "2023-08-03T09:51:11Z")

</div>

I am sorry, I don’t know.
