You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`from openai import OpenAI
import os
os.environ["OPENAI_API_KEY"] = "sk-XXXXX"
from semantic_router import Route, RouteLayer
from semantic_router.encoders import OpenAIEncoder
repo_route = Route(
name="get-repos",
utterances=[
"what are the repos in ADSI?",
"what are the files in the repo",
],
)
project_route = Route(
name="get-project-details",
utterances=[
"is there a project called ADSI?",
"can you give me details around the project ADSI?",
],
)
routes=[repo_route, project_route]
rl = RouteLayer(encoder = OpenAIEncoder(name="text-embedding-3-small"),routes=routes)
route=rl("list all the files in the repo ADS")
print(route.name)`
2024-07-15 15:50:20 WARNING semantic_router.utils.logger Retrying in 2 seconds...
2024-07-15 15:50:27 WARNING semantic_router.utils.logger Retrying in 4 seconds...
2024-07-15 15:50:38 WARNING semantic_router.utils.logger Retrying in 8 seconds...
2024-07-15 15:50:57 WARNING semantic_router.utils.logger Retrying in 16 seconds...
2024-07-15 15:51:31 WARNING semantic_router.utils.logger Retrying in 32 seconds...
2024-07-15 15:52:38 WARNING semantic_router.utils.logger Retrying in 64 seconds...
2024-07-15 15:52:38 INFO semantic_router.utils.logger Returned embeddings: None
Traceback (most recent call last):
File "/Users/mmvohal/code/ai-thon/pages/📖FOSS.py", line 27, in
rl = RouteLayer(encoder = OpenAIEncoder(name="text-embedding-ada-002"),routes=routes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mmvohal/code/ai-thon/ai-thon/lib/python3.11/site-packages/semantic_router/layer.py", line 222, in init
self._add_routes(routes=self.routes)
File "/Users/mmvohal/code/ai-thon/ai-thon/lib/python3.11/site-packages/semantic_router/layer.py", line 465, in _add_routes
embedded_utterances = self.encoder(all_utterances)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mmvohal/code/ai-thon/ai-thon/lib/python3.11/site-packages/semantic_router/encoders/openai.py", line 135, in call
raise ValueError(f"No embeddings returned. Error: {error_message}")
ValueError: No embeddings returned. Error: Connection error.
The text was updated successfully, but these errors were encountered:
The warnings you're seeing here are from the retry mechanism for embeddings. The encoder retries if it gets an erroneous (or no) response from OpenAI, likely issues:
Actual network connection issues
API key?
Does your API key have permissions to create embeddings?
i also get this. I was testing cohere/huggingface/openai. OpenAI worked, then later in the day it stopped working giving a similar error to OP. Generated a new API key with no restrictions and same behaviour.
2024-08-12 14:52:33 WARNING semantic_router.utils.logger Retrying in 2 seconds...
2024-08-12 14:52:38 WARNING semantic_router.utils.logger Retrying in 4 seconds...
Traceback (most recent call last):
...
BadRequestError: Error code: 400 - {'error': {'message': "'$.input' is invalid. Please check the API reference: https://platform.openai.com/docs/api-reference.", 'type': 'invalid_request_error', 'param': None, 'code': None}}
openai | 1.35.13
langchain | 0.2.8
langchain-core | 0.2.19
semantic-router | 0.0.52
`from openai import OpenAI
import os
os.environ["OPENAI_API_KEY"] = "sk-XXXXX"
from semantic_router import Route, RouteLayer
from semantic_router.encoders import OpenAIEncoder
repo_route = Route(
name="get-repos",
utterances=[
"what are the repos in ADSI?",
"what are the files in the repo",
],
)
project_route = Route(
name="get-project-details",
utterances=[
"is there a project called ADSI?",
"can you give me details around the project ADSI?",
],
)
routes=[repo_route, project_route]
rl = RouteLayer(encoder = OpenAIEncoder(name="text-embedding-3-small"),routes=routes)
route=rl("list all the files in the repo ADS")
print(route.name)`
2024-07-15 15:50:20 WARNING semantic_router.utils.logger Retrying in 2 seconds...
2024-07-15 15:50:27 WARNING semantic_router.utils.logger Retrying in 4 seconds...
2024-07-15 15:50:38 WARNING semantic_router.utils.logger Retrying in 8 seconds...
2024-07-15 15:50:57 WARNING semantic_router.utils.logger Retrying in 16 seconds...
2024-07-15 15:51:31 WARNING semantic_router.utils.logger Retrying in 32 seconds...
2024-07-15 15:52:38 WARNING semantic_router.utils.logger Retrying in 64 seconds...
2024-07-15 15:52:38 INFO semantic_router.utils.logger Returned embeddings: None
Traceback (most recent call last):
File "/Users/mmvohal/code/ai-thon/pages/📖FOSS.py", line 27, in
rl = RouteLayer(encoder = OpenAIEncoder(name="text-embedding-ada-002"),routes=routes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mmvohal/code/ai-thon/ai-thon/lib/python3.11/site-packages/semantic_router/layer.py", line 222, in init
self._add_routes(routes=self.routes)
File "/Users/mmvohal/code/ai-thon/ai-thon/lib/python3.11/site-packages/semantic_router/layer.py", line 465, in _add_routes
embedded_utterances = self.encoder(all_utterances)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mmvohal/code/ai-thon/ai-thon/lib/python3.11/site-packages/semantic_router/encoders/openai.py", line 135, in call
raise ValueError(f"No embeddings returned. Error: {error_message}")
ValueError: No embeddings returned. Error: Connection error.
The text was updated successfully, but these errors were encountered: