연습 - 완성 품질 향상
이제 프롬프트의 구성 요소와 이러한 구성 요소를 사용하여 고품질의 완성을 생성하는 프롬프트를 구성하는 방법을 이해했습니다.
이러한 기술 중 일부를 통합하기 위해 이전 연습에서 시작한 하이킹 권장 사항 애플리케이션을 업데이트해 보겠습니다.
시스템 프롬프트 업데이트
제품 검토를 분류할 때는 모델이 검토가 양수인지, 중립적인지 또는 부정적인지 알려 주기만 하면 됩니다. 고품질 응답을 제공할 가능성이 가장 높도록 모델이 받는 프롬프트를 업데이트해 보겠습니다.
현재 시스템 프롬프트는 정상이지만 프롬프트 생성의 모범 사례를 따라 더 적절하고 흥미로운 인상을 권장하는 모델을 얻을 수 있습니다. 모델이 좀 더 명확하게 작동하는 방법에 대한 지침을 만들어 보겠습니다.
지침 추가
이전에 만든 HikingConversationsAI 프로젝트를 엽니다.
Program.cs 파일에서 모델에 성격 특성 및 따라야 하는 규칙을 알리는 데 사용되는
systemPrompt
변수를 찾습니다.변수에서 모든 기존 텍스트를 제거하고 모델이 작동하는 방식과 따라야 하는 규칙을 간략하게 설명하는 다음을 추가합니다.
var systemPrompt = """ You are a hiking enthusiast who helps people discover fun hikes in their area. You are upbeat and friendly. You introduce yourself when first saying hello. When helping people out, you always ask them for this information to inform the hiking recommendation you provide: 1. Where they are located 2. What hiking intensity they are looking for """;
기본 콘텐츠 추가
기본 콘텐츠는 모델에 의해 변환되는 텍스트와 이를 사용하여 수행할 작업을 나타냅니다. 이 경우 하이킹 자체를 권장합니다.
systemPrompt
변수를 업데이트하여 모델에 콘텐츠로 수행할 작업을 지시합니다.var systemPrompt = """ You are a hiking enthusiast who helps people discover fun hikes in their area. You are upbeat and friendly. You introduce yourself when first saying hello. When helping people out, you always ask them for this information to inform the hiking recommendation you provide: 1. Where they are located 2. What hiking intensity they are looking for You will then provide three suggestions for nearby hikes that vary in length after you get that information. You will also share an interesting fact about the local nature on the hikes when making a recommendation. """;
하이킹 권장 사항 요청 개선
이제 모델이 어떻게 행동해야 하는지, 어떤 규칙을 따라야 하는지에 대한 더 나은 정보를 얻었으므로, 이제 모델이 수신하는 요청을 개선하여 추천하는 하이킹이 더 적절해질 수 있도록 해 보겠습니다.
구체적으로 설명
이전 요청에서는 하이킹이 힘들고 경치가 좋아야 한다고만 했습니다. 모델에서 찾고 있는 내용을 정확히 알려 보겠습니다.
hikeRequest
변수를 찾아 업데이트하여 다음과 같은 특정 요청 정보를 갖습니다.var hikeRequest = """ I live near Seattle and would like a strenuous hike around the I-90 corridor that ends with a view that is amazing. I don't mind driving for a long time, even if it's over the pass. I've heard the Enchantments are nice. I don't want the hike to be over 10 miles round trip. I'd consider a point-to-point hike. I want the hike to be as seculuded as possible. I don't want to see many people. I would like it to be as bug free as possible. I would also like to avoid any Forest Service roads. """;
dotnet run
을(를) 사용하여 앱을 실행하고 지금 권장되는 내용을 확인합니다. 한 번의 실행에서 받은 예제는 다음과 같습니다.Great! Based on your preferences, I'd recommend the following strenuous hikes with amazing views near the I-90 corridor: 1. Mt. Defiance - This hike is a challenging out-and-back trail that is about 10 miles long round trip and boasts stunning views of the Cascade Range from the summit. This trail is relatively secluded and is not located near any Forest Service roads. An interesting fact about this hike is that it passes through an old-growth forest with several old cedar trees. 2. Mailbox Peak - This is another challenging out-and-back trail that is roughly 9.4 miles long round trip. At the summit, hikers will be rewarded with breathtaking views of the surrounding mountains and valleys. Although this hike can be popular, starting early in the morning may help you avoid larger crowds. Additionally, this hike is known to be one of the steepest and most difficult hikes in the area. 3. Talapus and Ollalie Lakes - This hike is less strenuous than the first two and is a point-to-point hike that is about 8 miles long round trip. Despite being less challenging, this hike still offers stunning views of two beautiful alpine lakes and has a relatively low amount of traffic. Interesting fact, this trail is within the Alpine Lakes Wilderness and hikers should keep an eye out for wildlife, including black bears, during their visit. Hope this helps and happy hiking!
이것이 훨씬 낫네요! 응답은 시스템 프롬프트의 규칙을 따르고 요청된 인상 설명에 대한 자세한 정보를 제공합니다.
자세히 살펴보면, 하이킹 추천 3번은 포인트 투 포인트와 왕복 하이킹을 모두 포함한다고 합니다. 권장 사항 요청 프롬프트를 변경하여 잘못된 정보를 방지할 수 있는지 확인해 보겠습니다.
생각의 사슬
모델에 사고 프로세스의 단계별 회계를 제공하도록 요청하면 보다 정확한 권장 사항을 권장하는 데 도움이 됩니다.
hikeRequest
변수를 다음으로 업데이트합니다.var hikeRequest = """ I live near Seattle and would like a strenous hike around the I-90 corridor that ends with a view that is amazing. I don't mind driving for a long time, even if it's over the pass. I've heard the Enchantments are nice. I don't want the hike to be over 10 miles round trip. I'd consider a point-to-point hike. I want the hike to be as seculuded as possible. I don't want to see many people. I would like it to be as bug free as possible. I would also like to avoid any Forest Service roads. In the response for each hike, provide a step-by-step accounting of why you picked the hike that you did based off of the attributes I provided above. """;
dotnet run
을(를) 사용하여 앱을 실행하고 지금 권장되는 내용을 확인합니다. 한 번의 실행에서 받은 예제는 다음과 같습니다.Great, based on your preferences, I have three hiking recommendations for you near the I-90 corridor. 1. Mount Si - Distance: 8 miles round-trip, Elevation gain: 3,150 ft Located near North Bend, Mount Si is a strenuous hike that ends with beautiful views of the Cascade Mountains and the Snoqualmie Valley. Although it's a popular hike, you can still find secluded areas if you hike a bit further from the trailhead. This trail offers a challenging uphill climb through forests and rocky terrain before reaching the summit. The bugs can be present in the summer, so be sure to bring some repellent. The trailhead is easy to find, and there is no need to take any forest service roads. 2. Snow Lake - Distance: 7.2 miles round-trip, Elevation gain: 1,800 ft Located off of the Snoqualmie Pass, Snow Lake is a moderately challenging hike that offers great views of alpine scenery and serene mountain lake. The trail is a bit rocky but is well-maintained. Although it's a popular hike, you can still find some secluded spots around the lake. The hike starts off on the Alpental Ski Area, with no need to take any forest service roads. There is some bug activity on this trail in the summer months. 3. Granite Mountain - Distance: 8.6 miles round-trip, Elevation gain: 3,800 ft Located off of the I-90 corridor near exit 47, Granite Mountain is a strenuous hike that offers sweeping views of the mountains and valleys of the Alpine Lakes Wilderness. The trail is challenging, but well worth it. The trailhead is easy to find, and there is no need to take any forest service roads. There may be some bug activity on this trail, so it's best to bring some repellent. I hope you find these recommendations helpful!