Relative Content

Tag Archive for openai-apilangchain

An error occurred: ‘AzureOpenAI’ object has no attribute ‘Completion’ in RAG using OpenAI keys and Langchain

I am fetching my embeddings from Mongo Atlas Converting the query to embeddings using text-embedding-adaa002 api key Performing Similarity check Introduced GPT api keys and azure endpoint os.environ[“OPENAI_API_KEY_GPT”] = “xxx” os.environ[“AZURE_OPENAI_ENDPOINT_GPT”] = “https://xxx.openai.azure.com/” mongodb_connection_string = “xxx” client = MongoClient(mongodb_connection_string) db = client[‘langchain-test’] collection = db[‘xx’] openai.api_key_gpt = os.getenv(“OPENAI_API_KEY_GPT”) azure_openai_endpoint_gpt = os.getenv(“AZURE_OPENAI_ENDPOINT_GPT”) openai_gpt_client = AzureOpenAI( api_key=openai.api_key_gpt, […]

Notes Generator using langchain

Basically I am trying to build a notes and mcq generator.
The workflow that I have had followed is :
First I have had generated the syllabus of a class(here class 8th) and then using that generated syllabus I have had generated notes and mcq questions.

Want output in json format

So basically I have had made a notes generator. First I have had generated the chapters of respective subject and then after that I used those generated chapters to generate notes and mcq questions according to the aspiration of the student and then I am saving it in a text file.

LangChain ConversationChain check if tokens are of certain type

I have a LnagChain ConversationChain using OpenAI and everything works well in terms of chat and conversation.
What I am trying to achieve is to detect some token types while the conversation is taking place (for example is the token an email, name, phone number, address).
The goal is to collect a “structured” conversation summary.
I have tried passing the conversation summary again to OpenAI api to return JSON for me to process but that’s costing more tokens to use.
Any idea on how to achieve this?