AttributeError: `Document` object has not attribute `replace`
Labels: name: area: embeddings, name: area: vector store, name: auto:bug

### System Info

langchain==0.0.144
python3 == 3.11.4

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [X] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I am running the following code:
```
from langchain.document_loaders import PyMuPDFLoader
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import FAISS

# Load the text document
loader = PyMuPDFLoader("path/to/file.pdf")
documents = loader.load()

# Split the document into chunks
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)

# Generate the embeddings
embeddings = OpenAIEmbeddings()
embedded_docs = embeddings.embed_documents(docs)

# Initialize FAISS
db = FAISS.from_documents(embedded_docs, embeddings)

# Perform a similarity search between the embedding of the query and the embeddings of the documents
query = "Your query here"
similar_docs = db.similarity_search(query)

# Print the content of the most similar document
print(similar_docs[0].page_content)
```

The error occurs as follows:
```
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /var/folders/q3/9988ccxx13q_x9yfdkv36x2r0000gn/T/ipykernel_22317/1552469458.py:1 in <module>     │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ '/var/folders/q3/9988ccxx13q_x9yfdkv36x2r0000gn/T/ipykernel_22317/1552469458.py'                 │
│                                                                                                  │
│ /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/langchain/embedd │
│ ings/openai.py:275 in embed_documents                                                            │
│                                                                                                  │
│   272 │   │   """                                                                                │
│   273 │   │   # handle batches of large input text                                               │
│   274 │   │   if self.embedding_ctx_length > 0:                                                  │
│ ❱ 275 │   │   │   return self._get_len_safe_embeddings(texts, engine=self.document_model_name)   │
│   276 │   │   else:                                                                              │
│   277 │   │   │   results = []                                                                   │
│   278 │   │   │   _chunk_size = chunk_size or self.chunk_size                                    │
│                                                                                                  │
│ /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/langchain/embedd │
│ ings/openai.py:209 in _get_len_safe_embeddings                                                   │
│                                                                                                  │
│   206 │   │   │   encoding = tiktoken.model.encoding_for_model(self.document_model_name)         │
│   207 │   │   │   for i, text in enumerate(texts):                                               │
│   208 │   │   │   │   # replace newlines, which can negatively affect performance.               │
│ ❱ 209 │   │   │   │   text = text.replace("\n", " ")                                             │
│   210 │   │   │   │   token = encoding.encode(                                                   │
│   211 │   │   │   │   │   text,                                                                  │
│   212 │   │   │   │   │   allowed_special=self.allowed_special,                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Document' object has no attribute 'replace'
```

### Expected behavior

Expected behaviour is that the variable `embedded_docs` should return a list of vector embeddings for each document.