How to connect vector search pipeline to RAG stack (with langchain)?

Hi @Harshad_Dhavale .
Thank you for the response and explanation. I have made the change as you pointed out and now I am getting another error:

I am not sure what causes this error, but I am a little suspicious that it may be because the way my embeddings are created. I use OpenAI vector embedding as shownbelow to vectorize the text inside the ‘wod’ field in my collection and then save the vector in the ‘embedding’ field.

import os
from dotenv import load_dotenv

from pymongo.mongo_client import MongoClient
from openai import OpenAI

load_dotenv()


mongoUri = os.environ.get("MONGO_ATLAS_DB_URL")
mongoClient = MongoClient(mongoUri)
mongoDb = mongoClient['xfitpal']
wods_collection = mongoDb['wods']

OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")

client = OpenAI(api_key=OPENAI_API_KEY)
def generate_openai_embeddings(text: str) -> list[float]:
    response = client.embeddings.create(model="text-embedding-ada-002",
    input=text)
    return response.data[0].embedding


for document in wods_collection.find():
    document['embedding'] = generate_openai_embeddings(document['wod'])
    wods_collection.replace_one({'_id': document['_id']}, document)

Any ideas on what I may be doing wrong here? Thanks again for yout help.