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

[Bug]: When deployed using aws Lambda, it is throwing error cannot import name 'TextEmbedding' from 'fastembed' #442

Open
rlamba89 opened this issue Jan 21, 2025 · 0 comments

Comments

@rlamba89
Copy link

What happened?

"errorMessage": "Unable to import module 'text_embedding_poc': cannot import name 'TextEmbedding' from 'fastembed' (unknown location)",

`

       import json
      
      from fastembed import TextEmbedding
      
      embedding_model = TextEmbedding()
      print("The model BAAI/bge-small-en-v1.5 is ready to use.")
      
      def handler(event, context):
          try:
              for record in event['Records']:
                  sns_message = record['Sns']['Message']
                  sns_payload = json.loads(sns_message)
      
                  text = sns_payload['text']
      
                  embeddings_generator = embedding_model.embed(text)
                  return {
                      'statusCode': 200,
                      'body': json.dumps(embeddings_generator)
                  }
          except Exception as e:
              return {
                  'statusCode': 500,
                  'body': json.dumps(f"Error updating categories: {str(e)}")
              }

`

What is the expected behaviour?

Should allow to import

A minimal reproducible example

No response

What Python version are you on? e.g. python --version

Python 3.11.0

FastEmbed version

Latest

What os are you seeing the problem on?

MacOS

Relevant stack traces and/or logs

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