Handle length safe embedding only if needed (#3723)
Re: https://github.com/hwchase17/langchain/issues/3722
Copy pasting context from the issue:
https://github.com/hwchase17/langchain/blob/1bf1c37c0cccb7c8c73d87ace27cf742f814dbe5/langchain/embeddings/openai.py#L210-L211
Means that the length safe embedding method is "always" used, initial
implementation https://github.com/hwchase17/langchain/pull/991 has the
`embedding_ctx_length` set to -1 (meaning you had to opt-in for the
length safe method), https://github.com/hwchase17/langchain/pull/2330
changed that to max length of OpenAI embeddings v2, meaning the length
safe method is used at all times.
How about changing that if branch to use length safe method only when
needed, meaning when the text is longer than the max context length?