import os
from google import genai
from google.genai import types
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/Users/yanghyojun/Downloads/mystic-subject-478505-r7-330480ad8816.json"
def generate(text: str = ""):
client = genai.Client(
vertexai=True,
project="mystic-subject-478505-r7",
# a계정 My frist project
location="global",
)
model = "gemini-2.5-flash-lite"
contents = [
types.Content(
role="user",
parts=[types.Part(
text = text
)]
)
]
generate_content_config = types.GenerateContentConfig(
temperature = 1,
top_p = 0.95,
max_output_tokens = 65535,
safety_settings = [types.SafetySetting(
category="HARM_CATEGORY_HATE_SPEECH",
threshold="OFF"
),types.SafetySetting(
category="HARM_CATEGORY_DANGEROUS_CONTENT",
threshold="OFF"
),types.SafetySetting(
category="HARM_CATEGORY_SEXUALLY_EXPLICIT",
threshold="OFF"
),types.SafetySetting(
category="HARM_CATEGORY_HARASSMENT",
threshold="OFF"
)],
thinking_config=types.ThinkingConfig(
thinking_budget=0,
),
)
response = client.models.generate_content(
model = model,
contents = contents,
config = generate_content_config,
)
return response.text