I have been running into a major roadblock with langchain and I haven't yet figured out what's wrong. The issue is that when I ask openai to perform a task for me, it simply responds by saying what it will do, and then not actually doing it.
I've tried using a conversation chain to run this like so:
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import ConversationChain,LLMChain
from langchain.chains.conversation.memory import ConversationBufferMemory
import sys
f = open("prompts/Langston_-_SEO_OP.txt")
langston_prompt_string = f.read()
langston_prompt_string = langston_prompt_string.strip()
f.close() llm = OpenAI(temperature=0.7, openai_api_key="<my open api key>")
f = open('prompts/seo_prompt.txt')
seo_prompt_string = f.read()
f.close()
conversation_chain = ConversationChain(llm = llm, memory=ConversationBufferMemory(),
# verbose = True
)
conversation_chain.prompt.template = ''' You are a chatbot specializing in Search Engine optimization.
The first message will set your parameters as a SEO chatbot using a Langston prompt.
The second message will give you the relevant criteria on which to write an article based on
the supplied information in the message as well as perform a task specified by the value after the 'other' keyword.
The relevant criteria are:
1. topic
2. keywords,
3. style
4. sites
5. links
6. goals
7. other
Once you have received the parameters in the second message execute the request to write an article tailored to the SEO topic given. Also execute any instructions in the 'other' parameter.
Current conversation:
{history}
Human : {input}
AI:
'''
conversation_chain(langston_prompt_string)
output = conversation_chain(seo_prompt_string) print (output['response'])
Here's the response back from GPT:
"Understood, I will generate an article tailored to the SEO topic provided and include the relevant criteria and instructions. For the topic, I will focus on what an L & D Manager who works in the education sector should look for when looking for a Power BI course for their data analysts. The keywords I will focus on for SEO are Power BI training, Power BI courses, Power BI training courses for teachers. The desired tone and style of the content should be professional. For link building, I will use the website https://<url_link>/ Additionally, when mentioning Power BI I will create one external link to https://<url_link>. The goal of this piece of content is to get L & D Manager to book one of our courses. In addition to the article, I will also write an SEO page, a meta description and meta keywords. "
So, basically, all I can get GPT to do is tell me what it will do, and not actually doing it. I've run into this problem every time I've tried using langchain to do anything more than a trivial 'hello world' style application.
I have tried a number of different permutations of code and nothing has worked for me.
Anybody know what's wrong here?
Thanks