Skip to content

Commit 4bbfec4

Browse files
author
Val Brodsky
committed
More tests (squash)
1 parent a2e0ca4 commit 4bbfec4

File tree

1 file changed

+130
-3
lines changed

1 file changed

+130
-3
lines changed
Lines changed: 130 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,127 @@
1-
def test_create_offline_chat_evaluation_project(client,
2-
offline_chat_evaluation_project,
3-
chat_evaluation_ontology):
1+
import pytest
2+
3+
4+
@pytest.fixture
5+
def offline_conversational_data_row(initial_dataset):
6+
convo_v2_row_data = {
7+
"type": "application/vnd.labelbox.conversational.model-chat-evaluation",
8+
"version": 2,
9+
"actors": {
10+
"clxhs9wk000013b6w7imiz0h8": {
11+
"role": "human",
12+
"metadata": {
13+
"name": "User"
14+
}
15+
},
16+
"clxhsc6xb00013b6w1awh579j": {
17+
"role": "model",
18+
"metadata": {
19+
"modelConfigId": "5a50d319-56bd-405d-87bb-4442daea0d0f"
20+
}
21+
},
22+
"clxhsc6xb00023b6wlp0768zs": {
23+
"role": "model",
24+
"metadata": {
25+
"modelConfigId": "1cfc833a-2684-47df-95ac-bb7d9f9e3e1f"
26+
}
27+
}
28+
},
29+
"messages": {
30+
"clxhs9wk000023b6wrufora3k": {
31+
"actorId": "clxhs9wk000013b6w7imiz0h8",
32+
"content": [{
33+
"type": "text",
34+
"content": "Hello world"
35+
}],
36+
"childMessageIds": ["clxhscb4z00033b6wukpvmuol"]
37+
},
38+
"clxhscb4z00033b6wukpvmuol": {
39+
"actorId": "clxhsc6xb00013b6w1awh579j",
40+
"content": [{
41+
"type":
42+
"text",
43+
"content":
44+
"Hello to you too! 👋 \n\nIt's great to be your guide in the digital world. What can I help you with today? 😊 \n"
45+
}],
46+
"childMessageIds": ["clxhu2s0900013b6wbv0ndddd"]
47+
},
48+
"clxhu2s0900013b6wbv0ndddd": {
49+
"actorId":
50+
"clxhs9wk000013b6w7imiz0h8",
51+
"content": [{
52+
"type": "text",
53+
"content": "Lets some some multi-turn happening"
54+
}],
55+
"childMessageIds": [
56+
"clxhu4qib00023b6wuep47b1l", "clxhu4qib00033b6wf18az01q"
57+
]
58+
},
59+
"clxhu4qib00023b6wuep47b1l": {
60+
"actorId": "clxhsc6xb00013b6w1awh579j",
61+
"content": [{
62+
"type":
63+
"text",
64+
"content":
65+
"Okay, I'm ready for some multi-turn fun! To make it interesting, how about we try building a story together? \n\n**Here's the beginning:**\n\nThe old, dusty book lay forgotten on the shelf, its leather cover cracked and faded. But as the afternoon sun slanted through the window, a single ray caught a glint of gold on the book's spine. Suddenly...\n\n**Now you tell me what happens!** What does the glint of gold turn out to be? What happens next? 🤔 \n"
66+
}],
67+
"childMessageIds": ["clxhu596m00043b6wvkgahcwz"]
68+
},
69+
"clxhu4qib00033b6wf18az01q": {
70+
"actorId": "clxhsc6xb00023b6wlp0768zs",
71+
"content": [{
72+
"type":
73+
"text",
74+
"content":
75+
"Okay, I'm game! Let's have a multi-turn conversation! But to get us started, give me a topic or a question to get us going! 😄 \n\nWhat's on your mind? \n"
76+
}],
77+
"childMessageIds": ["clxhu596m00043b6wvkgahcwz"]
78+
},
79+
"clxhu596m00043b6wvkgahcwz": {
80+
"actorId":
81+
"clxhs9wk000013b6w7imiz0h8",
82+
"content": [{
83+
"type": "text",
84+
"content": "Can you generate an image?"
85+
}],
86+
"childMessageIds": [
87+
"clxhu5hqk00053b6wk21u6xi7", "clxhu5hqk00063b6whl4gofx8"
88+
]
89+
},
90+
"clxhu5hqk00053b6wk21u6xi7": {
91+
"actorId": "clxhsc6xb00013b6w1awh579j",
92+
"content": [{
93+
"type":
94+
"text",
95+
"content":
96+
"I can't generate images directly yet. I'm a text-based AI, so my superpowers are all about words! 🪄 \n\nHowever, I'd love to help you describe an image that fits our story. Tell me: \n\n* **What should the image show?** (For example: The dusty book, the glint of gold, the bookshelf, the room, etc.) \n* **What kind of feeling or atmosphere should the image have?** (Mysterious? Magical? Ominous?) \n\nThe more details you give me, the better I can describe the image! ✨ \n"
97+
}],
98+
"childMessageIds": []
99+
},
100+
"clxhu5hqk00063b6whl4gofx8": {
101+
"actorId": "clxhsc6xb00023b6wlp0768zs",
102+
"content": [{
103+
"type":
104+
"text",
105+
"content":
106+
"I can't *actually* generate images directly. 😔 I'm primarily a text-based AI. \n\nTo help me understand what you'd like to see, tell me: \n\n* **What should be in the image?** Be specific! (e.g., \"A cat wearing a tiny hat\", \"A futuristic cityscape at sunset\")\n* **What style do you imagine?** (e.g., realistic, cartoonish, abstract)\n\nOnce you give me those details, I can try to give you a vivid description that's almost as good as seeing it! 😊 \n"
107+
}],
108+
"childMessageIds": []
109+
}
110+
},
111+
"rootMessageIds": ["clxhs9wk000023b6wrufora3k"]
112+
}
113+
114+
convo_v2_asset = {
115+
"row_data": convo_v2_row_data,
116+
}
117+
data_row = initial_dataset.create_data_row(convo_v2_asset)
118+
119+
return data_row
120+
121+
122+
def test_create_offline_chat_evaluation_project(
123+
client, rand_gen, offline_chat_evaluation_project,
124+
chat_evaluation_ontology, offline_conversational_data_row):
4125
project = offline_chat_evaluation_project
5126
assert project
6127

@@ -9,3 +130,9 @@ def test_create_offline_chat_evaluation_project(client,
9130

10131
assert project.labeling_frontend().name == "Editor"
11132
assert project.ontology().name == ontology.name
133+
134+
batch = project.create_batch(
135+
rand_gen(str),
136+
[offline_conversational_data_row.uid], # sample of data row objects
137+
)
138+
assert batch

0 commit comments

Comments
 (0)