Automatically truncate text before sending to embedding model.
The embedding models have a maximum context length of 2048 tokens (see here). To avoid breaching this limit, we truncate the input to 2000 characters before calling the embedding models. This is conservative, but avoids an additional API call to check the tokens of the input, and in most cases the limit should not be breached.