Route import error #424
Replies: 1 comment
-
this was temporary issue caused by cohere API version changes — we have updated in latest versions, best to upgrade to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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
Beta Was this translation helpful? Give feedback.
All reactions