mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-04 14:39:23 +00:00
chore: drop tiktoken from anthropic async max_tokens test
This commit is contained in:
@@ -3,13 +3,9 @@ import json
|
||||
import logging
|
||||
|
||||
import pytest
|
||||
import tiktoken
|
||||
from pydantic import BaseModel
|
||||
|
||||
from crewai.llm import LLM
|
||||
|
||||
# Pre-cache tiktoken encoding so VCR doesn't intercept the download request
|
||||
tiktoken.get_encoding("cl100k_base")
|
||||
from crewai.llms.providers.anthropic.completion import AnthropicCompletion
|
||||
|
||||
|
||||
@@ -48,9 +44,7 @@ async def test_anthropic_async_with_max_tokens():
|
||||
|
||||
assert result is not None
|
||||
assert isinstance(result, str)
|
||||
encoder = tiktoken.get_encoding("cl100k_base")
|
||||
token_count = len(encoder.encode(result))
|
||||
assert token_count <= 10
|
||||
assert len(result.split()) <= 10
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Tests for Azure async completion functionality."""
|
||||
|
||||
import pytest
|
||||
import tiktoken
|
||||
|
||||
from crewai import Agent, Task, Crew
|
||||
from crewai.llm import LLM
|
||||
@@ -57,9 +56,7 @@ async def test_azure_async_with_max_tokens():
|
||||
|
||||
assert result is not None
|
||||
assert isinstance(result, str)
|
||||
encoder = tiktoken.get_encoding("cl100k_base")
|
||||
token_count = len(encoder.encode(result))
|
||||
assert token_count <= 10
|
||||
assert len(result.split()) <= 10
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
|
||||
@@ -6,7 +6,6 @@ cannot be played back properly in CI.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import tiktoken
|
||||
|
||||
from crewai.llm import LLM
|
||||
|
||||
@@ -51,9 +50,7 @@ async def test_bedrock_async_with_max_tokens():
|
||||
|
||||
assert result is not None
|
||||
assert isinstance(result, str)
|
||||
encoder = tiktoken.get_encoding("cl100k_base")
|
||||
token_count = len(encoder.encode(result))
|
||||
assert token_count <= 10
|
||||
assert len(result.split()) <= 10
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Tests for Google (Gemini) async completion functionality."""
|
||||
|
||||
import pytest
|
||||
import tiktoken
|
||||
|
||||
from crewai import Agent, Task, Crew
|
||||
from crewai.llm import LLM
|
||||
@@ -43,9 +42,7 @@ async def test_gemini_async_with_max_tokens():
|
||||
|
||||
assert result is not None
|
||||
assert isinstance(result, str)
|
||||
encoder = tiktoken.get_encoding("cl100k_base")
|
||||
token_count = len(encoder.encode(result))
|
||||
assert token_count <= 1000
|
||||
assert len(result.split()) <= 1000
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Tests for LiteLLM fallback async completion functionality."""
|
||||
|
||||
import pytest
|
||||
import tiktoken
|
||||
|
||||
from crewai.llm import LLM
|
||||
|
||||
@@ -44,9 +43,7 @@ async def test_litellm_async_with_max_tokens():
|
||||
|
||||
assert result is not None
|
||||
assert isinstance(result, str)
|
||||
encoder = tiktoken.get_encoding("cl100k_base")
|
||||
token_count = len(encoder.encode(result))
|
||||
assert token_count <= 10
|
||||
assert len(result.split()) <= 10
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Tests for OpenAI async completion functionality."""
|
||||
|
||||
import pytest
|
||||
import tiktoken
|
||||
|
||||
from crewai import Agent, Task, Crew
|
||||
from crewai.llm import LLM
|
||||
@@ -42,9 +41,7 @@ async def test_openai_async_with_max_tokens():
|
||||
|
||||
assert result is not None
|
||||
assert isinstance(result, str)
|
||||
encoder = tiktoken.get_encoding("cl100k_base")
|
||||
token_count = len(encoder.encode(result))
|
||||
assert token_count <= 10
|
||||
assert len(result.split()) <= 10
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
|
||||
Reference in New Issue
Block a user