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 tests for Python 3.9 #56

Closed
jamescalam opened this issue Jan 1, 2024 · 1 comment · Fixed by #92
Closed

Add tests for Python 3.9 #56

jamescalam opened this issue Jan 1, 2024 · 1 comment · Fixed by #92
Assignees
Labels

Comments

@jamescalam
Copy link
Member

Heard from users that there are issues when running with py3.9 — we should add tests and adjust if required.

@jamescalam jamescalam added the ci label Jan 1, 2024
@simjak simjak self-assigned this Jan 9, 2024
@simjak simjak linked a pull request Jan 10, 2024 that will close this issue
@rhamnett
Copy link

Hi @jamescalam the issue is with the pipe (OR operator):

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 from semantic_router import Route
      3 # we could use this as a guide for our chatbot to avoid political conversations
      4 politics = Route(
      5     name="politics",
      6     utterances=[
   (...)
     12     ],
     13 )

File ~/anaconda3/envs/pytorch_and_rapids/lib/python3.9/site-packages/semantic_router/__init__.py:1
----> 1 from semantic_router.hybrid_layer import HybridRouteLayer
      2 from semantic_router.layer import RouteLayer, LayerConfig
      3 from semantic_router.route import Route

File ~/anaconda3/envs/pytorch_and_rapids/lib/python3.9/site-packages/semantic_router/hybrid_layer.py:4
      1 import numpy as np
      2 from numpy.linalg import norm
----> 4 from semantic_router.encoders import (
      5     BaseEncoder,
      6     BM25Encoder,
      7     CohereEncoder,
      8     OpenAIEncoder,
      9 )
     10 from semantic_router.utils.logger import logger
     12 from semantic_router.route import Route

File ~/anaconda3/envs/pytorch_and_rapids/lib/python3.9/site-packages/semantic_router/encoders/__init__.py:2
      1 from semantic_router.encoders.base import BaseEncoder
----> 2 from semantic_router.encoders.bm25 import BM25Encoder
      3 from semantic_router.encoders.cohere import CohereEncoder
      4 from semantic_router.encoders.openai import OpenAIEncoder

File ~/anaconda3/envs/pytorch_and_rapids/lib/python3.9/site-packages/semantic_router/encoders/bm25.py:8
      3 from pinecone_text.sparse import BM25Encoder as encoder
      5 from semantic_router.encoders import BaseEncoder
----> 8 class BM25Encoder(BaseEncoder):
      9     model: Any | None = None
     10     idx_mapping: dict[int, int] | None = None

File ~/anaconda3/envs/pytorch_and_rapids/lib/python3.9/site-packages/semantic_router/encoders/bm25.py:9, in BM25Encoder()
      8 class BM25Encoder(BaseEncoder):
----> 9     model: Any | None = None
     10     idx_mapping: dict[int, int] | None = None
     11     type: str = "sparse"

TypeError: unsupported operand type(s) for |: '_SpecialForm' and 'NoneType'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants