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

Route import error #425

Closed
robhaslinger opened this issue Sep 20, 2024 Discussed in #424 · 6 comments
Closed

Route import error #425

robhaslinger opened this issue Sep 20, 2024 Discussed in #424 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@robhaslinger
Copy link

Discussed in #424

Originally posted by robhaslinger September 20, 2024
New to semantic router and was trying to get the local execution example working, e.g. https://github.com/aurelio-labs/semantic-router/blob/main/docs/05-local-execution.ipynb

I pip installed like so on my Ubuntu box: pip install -U "semantic-router[local]"

I can not even import the Route class. that is, if I simply do this in a jupyter notebook

from semantic_router import Route

I get this error trace

{
"name": "ImportError",
"message": "cannot import name 'EmbedResponse_EmbeddingsByType' from 'cohere.types.embed_response' (/home/rob/.virtualenvs/ai_dev/lib/python3.10/site-packages/cohere/types/embed_response.py)",
"stack": "---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from semantic_router import Route

File ~/.virtualenvs/ai_dev/lib/python3.10/site-packages/semantic_router/init.py:1
----> 1 from semantic_router.hybrid_layer import HybridRouteLayer
2 from semantic_router.layer import LayerConfig, RouteLayer
3 from semantic_router.route import Route

File ~/.virtualenvs/ai_dev/lib/python3.10/site-packages/semantic_router/hybrid_layer.py:6
3 import numpy as np
4 from numpy.linalg import norm
----> 6 from semantic_router.encoders import (
7 BaseEncoder,
8 BM25Encoder,
9 TfidfEncoder,
10 )
11 from semantic_router.route import Route
12 from semantic_router.utils.logger import logger

File ~/.virtualenvs/ai_dev/lib/python3.10/site-packages/semantic_router/encoders/init.py:7
5 from semantic_router.encoders.bm25 import BM25Encoder
6 from semantic_router.encoders.clip import CLIPEncoder
----> 7 from semantic_router.encoders.cohere import CohereEncoder
8 from semantic_router.encoders.fastembed import FastEmbedEncoder
9 from semantic_router.encoders.google import GoogleEncoder

File ~/.virtualenvs/ai_dev/lib/python3.10/site-packages/semantic_router/encoders/cohere.py:5
2 from typing import List, Optional
4 import cohere
----> 5 from cohere.types.embed_response import EmbedResponse_EmbeddingsByType
7 from semantic_router.encoders import BaseEncoder
8 from semantic_router.utils.defaults import EncoderDefault

ImportError: cannot import name 'EmbedResponse_EmbeddingsByType' from 'cohere.types.embed_response' (/home/rob/.virtualenvs/ai_dev/lib/python3.10/site-packages/cohere/types/embed_response.py)"
}

I did check that cohere is installed in my virtualenv cohere=5.9.4

Any ideas are appreciated - thx Rob

@robhaslinger
Copy link
Author

looking more carefully this seems to be the same as this issue: #422

I do wonder why cohere is needed at all for local routing using huggingface encoder or other local encoders?

@jamescalam
Copy link
Member

we include openai and cohere as default APIs with the library so people can just pip install semantic-router and use it without issue. In any case, the problem here is due to a change in the Cohere API, we are reviewing a fix raised in #430 and will have this resolved asap

@jamescalam jamescalam added the bug Something isn't working label Sep 23, 2024
@robhaslinger
Copy link
Author

Thanks for jumping on this. Much obliged.

@jamescalam
Copy link
Member

Fixed in #430 #431 and new release created with the changes (0.0.67) https://github.com/aurelio-labs/semantic-router/releases/tag/v0.0.67

@jamescalam
Copy link
Member

we noticed a bug, yanking release 0.0.67 and releasing 0.0.68 #433 - will be merged and released soon

@jamescalam
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants