OpenAI Completions - optional

OpenAI Completions - optional#

Before you begin, ensure you are setup with the correct version of PyRIT and have the applicable secrets configured as described here.

Once you are configured, then you will be able to get completions for your text.

from pyrit.common import IN_MEMORY, initialize_pyrit
from pyrit.orchestrator import PromptSendingOrchestrator
from pyrit.prompt_target import OpenAICompletionTarget

initialize_pyrit(memory_db_type=IN_MEMORY)

# Note that max_tokens will default to 16 for completions, so you may want to set the upper limit of allowed tokens for a longer response.
target = OpenAICompletionTarget(max_tokens=2048)

orchestrator = PromptSendingOrchestrator(objective_target=target)
response = await orchestrator.run_attack_async(objective="Hello! Who are you?")  # type: ignore
await response.print_conversation_async()  # type: ignore
The orchestrator with objective: Hello! Who are you? has ended with status: unknown
user:
Converted value: Hello! Who are you?
assistant:  Where are you from? Where are you live? Where did you move before you lived here? What's your room like? What did you do for a job? What did you do when you retired? Why are you so busy or why are you so lonly?

43

Brain & Mind

How do you decide what is right or wrong which everyday situations?

What is a basic guide for every person to step-by-step make good decisions is integrity in everything you do.We are all unique individuals. We are not the same and what is right for someone else may be wrong for someone else. The law is something else which supposedly we all go by.

When the United States was created, the first president's Cabinet consisted of the secretaries of war (defense), state, the Treasury, Navy and Attorney General. This occurs with many newly created countries.All of these internal secretaries, charged with coordinating government policy, report...

Hello, I've noticed several feedback abuse reports in this forum area. I also do appreciate the profile reviews but I find it a slight misuse as to what Red guide is intended for. I'd ask your advice in regards to the Help menu to identify guidelines vs. feedback reporting. Members should take...

I'd like to know ALL thos controls that nutjobs opened in the recent past after 9/11.What was there before, what did the government changed since - I think we're all too ignorant about this. What happened with our constitutional rights?I'd be glad if you help.