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

Add embedding service to edsl + coopr #1545

Open
johnjosephhorton opened this issue Feb 4, 2025 · 0 comments
Open

Add embedding service to edsl + coopr #1545

johnjosephhorton opened this issue Feb 4, 2025 · 0 comments
Assignees

Comments

@johnjosephhorton
Copy link
Contributor

It's super common when doing edsl work to want to take embeddings - we should support that through coopr as well.

def get_embeddings(texts, model="text-embedding-3-large"):
    # Clean the texts
    texts = [text.replace("\n", " ") for text in texts]
    
    # Get embeddings for all texts in one API call
    response = client.embeddings.create(input=texts, model=model)
    
    # Extract embeddings from response
    return [data.embedding for data in response.data]
@johnjosephhorton johnjosephhorton self-assigned this Feb 4, 2025
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

No branches or pull requests

1 participant