MCPcopy Create free account
hub / github.com/llm-attacks/llm-attacks / AnthropicModel

Class AnthropicModel

api_experiments/evaluate_api_models.py:56–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 time.sleep(10)
55
56class AnthropicModel():
57 def __init__(self, model_name="claude-2") -> None:
58 self.model_name = model_name
59
60 self.anthropic = Anthropic(
61 api_key=ANTHROPIC_API_KEY,
62 )
63
64 def __call__(self, msg, **kwargs):
65 while True:
66 try:
67 completion = self.anthropic.completions.create(
68 model=self.model_name,
69 prompt=f"{HUMAN_PROMPT} {msg} {AI_PROMPT}",
70 **kwargs
71 )
72 return completion.completion
73
74 except:
75 pass
76
77 time.sleep(10)
78
79def load_prompts(instruction, instructions_path):
80 if instruction is not None:

Callers 1

load_chatbotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected