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

Function test_sync_tool_calls

client-libs/python/openpipe/test_sync_client.py:142–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

createMethod · 0.45

Tested by

no test coverage detected