Closed zsimjee closed 1 year ago
Also facing this issue when integrating with LangChain GuardRailsOutputParser
to create an output parser and giving it the raw JSON answer of a faiss vectorstore guided LLM.
Facing this issue on all examples docs and on version 0.2.1 as well.
This warning is triggered whenever you're invoking guardrails synchronously in the presence of an async event loop.
Jupyter automatically creates an async eventloop, and lets you await
things in notebook cells.
Try using this instead:
raw_llm_response, validated_response = await guard(
openai.Completion.acreate,
engine="text-davinci-003",
max_tokens=2048,
temperature=0
)
Notice the use of await
and openai.Completion.acreate
instead of openai.Completion.create
.
release will be out in pre-release 0.2.2-alpha1 today and as a patch deployment 0.2.3 next week
Describe the bug Warning on default behavior in step 3 of the recipe generation notebook - 'Async event loop found, but guard was invoked synchronously.For validator parallelization, please call
validate_async
instead.'To Reproduce Steps to reproduce the behavior:
Expected behavior Shouldn't warn on async/sync conflicts when using standard validators and railspecs
Library version: 0.2.0
Additional context Add any other context about the problem here.