MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / create_conversation

Method create_conversation

tests/performance/test_load.py:151–182  ·  view source on GitHub ↗

Create a conversation for load testing.

(self, participant_count: int = 1)

Source from the content-addressed store, hash-verified

149 self.errors = 0
150
151 async def create_conversation(self, participant_count: int = 1):
152 """Create a conversation for load testing."""
153 try:
154 start_time = time.perf_counter()
155
156 participants = [
157 {"participantId": f"{self.client_id}_user_{i}", "displayName": f"User {i}"}
158 for i in range(participant_count)
159 ]
160
161 response = await self.http_client.post(
162 "/chat/create",
163 json={
164 "title": f"Load Test {self.client_id}",
165 "sites": ["example.com"],
166 "mode": "list",
167 "participant": participants[0],
168 "additional_participants": participants[1:] if len(participants) > 1 else []
169 },
170 headers={"Authorization": f"Bearer token_{self.client_id}"}
171 )
172
173 if response.status_code == 201:
174 data = response.json()
175 self.conversation_id = data["id"]
176
177 end_time = time.perf_counter()
178 return end_time - start_time
179
180 except Exception as e:
181 self.errors += 1
182 return None
183
184 async def send_message(self, content: str):
185 """Send a message in the conversation."""

Callers 4

client_load_patternMethod · 0.45
sustained_client_loadMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected