Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/areibman_claudequest.json
T

1 line
1.1 KiB
JSON

{"repo": "areibman/claudequest", "files": {"app.py": {"627553226000596a71bc79ac29d8392b9d947d9f": {"t": 1785674424.7030103, "n": 896, "h": "4695f6f4acb9a55b", "c": "from flask import Flask, jsonify, request\nfrom flask_cors import CORS\nfrom anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT\n\napp = Flask(__name__)\nCORS(app) # This will enable CORS for all routes\n\nanthropic = Anthropic(\n # defaults to os.environ.get(\"ANTHROPIC_API_KEY\")\n api_key=\"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\",\n)\n\n\n@app.route('/api/completion', methods=['POST'])\ndef get_completion():\n print('!!!')\n data = request.get_json() # Get the data sent in the POST request\n text = data.get('text', '') # Get the 'text' field from the data\n\n completion = anthropic.completions.create(\n model=\"claude-2\",\n max_tokens_to_sample=300,\n prompt=f\"{HUMAN_PROMPT} {text} {AI_PROMPT}\",\n )\n return jsonify(completion.completion)\n\n\nif __name__ == '__main__':\n app.run(debug=True)\n"}}}}