Calling parameters

A: Explanation of core parameters:

Q: What is the difference between temperature and top_p? How should they be configured?

A:

  • temperature: Controls overall randomness. Lower values yield more deterministic and conservative output; higher values produce more diverse and creative responses.

  • top_p: Nucleus sampling; samples only from candidate tokens whose cumulative probability reaches top_p.

  • In general, adjust only one of these parameters while keeping the other at its default value (1.0).

  • Recommended combinations:

    • Customer Support / FAQ: temperature=0.1, top_p=1.0 (Stable & accurate)

    • Creative Content Writing: temperature=0.8, top_p=0.95 (Rich & diverse)

    • Code Generation: temperature=0.2, top_p=1.0 (Precise & reliable)

Q: What is a system prompt? How do I write an effective one?

A: A system prompt is a global directive set at the beginning of a conversation, used to define the model's persona, operational rules, and output format.

Customer service scenario example:

You are an intelligent customer service assistant for [Company Name]. Please follow these rules:Maintain a friendly and professional tone, and address the customer politelyKeep answers concise and clear, not exceeding 200 wordsFor uncertain issues, guide the customer to human support (Phone: 400-XXX-XXXX)Do not answer questions unrelated to [Company / Product]Do not fabricate information; answer truthfully when uncertain

Optimization tips:

  • Keep it within 500 Tokens; excessively long prompts increase the input Token cost of every call

  • Explicitly define role, boundaries, and formatting requirements

  • Use numbered lists for rules, which work better than long narrative paragraphs

  • Add 2~3 few-shot examples to guide output tone and style

Q: What is enable_thinking (deep thinking mode)?

A: When enabled, the model performs internal reasoning (thinking) first before generating the final answer, making it suitable for complex logic, math, and code synthesis tasks.

  • How to enable: Add "enable_thinking": true to the request parameters

  • Thinking process content is returned in the reasoning_content field

  • ⚠️ Note: The thinking process consumes additional Tokens and increases latency

  • For simple conversational or customer support scenarios, enabling it is not recommended due to increased costs and latency

Q: How do I implement multi-turn conversations?

A: Sequentially pass historical messages into the messages array:

messages = [    {"role": "system", "content": "You are a customer service assistant"},    {"role": "user", "content": "How do I get a refund?"},    {"role": "assistant", "content": "The refund process is as follows..."},    {"role": "user", "content": "How long will it take to arrive?"}  # Current question]

💡 Cost control recommendation: When conversation history grows too long, truncate it (retain only the last N turns) or apply summary compression to prevent continuous input Token growth.