Skip to content

Commit

Permalink
Ruff 🐶
Browse files Browse the repository at this point in the history
  • Loading branch information
anticorrelator committed Dec 2, 2024
1 parent 8a365ce commit a216250
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from phoenix.evals.exceptions import PhoenixContextLimitExceeded
from phoenix.evals.models.base import BaseModel
from phoenix.evals.models.rate_limiters import RateLimiter
from phoenix.evals.templates import PromptPartContentType, MultimodalPrompt
from phoenix.evals.templates import MultimodalPrompt, PromptPartContentType

MINIMUM_ANTHROPIC_VERSION = "0.18.0"

Expand Down
2 changes: 1 addition & 1 deletion packages/phoenix-evals/src/phoenix/evals/models/litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Any, Dict, List, Optional, Union

from phoenix.evals.models.base import BaseModel
from phoenix.evals.templates import PromptPartContentType, MultimodalPrompt
from phoenix.evals.templates import MultimodalPrompt, PromptPartContentType

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from phoenix.evals.models.base import BaseModel
from phoenix.evals.models.rate_limiters import RateLimiter
from phoenix.evals.templates import PromptPartContentType, MultimodalPrompt
from phoenix.evals.templates import MultimodalPrompt, PromptPartContentType

if TYPE_CHECKING:
from mistralai.models.chat_completion import ChatMessage
Expand Down
2 changes: 1 addition & 1 deletion packages/phoenix-evals/src/phoenix/evals/models/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from phoenix.evals.exceptions import PhoenixContextLimitExceeded
from phoenix.evals.models.base import BaseModel
from phoenix.evals.models.rate_limiters import RateLimiter
from phoenix.evals.templates import PromptPartContentType, MultimodalPrompt
from phoenix.evals.templates import MultimodalPrompt, PromptPartContentType

MINIMUM_OPENAI_VERSION = "1.0.0"
MODEL_TOKEN_LIMIT_MAPPING = {
Expand Down
14 changes: 3 additions & 11 deletions packages/phoenix-evals/src/phoenix/evals/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,12 @@ class MultimodalPrompt:
@staticmethod
def from_string(string_prompt: str) -> "MultimodalPrompt":
return MultimodalPrompt(
parts=[
PromptPart(content_type=PromptPartContentType.TEXT, content=string_prompt)
]
parts=[PromptPart(content_type=PromptPartContentType.TEXT, content=string_prompt)]
)

def to_text_only_prompt(self) -> str:
return "\n\n".join(
[
part.content
for part in self.parts
if part.content_type == PromptPartContentType.TEXT
]
[part.content for part in self.parts if part.content_type == PromptPartContentType.TEXT]
)

def __str__(self) -> str:
Expand Down Expand Up @@ -122,9 +116,7 @@ def _normalize_template(
self, template: Union[str, List[PromptPartTemplate]]
) -> List[PromptPartTemplate]:
if isinstance(template, str):
return [
PromptPartTemplate(content_type=PromptPartContentType.TEXT, template=template)
]
return [PromptPartTemplate(content_type=PromptPartContentType.TEXT, template=template)]
return template


Expand Down

0 comments on commit a216250

Please sign in to comment.