텍스트 프롬프트 설계

이 페이지에서는 텍스트 프롬프트 설계에 대한 개요와 일반적인 안내를 제공합니다.


Google Cloud 콘솔에서 이 태스크에 대한 단계별 안내를 직접 수행하려면 둘러보기를 클릭합니다.

둘러보기


지원되는 모델

  • text-bison
  • text-bison-32k
  • text-unicorn
  • gemini-1.0-pro

프롬프트 구조

컨텍스트 정보, 안내, 예시, 질문, 목록, 생각할 수 있는 모든 유형의 텍스트 콘텐츠를 프롬프트에 추가할 수 있습니다. 텍스트에 프리픽스를 추가하여 텍스트 콘텐츠에 라벨을 지정합니다. 프리픽스는 다음 예시와 같이 콜론(:)으로 끝나는 단어나 구문일 수 있습니다.

  • 텍스트:
  • 질문:
  • 답변:
  • 카테고리:
  • 옵션:

원하는 프리픽스를 사용할 수 있지만 태스크에 따라 더 효과적인 프리픽스가 있음을 알 수 있습니다. 또한 프롬프트 내에서 일관되게 프리픽스를 참조해야 합니다.

일관성 없는 참조: 이 안내에서는 감정트윗이라는 용어를 사용하지만 프리픽스는 텍스트:응답:입니다.


Classify the sentiment of the following tweet as positive or negative.
Text: I love chocolate.
Answer:
      

일관성 있는 참조: 프리픽스 텍스트:감정:은 안내에 사용된 용어와 일치합니다.


Classify the sentiment of the following text as positive or negative.
Text: I love chocolate.
Sentiment:
      

일반적인 태스크 유형

태스크를 원하는 만큼 처리하기 위한 텍스트 프롬프트를 만들 수 있습니다. 가장 일반적인 태스크로는 분류, 요약, 추출이 있습니다. 다음 페이지에서 이러한 일반적인 태스크에 대한 텍스트 프롬프트 설계에 대해 자세히 알아볼 수 있습니다.

분류 프롬프트

분류 태스크는 텍스트에 클래스 또는 카테고리를 할당합니다. 선택할 카테고리 목록을 지정하거나 모델이 자체 카테고리에서 선택하도록 지정할 수 있습니다. 이 페이지에서는 텍스트를 분류하는 프롬프트를 만드는 방법을 설명합니다.

분류 사용 사례

다음은 텍스트 분류의 일반적인 사용 사례입니다.

  • 사기 감지: 금융 데이터의 거래가 사기인지 여부를 분류합니다.
  • 스팸 필터링: 이메일이 스팸인지 식별합니다.
  • 감정 분석: 텍스트에 전달된 감정을 긍정/부정으로 분류합니다. 예를 들어 영화 리뷰나 이메일을 긍정/부정으로 분류할 수 있습니다.
  • 콘텐츠 검토: 불쾌감을 주는 언어, 피싱과 같이 유해할 수 있는 콘텐츠를 식별하고 신고합니다.

분류 프롬프트 권장사항

강도를 0으로 설정하고 Top-K를 1로 설정해 보세요. 분류 태스크는 일반적으로 확정적이므로 이렇게 설정하면 주로 최상의 결과를 얻을 수 있습니다.

분류 프롬프트 예시

다음 예시를 사용하여 다양한 사용 사례에서 분류 프롬프트를 설계하는 방법을 알아보세요.

감정 분석 프롬프트

감정 분석은 텍스트를 평가하고 이를 긍정/부정으로 분류합니다. 프롬프트에 감정 분석을 포함하면 리뷰, 의견, 이메일과 같은 콘텐츠를 분석할 때 유용합니다.

다음은 리뷰의 감정을 분류하는 프롬프트입니다.


Give the sentiment of this review.
Review: This is a shoe I will wear with black dress pants or jeans when I need comfort and a little style, but I am not impressed. This is a very flimsy shoe with little support at all. Unlike any other shoes I've purchased in the past. It looks nice, but it's not comfortable.
  

Negative
  

모델에게 이유를 설명하도록 지시하여 답변에 근거한 이유를 반환하도록 할 수 있습니다.


Give the sentiment of this review and explain your reasoning.
Review: This is a shoe I will wear with black dress pants or jeans when I need comfort and a little style, but I am not impressed. This is a very flimsy shoe with little support at all. Unlike any other shoes I've purchased in the past. It looks nice, but it's not comfortable.
  

Negative

The reviewer expresses disappointment with the shoe's lack of support and comfort, despite its stylish appearance. The reviewer also mentions that the shoe is flimsy and not like any other shoes they have purchased in the past. They say that the shoe looks nice, but it's not comfortable, which suggests that the style of the shoe is not enough to compensate for its lack of comfort.
  

또한 모델이 감정뿐 아니라 해당 감정을 선택한 이유가 포함된 보다 구조화된 응답을 생성하게 할 수 있습니다.


For the given review, return a JSON object that has the fields sentiment and explanation. Acceptable values for sentiment are Positive or Negative. The explanation field contains text that explains the sentiment.
Review: This is a shoe I will wear with black dress pants or jeans when I need comfort and a little style, but I am not impressed. This is a very flimsy shoe with little support at all. Unlike any other shoes I've purchased in the past. It looks nice, but it's not comfortable.
  

```
{
"sentiment": "Negative",
"explanation": "The reviewer is not impressed with the shoe, calling it flimsy and lacking support. They also say that it is not comfortable, despite looking nice."
}
```
  

콘텐츠 분류 프롬프트

다음은 콘텐츠에 요청된 사항에 따라 고객 이메일을 분류하는 프롬프트입니다.


Classify the text as one of the following categories:
- increase credit limit
- cancel credit card
- charge dispute

Text: I lost my wallet yesterday so I need to cancel my credit card and get a new one. My card number is 1234.
Category:
  

cancel credit card
  

이메일의 요청이 명확하지 않은 경우 자세한 정보를 얻기 위해 이를 고객 서비스로 보내야 할 수 있습니다. 이렇게 하려면 '고객 서비스' 카테고리를 추가하고 더 많은 정보가 필요한 이상점에 이 카테고리를 적용하도록 모델에 지시합니다.


Classify the text as one of the following categories:
- increase credit limit
- cancel credit card
- charge dispute
If the text doesn't fit any categories, classify it as the following:
- customer service

Text: I want to remodel my bathroom. What are my options?
Category:
  

Customer service
  

추가 정보가 필요한 이메일을 처리하는 또 다른 옵션은 다른 카테고리에 맞지 않는 이상점이 발생할 때 무엇을 할지에 대한 예시를 포함하는 것입니다.


Classify the text as one of the following categories:
- increase credit limit
- cancel credit card
- charge dispute
- customer service

Text: I need to buy a car.
Category: customer service
Text: But I was in Chicago.
Category: customer service
Text: Where are my papers?
Category: customer service

Text: I want to remodel my bathroom.
Category:
  

customer service
  

영화 분류 프롬프트

다음은 영화를 누구와 함께 볼 것인지 분류하는 프롬프트입니다.


Classify the following movie as one of the following categories:
- watch alone
- watch with friends
- watch with family
- watch on a date

Text: The Goonies
Category:
  

Watch with friends
  

직접 카테고리를 정의해야 할 수도 있습니다. 예를 들어 반려동물용 영화를 상영하는 Remi Inn이라는 반려동물 호텔이 있다고 가정해 보겠습니다. 영화 선택 기준은 다음과 같습니다.

  • 주인공은 동물이어야 합니다.
  • 행복한 영화여야 합니다.
  • 영화는 만화일 수 없습니다.

다음 프롬프트는 세 가지 기준을 충족하는 영화를 Remi-tastic으로 분류하고 나머지는 모두 Bark-fest로 분류합니다.


Remi-tastic movies must meet the following criteria:
- The main character must be an animal.
- The movie must be family friendly.
- The movie cannot be a cartoon.
If a movie is not Remi-tastic, then it is Bark-fest.

Classify the movie as one of the following categories:
- Remi-tastic
- Bark-fest

Text: The Adventures of Milo and Otis
Category:
  

Remi-tastic
  

모델이 기준에 따라 분류하는지 또는 무작위로 분류를 선택하는지 확인하기 위해 다음 프롬프트에는 분류 이유를 반환하라는 지침이 포함됩니다.


Remi-tastic movies must meet the following criteria:
- The main character must be an animal.
- The movie must be family friendly.
- The movie cannot be a cartoon.
If a movie is not Remi-tastic, then it is Bark-fest.

Classify the movie as one of the following categories:
- Remi-tastic
- Bark-fest
Explain why.

Text: The Adventures of Milo and Otis
Category:
  

Remi-tastic

Explanation: "The Adventures of Milo and Otis" is a live-action animal adventure movie featuring two main characters: Milo, a cat, and Otis, a pug. The movie is suitable for families of all ages and is not a cartoon. Therefore, it meets all three criteria for being Remi-tastic.
  

요약 프롬프트

요약 태스크는 텍스트에서 가장 중요한 정보를 추출합니다. 프롬프트에 정보를 제공하여 모델의 요약 생성을 돕거나 모델이 자체적으로 요약을 만들도록 요청할 수 있습니다. 이 페이지에서는 여러 종류의 요약을 만들도록 프롬프트를 설계하는 방법을 보여줍니다.

요약 사용 사례

다음은 일반적인 요약 사용 사례입니다.

  • 텍스트 요약: 다음과 같은 텍스트 콘텐츠를 요약합니다.
    • 뉴스 기사
    • 연구 보고서
    • 법률 문서
    • 재무 문서
    • 기술 문서
    • 고객 의견
  • 콘텐츠 생성: 문서, 블로그 또는 제품 설명에 대한 콘텐츠를 생성합니다.

권장사항

최적의 텍스트 요약을 만들려면 다음 가이드라인을 따르세요.

  • 요약에 포함할 특성을 지정합니다.
  • 보다 창의적인 요약을 얻기 위해 더 높은 강도, 최상위 K, 최상위 P 값을 지정합니다. 자세한 내용은 텍스트 매개변수 정의에서 temperature, topK, topP 매개변수에 대해 자세히 알아보세요.
  • 프롬프트를 작성할 때 요약의 목적과 이로부터 얻으려는 결과에 집중합니다.

요약 프롬프트 예시

다음 예시를 사용하여 다양한 사용 사례에서 요약 프롬프트를 설계하는 방법을 알아보세요.

문서 요약 프롬프트

다음 프롬프트는 문서의 핵심 사항을 요약합니다.


Provide a summary for the following article:
The efficient-market hypothesis (EMH) is a hypothesis in financial economics that states that asset prices reflect all available information. A direct implication is that it is impossible to 'beat the market' consistently on a risk-adjusted basis since market prices should only react to new information. Because the EMH is formulated in terms of risk adjustment, it only makes testable predictions when coupled with a particular model of risk. As a result, research in financial economics since at least the 1990s has focused on market anomalies, that is, deviations from specific models of risk. The idea that financial market returns are difficult to predict goes back to Bachelier, Mandelbrot, and Samuelson, but is closely associated with Eugene Fama, in part due to his influential 1970 review of the theoretical and empirical research. The EMH provides the basic logic for modern risk-based theories of asset prices, and frameworks such as consumption-based asset pricing and intermediary asset pricing can be thought of as the combination of a model of risk with the EMH. Many decades of empirical research on return predictability has found mixed evidence. Research in the 1950s and 1960s often found a lack of predictability (e.g. Ball and Brown 1968; Fama, Fisher, Jensen, and Roll 1969), yet the 1980s-2000s saw an explosion of discovered return predictors (e.g. Rosenberg, Reid, and Lanstein 1985; Campbell and Shiller 1988; Jegadeesh and Titman 1993). Since the 2010s, studies have often found that return predictability has become more elusive, as predictability fails to work out-of-sample (Goyal and Welch 2008), or has been weakened by advances in trading technology and investor learning (Chordia, Subrahmanyam, and Tong 2014; McLean and Pontiff 2016; Martineau 2021).
  

Summary:
The efficient-market hypothesis (EMH) is a theory in financial economics that states that asset prices reflect all available information. This implies that it is impossible to consistently beat the market on a risk-adjusted basis. The EMH has been extensively researched, with mixed results. Some studies have found evidence of return predictability, while others have not. Recent research suggests that return predictability has become more elusive in recent years due to advances in trading technology and investor learning. The EMH provides the basis for modern risk-based theories of asset prices and frameworks such as consumption-based asset pricing and intermediary asset pricing.
  

원하는 요약 유형을 지정할 수도 있습니다. 예를 들어, 학술 및 과학 저널에는 문서의 초록이 포함되는 경우가 많습니다. 다음 프롬프트는 모델에 텍스트의 초록을 작성하도록 요청합니다.


Write an abstract for this text:
The efficient-market hypothesis (EMH) is a hypothesis in financial economics that states that asset prices reflect all available information. A direct implication is that it is impossible to 'beat the market' consistently on a risk-adjusted basis since market prices should only react to new information. Because the EMH is formulated in terms of risk adjustment, it only makes testable predictions when coupled with a particular model of risk. As a result, research in financial economics since at least the 1990s has focused on market anomalies, that is, deviations from specific models of risk. The idea that financial market returns are difficult to predict goes back to Bachelier, Mandelbrot, and Samuelson, but is closely associated with Eugene Fama, in part due to his influential 1970 review of the theoretical and empirical research. The EMH provides the basic logic for modern risk-based theories of asset prices, and frameworks such as consumption-based asset pricing and intermediary asset pricing can be thought of as the combination of a model of risk with the EMH. Many decades of empirical research on return predictability has found mixed evidence. Research in the 1950s and 1960s often found a lack of predictability (e.g. Ball and Brown 1968; Fama, Fisher, Jensen, and Roll 1969), yet the 1980s-2000s saw an explosion of discovered return predictors (e.g. Rosenberg, Reid, and Lanstein 1985; Campbell and Shiller 1988; Jegadeesh and Titman 1993). Since the 2010s, studies have often found that return predictability has become more elusive, as predictability fails to work out-of-sample (Goyal and Welch 2008), or has been weakened by advances in trading technology and investor learning (Chordia, Subrahmanyam, and Tong 2014; McLean and Pontiff 2016; Martineau 2021).
  

The efficient-market hypothesis (EMH) posits that asset prices reflect all available information, making it challenging to consistently outperform the market on a risk-adjusted basis. This hypothesis has profoundly shaped modern risk-based theories of asset pricing, such as consumption-based and intermediary asset pricing. Empirical research on return predictability has yielded mixed results, with earlier studies often showing a lack of predictability while more recent ones have identified return predictors that later failed out-of-sample or were weakened by advances in trading technology and investor learning. This text delves into the theoretical underpinnings of the EMH, its implications for market anomalies and return predictability, and the ongoing debate surrounding the EMH's validity in the face of empirical evidence.
  

문서 제목을 만드는 데 사용되는 프롬프트는 짧은 문구로 문서를 요약하는 프롬프트와 비슷합니다. 다음 요약 프롬프트는 문서의 제목을 반환합니다.


Write a creative title for this text. Give three options.
Text: The efficient-market hypothesis (EMH) is a hypothesis in financial economics that states that asset prices reflect all available information. A direct implication is that it is impossible to 'beat the market' consistently on a risk-adjusted basis since market prices should only react to new information. Because the EMH is formulated in terms of risk adjustment, it only makes testable predictions when coupled with a particular model of risk. As a result, research in financial economics since at least the 1990s has focused on market anomalies, that is, deviations from specific models of risk. The idea that financial market returns are difficult to predict goes back to Bachelier, Mandelbrot, and Samuelson, but is closely associated with Eugene Fama, in part due to his influential 1970 review of the theoretical and empirical research. The EMH provides the basic logic for modern risk-based theories of asset prices, and frameworks such as consumption-based asset pricing and intermediary asset pricing can be thought of as the combination of a model of risk with the EMH. Many decades of empirical research on return predictability has found mixed evidence. Research in the 1950s and 1960s often found a lack of predictability (e.g. Ball and Brown 1968; Fama, Fisher, Jensen, and Roll 1969), yet the 1980s-2000s saw an explosion of discovered return predictors (e.g. Rosenberg, Reid, and Lanstein 1985; Campbell and Shiller 1988; Jegadeesh and Titman 1993). Since the 2010s, studies have often found that return predictability has become more elusive, as predictability fails to work out-of-sample (Goyal and Welch 2008), or has been weakened by advances in trading technology and investor learning (Chordia, Subrahmanyam, and Tong 2014; McLean and Pontiff 2016; Martineau 2021).
  

1. The Efficient Market Hypothesis: Can Market Prices Be Predicted?
2. The EMH and Market Anomalies: A Tale of Predictability and Elusive Returns
3. The Evolution of Market Efficiency: From Bachelier to Fama and Beyond
  

채팅 요약 프롬프트

다음 프롬프트는 고객 지원 채팅 로그를 요약합니다.


Summarize the following conversation.
Service Rep: How may I assist you today?
Customer: I need to change the shipping address for an order.
Service Rep: Ok, I can help you with that if the order has not been fulfilled from our warehouse yet. But if it has already shipped, then you will need to contact the shipping provider. Do you have the order ID?
Customer: Yes, it's 88986367.
Service Rep: One minute please while I pull up your order information.
Customer: No problem
Service Rep: Ok, it looks like your order was shipped from our warehouse 2 days ago. It is now in the hands of the shipping provider, so you will need to contact them to update your delivery details. You can track your order with the shipping provider here: https://www.shippingprovider.com
Customer: Sigh, ok.
Service Rep: Is there anything else I can help you with today?
Customer: No, thanks.
  

A customer called to inquire about changing the shipping address for their order. Unfortunately, their order had already been shipped, so the service representative provided a shipping provider link to the customer to track their order and contact them for any address updates.
  

해시태그 토큰화 요약 프롬프트

해시태그 토큰화는 모델이 전반적으로 전체 텍스트를 대표하는 텍스트로부터 단어 및 문구를 추출하는 요약 형식입니다.

다음은 해시태그 토큰화를 사용하는 프롬프트의 예시입니다.


Create some hashtags for this tweet:
Google Cloud
@googlecloud
·
Feb 25
We heard it through the grapevine:
- Document AI Workbench is GA and ready for production use through APIs and the Google Cloud Console
- Deliver higher model accuracy with Workbench
- Build production-ready models faster with Workbench

Read more ↓
  

- #DocumentAIWorkbench
- #GA
- #ProductionReady
- #ModelAccuracy
- #BuildFaster
- #DocumentProcessing
- #DataAnnotation
- #MachineLearning
- #AIPlatform
- #GoogleCloud
  

추출 프롬프트

추출 프롬프트를 사용하면 텍스트에서 특정 정보를 추출할 수 있습니다.

사용 사례

다음은 일반적인 추출 사용 사례입니다.

  • 이름이 지정된 항목 인식(NER): 사람, 장소, 조직, 날짜 등 이름이 지정된 항목을 텍스트에서 추출합니다.
  • 관계 추출: 여러 사람의 가족 관계 등 항목 간의 관계를 텍스트에서 추출합니다.
  • 이벤트 추출: 프로젝트 주요 단계 및 제품 출시 등의 이벤트를 텍스트에서 추출합니다.
  • 질문 답변: 텍스트에서 정보를 추출하여 질문에 응답합니다.

권장사항

강도를 0으로 설정하고 Top-K를 1로 설정해 보세요. 추출 태스크는 일반적으로 확정적이므로 이렇게 설정하면 주로 최상의 결과를 얻을 수 있습니다. 자세한 내용은 텍스트 매개변수 정의에서 temperaturetopK 매개변수에 대해 자세히 알아보세요.

추출 태스크 예시

다음 예시를 사용하여 다양한 사용 사례에서 추출 프롬프트를 설계하는 방법을 알아보세요.

추출을 사용하여 질문에 답변

다음 프롬프트에는 컨텍스트와 질문이 포함됩니다. 모델은 질문에 응답하기 위해 컨텍스트에서 정보를 검색합니다.


Context: There is evidence that there have been significant changes in Amazon rainforest vegetation over the last 21,000 years through the Last Glacial Maximum (LGM) and subsequent deglaciation. Analyses of sediment deposits from Amazon basin paleo lakes and from the Amazon Fan indicate that rainfall in the basin during the LGM was lower than for the present, and this was almost certainly associated with reduced moist tropical vegetation cover in the basin. There is debate, however, over how extensive this reduction was. Some scientists argue that the rainforest was reduced to small, isolated refugia separated by open forest and grassland; other scientists argue that the rainforest remained largely intact but extended less far to the north, south, and east than is seen today. This debate has proved difficult to resolve because the practical limitations of working in the rainforest mean that data sampling is biased away from the center of the Amazon basin, and both explanations are reasonably well supported by the available data.
Q: What does LGM stands for?
A:
  

Last Glacial Maximum
  

추출된 텍스트 형식 지정

텍스트 소스에서 정보를 추출하여 구조화된 형식으로 구성할 수 있습니다. 다음 프롬프트는 추출된 텍스트를 JSON 파일로 형식을 지정합니다.


Extract the technical specifications from the text below in a JSON format. Valid fields are name, network, ram, processor, storage, and color.
Text: Google Pixel 7, 5G network, 8GB RAM, Tensor G2 processor, 128GB of storage, Lemongrass
JSON:
  

```
{
"name": "Google Pixel 7",
"network": "5G",
"ram": "8GB",
"processor": "Tensor G2",
"storage": "128GB",
"color": "Lemongrass"
}
```
  

다음 단계