avatarMay More

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

7654

Abstract

-string">"product"</span>], template=<span class="hljs-string">"What is a good name for a company that makes {product}?"</span>,

<span class="hljs-built_in">print</span>(prompt.<span class="hljs-built_in">format</span>(product=<span class="hljs-string">"typing machines"</span>))

llm = OpenAI(temperature=<span class="hljs-number">0.9</span>) text = (prompt.<span class="hljs-built_in">format</span>(product=<span class="hljs-string">"typing machines"</span>)) <span class="hljs-built_in">print</span>(llm(text))</pre></div><p id="107e">⬇️ Notebook view:</p><figure id="8121"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*sNd-kSpCkaenSz159KjRuQ.png"><figcaption></figcaption></figure><p id="0e77">The following prototype is a good example of how LangChain can be used to automate prompt engineering, and leverage LLMs for conversational context:</p><div id="e533"><pre><span class="hljs-keyword">from</span> langchain.llms <span class="hljs-keyword">import</span> OpenAI <span class="hljs-keyword">from</span> langchain.chains <span class="hljs-keyword">import</span> ConversationChain <span class="hljs-keyword">from</span> langchain.chains.conversation.memory <span class="hljs-keyword">import</span> ConversationBufferMemory

llm = OpenAI(temperature=<span class="hljs-number">0</span>) conversation = ConversationChain( llm=llm, verbose=<span class="hljs-literal">True</span>, memory=ConversationBufferMemory() )

conversation.predict(<span class="hljs-built_in">input</span>=<span class="hljs-string">"Hi there!"</span>)</pre></div><p id="e3e8">Response:</p><div id="f542"><pre>> Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.

Current conversation:

Human: Hi there! AI:

> Finished chain. Hi there! It's nice to meet you. My name is AI. What's your name?</pre></div><p id="31b3">Input:</p><div id="3efb"><pre>conversation.predict(<span class="hljs-built_in">input</span>=<span class="hljs-string">"My name is Cobus"</span>)</pre></div><p id="1b3e">Response:</p><div id="8fca"><pre>> Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.

Current conversation:

Human: Hi there! AI: Hi there! It's nice to meet you. My name is AI. What's your name? Human: My name is Cobus AI:

> Finished chain. Nice to meet you, Cobus! What can I do for you today?</pre></div><p id="bcbb">This approach is not optimal for longer conversations as the prompt size sent to the LLM will just grow too big.</p><p id="fdcf">In this final example, the user is prompted for input and this is used to generate the response, it also illustrates how two chains are combined.</p><div id="f1bf"><pre>title = <span class="hljs-built_in">input</span>(<span class="hljs-string">'What is your title? '</span>) <span class="hljs-built_in">print</span> (<span class="hljs-string">'I have your title as '</span> + title)

era = <span class="hljs-built_in">input</span>(<span class="hljs-string">'Lasty, from what era should the text be? '</span>) <span class="hljs-built_in">print</span> (<span class="hljs-string">'I have your era as '</span> + era)

<span class="hljs-comment"># This is an LLMChain to write a synopsis given a title of a play and the era it is set in.</span> llm = OpenAI(temperature=<span class="hljs-number">.7</span>) template = <span class="hljs-string">"""You are a playwright. Given the title of play and the era it is set in, it is your job to write a synopsis for that title.

Title: {title} Era: {era} Playwright: This is a synopsis for the above play:"""</span> prompt_template = PromptTemplate(input_variables=[<span class="hljs-string">"title"</span>, <span class="hljs-string">'era'</span>], template=template) synopsis_chain = LLMChain(llm=llm, prompt=prompt_template, output_key=<span class="hljs-string">"synopsis"</span>)

<span class="hljs-comment"># This is an LLMChain to write a review of a play given a synopsis.</span> llm = OpenAI(temperature=<span class="hljs-number">.7</span>) template = <span class="hljs-string">"""You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.

Play Synopsis: {synopsis} Review from a New York Times play critic of the above play:"""</span> prompt_template = PromptTemplate(input_variables=[<span class="hljs-string">"synopsis"</span>], template=template) review_chain = LLMChain(llm=llm, prompt=prompt_template, output_key=<span class="hljs-string">"review"</span>)

<span class="hljs-comment"># This is the overall chain where we run these two chains in sequence.</span> <span class="hljs-keyword">from</span> langchain.chains <span class="hljs-keyword">import</span> SequentialChain overall_chain = SequentialChain( chains=[synopsis_chain, review_chain], input_variables=[<span class="hljs-string">"era"</span>, <span class="hljs-string">"title"</span>], <span class="hljs-comment"># Here we return multiple variables</span> output_variables=[<span class="hljs-string">"synopsis"</span>, <span class="hljs-string">"review"</span>], verbose=<span class="hljs-literal">True</span>)

review = overall_chain({<span class="hljs-string">"title"</span>:title, <span class="hljs-string">"era"</span>: era}) <span class="hljs-built_in">print</span> (review)</pre></div><p id="bc8d">And the output:</p><div id="b537"><pre>> Entering new SequentialChain chain...

> Finished chain. {'title': 'Tragedy at sunset on the beach', 'era': 'Victorian ', 'synopsis': "\n\nTragedy at Sunset on the Beach is set in the Victorian era and tells the story of a young girl, Amelia, whose search for love and happiness leads her to a fateful encounter with a mysterious stranger on the beach at sunset. While walking along the shore, Amelia meets a man named William, who presents her with a rose as a symbol of his affection. Though she initially resists his advances, Amelia eventually finds herself drawn to William and the two quickly grow close. \n\nHowever, as the sun sets, a secret from William's past is revealed that changes everything. It turns out that William is a wanted criminal and is being pursued by the police. After a tense confrontation, William is arrested and taken away, leaving Amelia heartbroken and alone.\n\nIn the aftermath of their chance encounter, Amelia is forced to grapple with the tragedy of her unrequited love, and the harsh realities of life. Her journey serves as a reminder that love isn't always as simple and straightforward as it may seem.", 'review': '\n\nTragedy at Sunset on the Beach is a captivating tale of love, loss, and the power of the human spirit. The set in the Victorian era allows for a unique perspective on the themes of the story, and the performance by the cast is truly remarkable.\n\nThe story follows Amelia, a young girl whose search for love and happiness leads her to a fateful encounter with a mysterious stranger on the beach at sunset. We watch as Amelia’s relationship with the stranger, William, develops and evolves, only to be cut short when a secret from his past is revealed. This revelation forces Amelia to confront the harsh realities of life and the tragedy of her unrequited love.\n\nThe play is a thought-p

Options

rovoking exploration of love, sacrifice, and the power of human connection. It’s a story that is sure to resonate with audiences who are looking for a story of love, loss, and hope. Highly recommended.'}</pre></div><h1 id="e5a3">In Conclusion</h1><p id="2a02">In the recent past, I have written a number of times on the coming fragmentation and that a single contained Conversational AI framework will not suffice.</p><p id="43a6">Already we are seeing that LLMs are forcing traditional chatbot framework providers to look out ward to technologies they should make provision for.</p><p id="e321">LangChain is software that fills a critical voice which currently exists to make LLMs more conversational.</p><p id="b240"><b><i>⭐️ Please follow me on <a href="https://www.linkedin.com/in/cobusgreyling/">LinkedIn</a> for updates on Conversational AI ⭐️</i></b></p><figure id="10d2"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*lIm_TXh6TC9uGn63lOjZtQ.png"><figcaption></figcaption></figure><p id="42a0"><i>I’m currently the <a href="https://www.linkedin.com/in/cobusgreyling">Chief Evangelist</a> @ <a href="https://www.humanfirst.ai">HumanFirst</a>. I explore and write about all things at the intersection of AI and language; ranging from <a href="https://cobusgreyling.medium.com/the-large-language-model-landscape-9da7ee17710b">LLMs</a>, <a href="https://cobusgreyling.medium.com/the-five-categories-of-conversational-ai-f2410beeaf2f">Chatbots</a>, <a href="https://cobusgreyling.medium.com/three-key-voicebot-design-considerations-7bf25444dfec">Voicebots</a>, Development Frameworks, <a href="https://cobusgreyling.medium.com/testing-complex-utterances-with-the-co-here-humanfirst-integration-145ab4eedd84">Data-Centric latent spaces</a> and more.</i></p><div id="02f7" class="link-block"> <a href="https://www.humanfirst.ai"> <div> <div> <h2>NLU design tooling</h2> <div><h3>“Conversation Designer, Retail, 10k+ employees The tool that turned conversation designers, into NLU designers” ★★★★★…</h3></div> <div><p>www.humanfirst.ai</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*lgMaRGTU1PRX4MB7)"></div> </div> </div> </a> </div><figure id="7278"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*qPfFI9uFl04n1ZUywxH38w.png"><figcaption></figcaption></figure><figure id="9789"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*mwQw4LOeZdWG1AD8RDheXw.jpeg"><figcaption><a href="https://www.linkedin.com/in/cobusgreyling">https://www.linkedin.com/in/cobusgreyling</a></figcaption></figure><figure id="bcbe"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*qPfFI9uFl04n1ZUywxH38w.png"><figcaption></figcaption></figure><div id="525b" class="link-block"> <a href="https://cobusgreyling.medium.com/subscribe"> <div> <div> <h2>Get an email whenever Cobus Greyling publishes.</h2> <div><h3>Get an email whenever Cobus Greyling publishes. By signing up, you will create a Medium account if you don’t already…</h3></div> <div><p>cobusgreyling.medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*jN8P0LRxgRrefLMK)"></div> </div> </div> </a> </div><div id="b7d5" class="link-block"> <a href="https://eliza.community"> <div> <div> <h2>Eliza Language Technology Community — Language Technology: Conversational AI, NLP/NLP, CCAI…</h2> <div><h3>ELIZA — Where language technology enthusiasts unite.</h3></div> <div><p>eliza.community</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*yM6mui4LoM4fDMPx)"></div> </div> </div> </a> </div><div id="63e6" class="link-block"> <a href="https://cobusgreyling.medium.com/the-cobus-quadrant-of-nlu-design-4b1654f21d70"> <div> <div> <h2>The Cobus Quadrant™ Of NLU Design</h2> <div><h3>NLU design is vital to planning and continuously improving Conversational AI experiences.</h3></div> <div><p>cobusgreyling.medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*yLwyX_HKYjwqFY0IkmesCw.png)"></div> </div> </div> </a> </div><div id="e342" class="link-block"> <a href="https://cobusgreyling.medium.com/the-cobus-quadrant-of-conversation-design-capabilities-9a28c23409cd"> <div> <div> <h2>The Cobus Quadrant™ Of Conversation Design Capabilities</h2> <div><h3>∗ This is part one of a two part series, please also take a look part two, the Cobus Quadrant of NLU Design.</h3></div> <div><p>cobusgreyling.medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*xdvS5qYcZsxll7FEUWRitA.png)"></div> </div> </div> </a> </div><div id="198e" class="link-block"> <a href="https://chat.langchain.dev/"> <div> <div> <h2>LangChain Chat</h2> <div><h3>LangChain documentation chatbot</h3></div> <div><p>chat.langchain.dev</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/)"></div> </div> </div> </a> </div><figure id="a944"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*qPfFI9uFl04n1ZUywxH38w.png"><figcaption></figcaption></figure><div id="8473" class="link-block"> <a href="https://github.com/hwchase17/langchain"> <div> <div> <h2>GitHub - hwchase17/langchain: ⚡ Building applications with LLMs through composability ⚡</h2> <div><h3>⚡ Building applications with LLMs through composability ⚡ pip install langchain Large language models (LLMs) are…</h3></div> <div><p>github.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*JB0ci66QVXXsDtm8)"></div> </div> </div> </a> </div><div id="1e65" class="link-block"> <a href="https://langchain.readthedocs.io/"> <div> <div> <h2>Welcome to LangChain</h2> <div><h3>Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications…</h3></div> <div><p>langchain.readthedocs.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/)"></div> </div> </div> </a> </div><figure id="8d81"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*qPfFI9uFl04n1ZUywxH38w.png"><figcaption></figcaption></figure></article></body>

Girls Talk Memoir, Disco

He Touched Me — There — And I Liked It

Grabbing my hand, he literally swirled me into the middle of the dance floor before holding my waist and pulling me close.

Created by author in Nightcafe — although I wished we had looked this cool — we certainly didn’t :-)

Staying as much as possible in chronological order, the next few stories are about the young May and boys or discos!

After the first kiss episode, my friendship group began to mix outside of school with other small cliques in the class, and this included my old pals Victoria and Jane.

I think this came about as Margie’s brother Andy went up into the sixth form at his school, and got to know Victoria's brother, who had previously been in a different form group. This meant when there were social occasions the sisters — and friends like me — were invited.

As already mentioned I was working with Jane in the village greengrocers at the weekend, and one of the men who owned the shop also ran the local catholic youth club. I went as often as I could, but what we all found tremendously exciting was the end of term discos.

Jane and I were at a positive advantage because we were part of the YC, most of the others didn’t live so near to it. And we not only knew our friends who came to the discos, but we also mixed with some of the local kids from the other schools. Which meant for us, these nights were not daunting at all.

I had turned fifteen a few months earlier and we were enjoying a very warm spring. The next event had been announced, and now I worked, I had my own cash to buy the type of clothes I liked. A few weeks earlier, I had purchased a tiered gypsy skirt and wanted a camisole top to complete the look. The day before the disco, I found the perfect one and have never forgotten how pretty it was.

It was made of white cotton mimicking lace, was sleeveless and had buttons down the front. Across the bust and travelling up to the straps was a thread of pale pink ribbon, which you could tie to achieve the ruching effect you were after. At that age, I was easily able to go braless, which was lucky as the top looked much prettier without one.

It went perfectly with my skirt and I headed off to the disco on cloud nine.

When I arrived, a group of my friends were outside chatting, and I stopped and joined them for a while before going in to get a drink and find Jane.

Jane and I liked to dance — often on the tables, until we were told to get down by Big John. After a short while I needed some air, so grabbing my jacket (it wasn’t so warm by now) I headed back outside and saw some friends chatting to a couple of boys I didn’t recognise.

When I went over to join them, one lad was entertaining Margie, so I engaged in conversation with Teresa and Midge. However, what happened next was a little embarrassing, but of course young people are fickler than most.

Somehow I caught the boy's attention, and as if transfixed he literally turned his back on Margie, looked straight into my eyes and said, “You’re … nice, what are you called?”

In the background, I heard Margie turn to the others and say, “how rude.” This was one of her catchphrases. She used it if anything happened to offend her.

And she was right. The lad was now acting as if she didn’t exist. He reached out and touched the broach on my jacket, “This is pretty. But not quite as pretty as you.”

Yes… a corny line I know! But come on — reader. I was only just fifteen. And had been a gawky wallflower only a year or so earlier. And if you remember, I had walked away from Greg because Margie was keen on him — I wasn’t going to do that again.

This boy was smart and very quick-witted. We exchanged banter for a while before most of the others went inside, so I joined them.

Then, it was slow dance time.

Margie’s brother had recently taken a bit of a shine to me and I thought he was okay, yet for some reason didn’t want to dance with him. I deliberately took off my shoes and sat on the side of one of the tables swinging my legs, so when Andy came over and asked, I was ready with an excuse.

In fact, I was in the process of saying I wasn’t in the mood for smooching when the lad I’d met outside appeared. I saw him out of the corner of my eye scan the hall, until he spied me.

As fast as lightening, he scooted over and got in-between me and Andy. “Let’s dance.” He stated.

“I haven’t got my shoes on. Not sure where they are.”

Andy stood there, not saying a thing.

“Ah, don’t worry. I like you barefoot.” Then grabbing my hand, the unknown boy literally swirled me into the middle of the dance floor before holding my waist and pulling me close.

Very close.

The lights were dim, a ballad was blaring out from the speakers, and I was nearly ready to swoon. The moment was running away with me, and I knew I didn’t want it to end.

It seemed passionate.

He was exciting.

Knew what he wanted and acted on this, or impulse.

I liked that. It made me feel vital.

The song moved on to another. The final anthem of the night. The lights seemed to lower even further, and then… he kissed me. At the same time, his hand wandered under my camisole and caressed the flesh.

Although scared in case someone may notice — I didn’t stop him. I was shocked yet exhilarated too. I was on fire and didn’t want the music to end. But it did.

He stood back, smiled and still holding my hand said, “See you again, beautiful.”

The night was over and left me with all kinds of questions.

  • Who was he?
  • Was it wrong to feel that way when someone touched you?
  • Should I not have been affronted rather than attracted to his brash manner?

Alpha Male?

I am not keen on labels, but I think this young man would be classed by society as an alpha male. He knew exactly what he wanted and was assured enough to get it. Don’t get me wrong, I can’t abide rudeness, but confidence is fine by me.

Nowadays, so-called alpha males get a bad press because the media and such like have morphed them into being narcissistic w@nkers.

In my opinion, alphas are in control of their character, knowing their strengths and recognising weaknesses, as well as being secure within themselves, and honest with others.

I certainly had not met anyone as assertive as this lad, and soon would meet another. It should have taught me how much I enjoy being with men who can match my spark and enthusiasm. However, it took me many years for that to finely sink in!

And of course —because I was so keen to see this young man again — I never did. I wonder what happened to him?

Another Memoir from this time in my life:

Subscribe to get an email when I post…

Memoir
Growing Up
Disco
Nonfiction
Dancing
Recommended from ReadMedium
avatarAlex Praytor
Seasons of Change

Winter tales

9 min read
avatarRoz Warren, Writing Coach
Flying First Class

Here’s what I got for my $500

6 min read