Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 embedding models handle new-lines #419

Closed
wants to merge 1 commit into from

Conversation

ravwojdyla
Copy link
Contributor

Re: #418

@@ -17,8 +17,9 @@
@retry(wait=wait_random_exponential(min=1, max=20), stop=stop_after_attempt(6))
def get_embedding(text: str, engine="text-similarity-davinci-001", **kwargs) -> List[float]:

# replace newlines, which can negatively affect performance.
text = text.replace("\n", " ")
if engine.endswith("001"):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newlines should also be left in when using first-generation models that expect code inputs, so I suggest:

-    if engine.endswith("001"):
+    if engine.endswith("-001") and not engine.endswith("-code-001"):

(This applies identically to the other three occurrences of the if check.)

@RobertCraigie
Copy link
Collaborator

Thanks for putting the time into opening a PR! The embeddings_utils.py file has been removed in v1 so this no longer applies unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants