cuery.call#
Wrappers to call instructor with a cuery.Prompt, cuery.Response and context.
Attributes#
On Apify log each tqdm update on a separate line (line breaks trigger log updates). |
Functions#
|
Prompt once with the given Prompt and context (validated). |
|
Sequential iteration of prompt over iterable contexts. |
|
|
|
Async iteration of prompt over iterable contexts. |
Module Contents#
- cuery.call.TQDM_POSITION = -1#
On Apify log each tqdm update on a separate line (line breaks trigger log updates).
- async cuery.call.call(client, prompt, context, response_model, fallback=True, log_prompt=False, log_response=False, **kwds)#
Prompt once with the given Prompt and context (validated).
If fallback is True, will return result of response_model.fallback() if the call fails.
- Parameters:
client (instructor.Instructor)
prompt (cuery.prompt.Prompt)
context (dict | None)
response_model (cuery.response.ResponseClass)
fallback (bool)
log_prompt (bool)
log_response (bool)
- Return type:
- async cuery.call.iter_calls(client, prompt, context, response_model, callback=None, progress_callback=None, **kwds)#
Sequential iteration of prompt over iterable contexts.
- Parameters:
client (instructor.Instructor)
prompt (cuery.prompt.Prompt)
context (dict | list[dict] | pandas.DataFrame)
response_model (cuery.response.ResponseClass)
callback (collections.abc.Callable[[cuery.response.Response, cuery.prompt.Prompt, dict], None] | None)
progress_callback (collections.abc.Callable | None)
- Return type:
list[cuery.response.Response]
- async cuery.call.rate_limited(func, sem, **kwds)#
- Parameters:
func (collections.abc.Callable)
sem (asyncio.Semaphore)
- async cuery.call.gather_calls(client, prompt, context, response_model, max_concurrent=2, progress_callback=None, **kwds)#
Async iteration of prompt over iterable contexts.
- Parameters:
client (instructor.Instructor)
prompt (cuery.prompt.Prompt)
context (dict | list[dict] | pandas.DataFrame)
response_model (cuery.response.ResponseClass)
max_concurrent (int)
progress_callback (collections.abc.Coroutine | None)
- Return type:
list[cuery.response.Response]