Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Removed legacy j2 tests #254

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion examples/studio/chat/chat_function_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

from ai21 import AI21Client
from ai21.logger import set_verbose
from ai21.models.chat import ChatMessage, ToolMessage, FunctionToolDefinition, ToolDefinition, ToolParameters
from ai21.models.chat import (
ChatMessage,
FunctionToolDefinition,
ToolDefinition,
ToolMessage,
ToolParameters,
)


set_verbose(True)

Expand Down Expand Up @@ -41,6 +48,7 @@ def get_order_delivery_date(order_id: str) -> str:

response = client.chat.completions.create(messages=messages, model="jamba-1.5-large", tools=tools)

print(response.usage.prompt_tokens)
""" AI models can be error-prone, it's crucial to ensure that the tool calls align with the expectations.
The below code snippet demonstrates how to handle tool calls in the response and invoke the tool function
to get the delivery date for the user's order. After retrieving the delivery date, we pass the response back
Expand Down Expand Up @@ -74,3 +82,5 @@ def get_order_delivery_date(order_id: str) -> str:

response = client.chat.completions.create(messages=messages, model="jamba-1.5-large", tools=tools)
print(response.choices[0].message.content)

print(response.usage.prompt_tokens)
177 changes: 0 additions & 177 deletions tests/integration_tests/clients/studio/test_chat.py

This file was deleted.

6 changes: 3 additions & 3 deletions tests/integration_tests/clients/test_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
Run this script after setting the environment variable called AI21_API_KEY
"""

import subprocess

from pathlib import Path
from time import sleep

import pytest
import subprocess

from tests.integration_tests.skip_helpers import should_skip_studio_integration_tests


STUDIO_PATH = Path(__file__).parent.parent.parent.parent / "examples" / "studio"


Expand Down Expand Up @@ -50,14 +52,12 @@ def test_studio(test_file_name: str):
@pytest.mark.parametrize(
argnames=["test_file_name"],
argvalues=[
("async_chat.py",),
("chat/async_chat_completions.py",),
("chat/async_stream_chat_completions.py",),
("conversational_rag/conversational_rag.py",),
("conversational_rag/async_conversational_rag.py",),
],
ids=[
"when_chat__should_return_ok",
"when_chat_completions__should_return_ok",
"when_stream_chat_completions__should_return_ok",
"when_conversational_rag__should_return_ok",
Expand Down
Loading