tomo2chin2 commited on
Commit
c30b4d7
·
verified ·
1 Parent(s): adc494a

Update app.py with YAML to PDF conversion via Gemini API

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -44,7 +44,7 @@ async def call_gemini_api(yaml_content: str) -> str:
44
  if not gemini_api_key:
45
  raise HTTPException(status_code=500, detail="GEMINI_API_KEY環境変数が設定されていません")
46
 
47
- # Gemini APIリクエストボディを構築
48
  request_body = {
49
  "contents": [
50
  {
@@ -59,7 +59,10 @@ async def call_gemini_api(yaml_content: str) -> str:
59
  "role": "model",
60
  "parts": [
61
  {
62
- "text": "はい、システムインストラクションとして認識しました。\nYAMLデータを基にHTMLを生成いたします。"
 
 
 
63
  },
64
  ]
65
  },
@@ -67,13 +70,16 @@ async def call_gemini_api(yaml_content: str) -> str:
67
  "role": "user",
68
  "parts": [
69
  {
70
- "text": yaml_content
71
  },
72
  ]
73
  },
74
  ],
75
  "generationConfig": {
76
  "temperature": 0.75,
 
 
 
77
  "responseMimeType": "text/plain",
78
  },
79
  }
 
44
  if not gemini_api_key:
45
  raise HTTPException(status_code=500, detail="GEMINI_API_KEY環境変数が設定されていません")
46
 
47
+ # Gemini APIリクエストボディを構築(GEMINIサンプル.txtの形式に従う)
48
  request_body = {
49
  "contents": [
50
  {
 
59
  "role": "model",
60
  "parts": [
61
  {
62
+ "text": "**Examining Input Types**\n\nI'm currently focused on the distinct roles of \"system input\" and \"user input.\" My aim is to clearly identify how each input type influences the model's output. Initial analysis suggests that content following \"**[system instruction here]**\" will be the output that follows that system instruction. The system instruction appears to shape the model's behavior.\n\n\n**Defining Response Strategy**\n\nI'm now formulating a response strategy that considers both system and user inputs. The goal is to ensure the model distinguishes the roles of each. It seems \"System input\" acts as a directive influencing the overall output, while \"User input\" warrants a direct response. Initial ideas include acknowledging system instructions and directly addressing user queries. I'm exploring various response types, such as \"Acknowledged,\" \"Understood,\" or a direct response.\n\n\n**Interpreting Input Roles**\n\nI'm now focusing on distinguishing the roles of system and user inputs. The goal is to ensure the model responds appropriately to each. I've begun framing responses like, \"Acknowledged, and here's the user input,\" or \"Understood the system instruction.\" These responses acknowledge the system instruction's nature and the user query directly. I'm aiming for clarity in differentiating roles and seamless, natural interactions.\n\n\n**Developing a Combined Response**\n\nI'm now integrating system and user input responses. I acknowledge the system instruction, followed by addressing the user input. My current iteration is, \"Understood the system instruction,\" then I'll follow up with, \"Here is the user input; what can I help with?\" I've made sure to explicitly address both inputs as distinct and respond appropriately. I aim for clarity and brevity in my final response.\n\n\n**Formulating a Combined Response**\n\nI've revised my response strategy to be more concise and clear. The new approach acknowledges the system instruction directly: \"Acknowledged the system instruction.\" Then, I'll move on to addressing the user input, by using a form: \"Here is the user input: ...\" to facilitate seamless and natural interactions. I'm aiming for clarity in distinguishing roles. This should clearly indicate the role of each input and how the system is processing it.\n\n\n**Responding to Inputs**\n\nI've refined the approach to directly acknowledge \"system instructions\" and \"user inputs.\" I now understand that distinguishing between these is key. My latest strategy involves addressing \"system input\" with a clear acknowledgment: \"I understand the system instruction.\" Then, I'll identify and address the user's input, asking \"Here's the user input; what can I assist with?\" I believe this clarity ensures accurate interpretation.\n\n\n"
63
+ },
64
+ {
65
+ "text": "はい、システムインストラクションとして認識しました。\nこちらはユーザーからの入力ですね。何かお手伝いできることはありますか?"
66
  },
67
  ]
68
  },
 
70
  "role": "user",
71
  "parts": [
72
  {
73
+ "text": yaml_content # YAMLコンテンツをそのまま代入
74
  },
75
  ]
76
  },
77
  ],
78
  "generationConfig": {
79
  "temperature": 0.75,
80
+ "thinkingConfig": {
81
+ "thinkingBudget": -1,
82
+ },
83
  "responseMimeType": "text/plain",
84
  },
85
  }