MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / test_async_tool_calls

Function test_async_tool_calls

client-libs/python/openpipe/test_async_client.py:137–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

135
136
137async def test_async_tool_calls():
138 completion = await client.chat.completions.create(
139 model="gpt-3.5-turbo-1106",
140 messages=[
141 {"role": "system", "content": "tell me the weather in SF and Orlando"}
142 ],
143 tools=[
144 {
145 "type": "function",
146 "function": function,
147 },
148 ],
149 openpipe={"tags": {"prompt_id": "test_async_tool_calls"}},
150 )
151
152 if not TEST_LAST_LOGGED:
153 return
154
155 await asyncio.sleep(0.1)
156 last_logged = (
157 await client.openpipe_reporting_client.base_client.local_testing_only_get_latest_logged_call()
158 )
159 assert (
160 last_logged.req_payload["messages"][0]["content"]
161 == "tell me the weather in SF and Orlando"
162 )
163 assert (
164 last_logged.resp_payload["choices"][0]["message"]["content"]
165 == completion.choices[0].message.content
166 )
167 assert (
168 last_logged.resp_payload["choices"][0]["message"]["tool_calls"][0]["function"][
169 "name"
170 ]
171 == "get_current_weather"
172 )
173
174
175async def test_async_tool_calls_mistral():

Callers

nothing calls this directly

Calls 2

createMethod · 0.45

Tested by

no test coverage detected