-
Notifications
You must be signed in to change notification settings - Fork 201
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
Comments
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? |
we include openai and cohere as default APIs with the library so people can just |
Thanks for jumping on this. Much obliged. |
Fixed in #430 #431 and new release created with the changes ( |
we noticed a bug, yanking release |
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
The text was updated successfully, but these errors were encountered: