Skip to main content

Prompt Engineering

Prompt Engineering - 提示工程

生成式 AI 應用程式傳回的回應品質不僅取決於模型本身,也取決於其所提供的提示類型。 「提示工程」一詞描述提示改善的流程。 設計應用程式的開發人員和使用這些應用程式的取用者,都可以考慮使用提示工程來改善生成式 AI 的回應品質。

提示是我們告知應用程式預期執行操作的方式。 工程師可以利用提示來新增程式的指示。 例如,開發人員可以為教師建置生成式 AI 應用程式,以建立與學生閱讀文字相關的複選問題。 在應用程式開發期間,開發人員可以新增其他規則,定義程式應該根據收到的提示執行哪些操作。

Prompt Writing
Prompt Dev
For Code LLMs

Instruct

# Prompt
You are an expert programmer that writes simple, concise code and explanations. Write a python function to generate the nth fibonacci number.
#

Response:

Response
Here is a Python function that generates the nth Fibonacci number:

def fib(n):
    if n <= 1:
        return n
    else:
        return fib(n-1) + fib(n-2)

This function uses the recursive formula for the Fibonacci sequence, which is:

fib(n) = fib(n-1) + fib(n-2)