avatarKris Franklin

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>

NFL Week 7 Bets

We’re coming off of a solid week 6 of bets. We ended up going 3–1 for the weekend taking us to 14–10 for the season. Going 14–10, and betting $100 per game, you’d have won $1400 and lost $1100 for a net profit of $300. Hoping to make everyone an additional $300 with this Sunday’s bets. Looks like we’re back on track and hope to extend this hot streak with our NFL week 7 bets. If you’re looking for the college football bets for this week you can find those here. We’re going into this weekend at 9–2 in college football so I definitely encourage you checking it out. Let’s review and learn from week 6 and then get to business for this week!

What Went Right?

We were counting on Pittsburgh’s defense to keep Cleveland in check. They did their part as the Steelers dominated the Browns 38–7 for the easy cover. We took Tennessee at -3.5 against division rival Houston Texans. It was looking very bleak at the end. When Houston went for a 2-point conversion we needed them to fail to convert. Then we needed Tennessee to get down and score a touchdown. They had to go for 1 and get it. And they needed to win the toss in overtime and score a touchdown. And somehow, someway, all of those things happened and we won our bet! It may have sounded risky to bet against a very strong Green Bay Packers team but I had faith that the Tampa Bay Buccaneers would be strong on defense and Brady would lead the offense. Tampa Bay won 38–10 to give us a perfect 3–0 on Sunday.

What Went Wrong?

Monday night football, the first game anyway, saw the Super Bowl defending champion Kansas City Chiefs travel to Western NY to take on the Buffalo Bills. Two very high powered offenses, with disappointing defenses, both coming off of their first loss, seemed like a recipe for a high scoring game. We locked in the over at 57.5 points. Then Monday came and it was a rainy night to set up a game full of run plays to miss the over with a total score of 43 points. But we still finished the week with 3–1 and I’m very happy with that.

NFL Week 7 Bets

The first game I’m looking at for Sunday may be the game of the week. The Tennessee Titans are hosting the Pittsburgh Steelers. Both teams are 5–0 and trying to cement their place at the top of their divisions. The Titans have a few key injuries on their offensive line. The Steelers have one of the top defenses in the league. On the other side of the ball I think Pittsburgh will have an easier time with the Titans defense. I like Pittsburgh here getting the point.

The Carolina Panthers and the New Orleans Saints meet in a battle of two NFC South teams. The Saints are quite familiar with the Panthers new QB Teddy Bridgewater and their defense has had time to heal over the bye week. On the offensive side they’ll have Michael Thomas back along with Brees and Kamara. The Panthers are still without Christian McCaffrey. I just don’t see how the Panthers will be able to keep up with this loaded Saints roster.

Edit: Michael Thomas has been ruled out for the Saints game. That being said I still like the teaser bet listed below.

Imagine a team that may have, quite possibly, the worst defense in the NFL. Now imagine that they’ve suffered injuries to key members of their offensive line. One of the backup linemen that just started last week is now also out with knee surgery. Now picture their star quarterback out for the season with a terrible injury. And off the field issues coming out to the press about turmoil between the players and the coaching. You would think a team with all of those things going against them would be double-digit underdogs. Instead they’re the Dallas Cowboys and they’re +1 against the Washington Football Team. Washington is far from being a successful team this year but I can’t see any professional football team failing to defeat the Cowboys at their lowest point.

The matchup between the San Francisco 49ers and the New England Patriots feels like two teams with opposite momentum. After the 49ers suffered a lot of injuries in week 1 playing at the Meadowlands they’ve struggled having to depend on backups. Now that they’re getting healthier they’ve been improving each week and getting back to their winning ways. Meanwhile the Patriots seem to be getting worse each week. This healthy and loaded 49ers team should outmatch their opponents this Sunday.

The Kris Bets This…

NFL (14–10) (58.33%) (+3 units)

Pittsburgh +1 Washington -1 New Orleans -1 San Francisco +8 2-team teaser

As per usual I took these lines from Draftkings. Please compare lines with Fanduel and anywhere else made available for you. Best of luck everyone and I’ll be back next Thursday with more college football picks!

Originally published at https://thekrisbets.com on October 23, 2020.

NFL
Football
Sports Betting
Sports
Football Betting
Recommended from ReadMedium