Skip to content

Commit

Permalink
Merge pull request #463 from aurelio-labs/james/function-schema-fix
Browse files Browse the repository at this point in the history
fix: function schemas
  • Loading branch information
jamescalam authored Nov 20, 2024
2 parents 43c2015 + a5103d6 commit 15c38d0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/indexes/pinecone-sync-routes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install -qU \"semantic-router[pinecone]==0.1.0.dev0\""
"!pip install -qU \"semantic-router[pinecone]==0.1.0.dev1\""
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
project = "Semantic Router"
copyright = "2024, Aurelio AI"
author = "Aurelio AI"
release = "0.1.0.dev0"
release = "0.1.0.dev1"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "semantic-router"
version = "0.1.0.dev0"
version = "0.1.0.dev1"
description = "Super fast semantic router for AI decision making"
authors = ["Aurelio AI <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion semantic_router/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__all__ = ["RouteLayer", "HybridRouteLayer", "Route", "LayerConfig"]

__version__ = "0.1.0.dev0"
__version__ = "0.1.0.dev1"
2 changes: 1 addition & 1 deletion semantic_router/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def sync(self, sync_mode: str, force: bool = False) -> List[str]:
remote_utterances=remote_utterances,
)
# generate sync strategy
sync_strategy = diff.to_sync_strategy()
sync_strategy = diff.get_sync_strategy(sync_mode=sync_mode)
# and execute
self._execute_sync_strategy(sync_strategy)
return diff.to_utterance_str()
Expand Down
2 changes: 2 additions & 0 deletions semantic_router/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def from_tuple(cls, tuple_obj: Tuple):
"""
route, utterance = tuple_obj[0], tuple_obj[1]
function_schemas = tuple_obj[2] if len(tuple_obj) > 2 else None
if isinstance(function_schemas, dict):
function_schemas = [function_schemas]
metadata = tuple_obj[3] if len(tuple_obj) > 3 else {}
return cls(
route=route,
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,21 @@ def test_auto_sync_merge_force_remote(
Utterance(route="Route 3", utterance="Boo"),
], "The routes in the index should match the local routes"

@pytest.mark.skipif(
os.environ.get("PINECONE_API_KEY") is None, reason="Pinecone API key required"
)
def test_sync(self, openai_encoder, index_cls):
route_layer = RouteLayer(
encoder=openai_encoder,
routes=[],
index=init_index(index_cls),
auto_sync=None,
)
route_layer.sync("remote")
time.sleep(PINECONE_SLEEP) # allow for index to be populated
# confirm local and remote are synced
assert route_layer.is_synced()

@pytest.mark.skipif(
os.environ.get("PINECONE_API_KEY") is None, reason="Pinecone API key required"
)
Expand Down

0 comments on commit 15c38d0

Please sign in to comment.