AI 품질 검토 : AI를 사용하여 응용 프로그램 품질을 향상시킵니다
이 기사는 GPT 모델을 사용하여 GPT 기반 애플리케이션을 감사하는 기술을 심층적으로 탐색합니다.
예제 제품 카탈로그 에이전트를 비즈니스 범위로 제한합니다. 제품 카탈로그를 모델에 제공함으로써 모델에 사용자에게 어떤 정보를 제공할지 알 수 있습니다.
이 시점에서 샘플 고객 챗봇을 다음과 같이 사용할 수 있습니다.
수제 사진. 각 에이전트에 대한 3 개의 빌딩 블록 다이어그램 : 시스템 메시지 (파란색), 모델 입력 (녹색) 및 모델 출력 (노란색). 다음은 무엇입니까? 수제 사진. 확장 감사 워크 플로우 다이어그램. QA 프록시 판단을 사용하여 LLM 기반 애플리케이션에 피드백을 제공 할 수 있습니다.
예를 들어
a 는 모델의 고급 동작을 정의하는 데 사용됩니다. GPT 모델은 종종 여러 작업에 대해 교육을받지 만 소위 시스템 메시지를 사용하여 모델의 동작을 제한 할 수 있습니다.
<code>import openai
import os
# 从环境中获取 OpenAI 密钥
openai_api_key = os.environ["OPENAI_API_KEY"]
# 使用过去交互记忆的简单 OpenAI API 调用
def gpt_call(prompt, message_history, model="gpt-3.5-turbo"):
message_history.append({'role': 'user', 'content': prompt})
response = openai.ChatCompletion.create(
model=model,
messages=message_history
)
response_text = response.choices[0].message["content"]
message_history.append({'role': 'assistant', 'content': response_text})
return response_text</code>
공정합니다! <code># 定义我们的示例产品目录
product_information = """
{ "name": "UltraView QLED TV", "category": "Televisions and Home Theater Systems", "brand": "UltraView", "model_number": "UV-QLED65", "warranty": "3 years", "rating": 4.9, "features": [ "65-inch QLED display", "8K resolution", "Quantum HDR", "Dolby Vision", "Smart TV" ], "description": "Experience lifelike colors and incredible clarity with this high-end QLED TV.", "price": 2499.99 }
{ "name": "ViewTech Android TV", "category": "Televisions and Home Theater Systems", "brand": "ViewTech", "model_number": "VT-ATV55", "warranty": "2 years", "rating": 4.7, "features": [ "55-inch 4K display", "Android TV OS", "Voice remote", "Chromecast built-in" ], "description": "Access your favorite apps and content on this smart Android TV.", "price": 799.99 }
{ "name": "SlimView OLED TV", "category": "Televisions and Home Theater Systems", "brand": "SlimView", "model_number": "SL-OLED75", "warranty": "2 years", "rating": 4.8, "features": [ "75-inch OLED display", "4K resolution", "HDR10+", "Dolby Atmos", "Smart TV" ], "description": "Immerse yourself in a theater-like experience with this ultra-thin OLED TV.", "price": 3499.99 }
{ "name": "TechGen X Pro", "category": "Smartphones and Accessories", "brand": "TechGen", "model_number": "TG-XP20", "warranty": "1 year", "rating": 4.5, "features": [ "6.4-inch AMOLED display", "128GB storage", "48MP triple camera", "5G", "Fast charging" ], "description": "A feature-packed smartphone designed for power users and mobile enthusiasts.", "price": 899.99 }
{ "name": "GigaPhone 12X", "category": "Smartphones and Accessories", "brand": "GigaPhone", "model_number": "GP-12X", "warranty": "2 years", "rating": 4.6, "features": [ "6.7-inch IPS display", "256GB storage", "108MP quad camera", "5G", "Wireless charging" ], "description": "Unleash the power of 5G and high-resolution photography with the GigaPhone 12X.", "price": 1199.99 }
{ "name": "Zephyr Z1", "category": "Smartphones and Accessories", "brand": "Zephyr", "model_number": "ZP-Z1", "warranty": "1 year", "rating": 4.4, "features": [ "6.2-inch LCD display", "64GB storage", "16MP dual camera", "4G LTE", "Long battery life" ], "description": "A budget-friendly smartphone with reliable performance for everyday use.", "price": 349.99 }
{ "name": "PixelMaster Pro DSLR", "category": "Cameras and Camcorders", "brand": "PixelMaster", "model_number": "PM-DSLR500", "warranty": "2 years", "rating": 4.8, "features": [ "30.4MP full-frame sensor", "4K video", "Dual Pixel AF", "3.2-inch touchscreen" ], "description": "Unleash your creativity with this professional-grade DSLR camera.", "price": 1999.99 }
{ "name": "ActionX Waterproof Camera", "category": "Cameras and Camcorders", "brand": "ActionX", "model_number": "AX-WPC100", "warranty": "1 year", "rating": 4.6, "features": [ "20MP sensor", "4K video", "Waterproof up to 50m", "Wi-Fi connectivity" ], "description": "Capture your adventures with this rugged and versatile action camera.", "price": 299.99 }
{ "name": "SonicBlast Wireless Headphones", "category": "Audio and Headphones", "brand": "SonicBlast", "model_number": "SB-WH200", "warranty": "1 year", "rating": 4.7, "features": [ "Active noise cancellation", "50mm drivers", "30-hour battery life", "Comfortable earpads" ], "description": "Immerse yourself in superior sound quality with these wireless headphones.", "price": 149.99 }
"""
# 为我们的用例定义一个合适的系统消息
customer_agent_sysmessage = f"""
您是一位客户服务代理,负责回答客户关于产品目录中产品的疑问。
产品目录将用三个反引号分隔,即 ```。
以友好和人性化的语气回复,并提供产品目录中可用的详细信息。
产品目录: ```{product_information}```
"""
# 初始化模型的记忆
customer_agent_history = [{'role': 'system', 'content': customer_agent_sysmessage}]</code>
, 경우에 따라 프록시가 디렉토리의 정보를 건너 뛸 수있는 것 같습니다. 이 경우 QA 프록시는 원치 않는 응답을 필터링하는 데 도움이 될 수 있습니다. 우리의 맞춤형 QA 에이전트 를 개발하십시오
<code>user_prompt = "你们商店里最好的电视是什么?"
customer_agent_response = gpt_call(user_prompt, customer_agent_history)
print(customer_agent_response)
# 输出:在我们商店里,UltraView QLED 电视被认为是最好的电视。它的评分为 4.9,并提供 65 英寸 QLED 显示屏和 8K 分辨率。它还具有 Quantum HDR、Dolby Vision 和智能电视功能。凭借其逼真的色彩和令人难以置信的清晰度,这款高端 QLED 电视可提供身临其境的观看体验。UltraView QLED 电视的价格为 2499.99 美元,并提供 3 年保修。</code>
.
<:> QA 에이전트 : "품질 검사 : 잘못된 응답 피드백 : 고객은 삼성 TV 구매에 도움을 요청했지만 에이전트는 요청을 처리하지 않았습니다. 대리인은 우리 매장의 제품 카탈로그에만 액세스 할 수 있으며 해당 디렉토리를 기반으로 정보와 조언을 제공 할 수 있다고 언급해야합니다. 대리인은 디렉토리 외부의 다른 제품을 부드럽게 거부해야합니다.
QA 프록시를 필터로 사용하려면 각 반복에서 일관된 응답을 출력해야합니다.
위 내용은 GPT 모델로 Chatgpt 응답 조정에 대한 포괄적 인 가이드의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!