Skip to content

Commit

Permalink
chore: removed cohere
Browse files Browse the repository at this point in the history
  • Loading branch information
simjak committed Nov 14, 2024
1 parent c16ce77 commit 20b85cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
COHERE_API_KEY=
OPENAI_API_KEY=
39 changes: 19 additions & 20 deletions tests/unit/test_chunkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import numpy as np
import pytest
from semantic_router.encoders.base import BaseEncoder
from semantic_router.encoders.cohere import CohereEncoder

from semantic_router.encoders.openai import OpenAIEncoder
from semantic_chunkers import (
BaseChunker,
BaseSplitter,
Expand All @@ -19,12 +18,12 @@ def test_consecutive_sim_splitter():
mock_encoder = Mock()
mock_encoder.return_value = np.array([[1, 0], [1, 0.1], [0, 1]])

cohere_encoder = CohereEncoder(
openai_encoder = OpenAIEncoder(
name="",
cohere_api_key="a",
openai_api_key="a",
)
# Instantiate the ConsecutiveSimSplitter with the mock encoder
splitter = ConsecutiveChunker(encoder=cohere_encoder, score_threshold=0.9)
splitter = ConsecutiveChunker(encoder=openai_encoder, score_threshold=0.9)
splitter.encoder = mock_encoder

# Define some documents
Expand Down Expand Up @@ -54,12 +53,12 @@ async def async_return(*args, **kwargs):

mock_encoder.acall.side_effect = async_return

cohere_encoder = CohereEncoder(
openai_encoder = OpenAIEncoder(
name="",
cohere_api_key="a",
openai_api_key="a",
)
# Instantiate the ConsecutiveSimSplitter with the mock encoder
splitter = ConsecutiveChunker(encoder=cohere_encoder, score_threshold=0.9)
splitter = ConsecutiveChunker(encoder=openai_encoder, score_threshold=0.9)
splitter.encoder = mock_encoder

# Define some documents
Expand Down Expand Up @@ -90,11 +89,11 @@ def test_cumulative_sim_splitter():
)

# Instantiate the CumulativeSimSplitter with the mock encoder
cohere_encoder = CohereEncoder(
openai_encoder = OpenAIEncoder(
name="",
cohere_api_key="a",
openai_api_key="a",
)
splitter = CumulativeChunker(encoder=cohere_encoder, score_threshold=0.9)
splitter = CumulativeChunker(encoder=openai_encoder, score_threshold=0.9)
splitter.encoder = mock_encoder

# Define some documents
Expand Down Expand Up @@ -126,11 +125,11 @@ async def test_async_cumulative_sim_splitter():
)

# Instantiate the CumulativeSimSplitter with the mock encoder
cohere_encoder = CohereEncoder(
openai_encoder = OpenAIEncoder(
name="",
cohere_api_key="a",
openai_api_key="a",
)
splitter = CumulativeChunker(encoder=cohere_encoder, score_threshold=0.9)
splitter = CumulativeChunker(encoder=openai_encoder, score_threshold=0.9)
splitter.encoder = mock_encoder

# Define some documents
Expand Down Expand Up @@ -180,12 +179,12 @@ def test_statistical_chunker():
mock_encoder = Mock()
mock_encoder.side_effect = lambda docs: np.array([[1, 0] for _ in docs])

cohere_encoder = CohereEncoder(
openai_encoder = OpenAIEncoder(
name="",
cohere_api_key="a",
openai_api_key="a",
)
# Instantiate the ConsecutiveSimSplitter with the mock encoder
splitter = StatisticalChunker(encoder=cohere_encoder)
splitter = StatisticalChunker(encoder=openai_encoder)
splitter.encoder = mock_encoder

# Define some documents
Expand All @@ -211,12 +210,12 @@ async def test_async_statistical_chunker():
mock_encoder = AsyncMock()
mock_encoder.side_effect = lambda docs: np.array([[1, 0] for _ in docs])

cohere_encoder = CohereEncoder(
openai_encoder = OpenAIEncoder(
name="",
cohere_api_key="a",
openai_api_key="a",
)
# Instantiate the ConsecutiveSimSplitter with the mock encoder
splitter = StatisticalChunker(encoder=cohere_encoder)
splitter = StatisticalChunker(encoder=openai_encoder)
splitter.encoder = mock_encoder

# Define some documents
Expand Down

0 comments on commit 20b85cc

Please sign in to comment.