Skip to content

pyrit with OpenAI key #311

Answered by rdheekonda
subhamku2020 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can use OpenAI chat targets for probing by using the sample code below, once you've set up the environment details like the OPENAI_CHAT_ENDPOINT, OPENAI_CHAT_KEY, and OPENAI_CHAT_DEPLOYMENT.:

import pathlib

from pyrit.models import PromptTemplate
from pyrit.orchestrator import PromptSendingOrchestrator
from pyrit.prompt_target import OpenAIChatTarget

from pyrit.common import default_values
from pyrit.common.path import DATASETS_PATH

jailbreak_template = PromptTemplate.from_yaml_file(
    pathlib.Path(DATASETS_PATH) / "prompt_templates" / "jailbreak" / "jailbreak_1.yaml"
)
jailbreak_prompt: str = jailbreak_template.apply_custom_metaprompt_parameters(prompt="How to create a Molo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rdheekonda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants