MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / verify

Method verify

plugin/bundles/stability_ai/bundle.py:8–36  ·  view source on GitHub ↗
(self, credentials: BundleCredentials)

Source from the content-addressed store, hash-verified

6
7class StabilityAi(BundleHandler):
8 async def verify(self, credentials: BundleCredentials):
9 prompt: str = "a cartoon styled image of a cat playing tennis against a dog"
10 engine_id: str = "stable-diffusion-v1-6"
11 steps: int = 30
12 cfg_scale: int = 7
13 height: int = 512
14 width: int = 512
15
16 stability_ai_api_key: str = credentials.credentials.get("STABILITY_AI_API_KEY")
17
18 url = f"https://api.stability.ai/v1/generation/{engine_id}/text-to-image"
19
20 headers = {"Content-Type": "application/json", "Authorization": f"Bearer {stability_ai_api_key}"}
21
22 data = {
23 "text_prompts": [{"text": prompt}],
24 "steps": steps,
25 "cfg_scale": cfg_scale,
26 "height": height,
27 "width": width,
28 "samples": 1,
29 }
30
31 async with ClientSession() as session:
32 async with session.post(url=url, headers=headers, json=data, proxy=CONFIG.PROXY) as response:
33 if response.status == 200:
34 pass
35 else:
36 raise_credentials_validation_error()

Callers

nothing calls this directly

Calls 2

getMethod · 0.45

Tested by

no test coverage detected