1. Learn
  2. /
  3. คอร์ส
  4. /
  5. OpenAI API로 시작하는 임베딩 Introduction

Connected

แบบฝึกหัด

임베딩 고도화

이전에 상품 정보를 임베딩할 때는 상품의 'short_description'만 임베딩할 수 있었기 때문에, 유의미한 정보가 일부만 반영되었어요. 이번 연습에서는 더 많은 정보를 담기 위해 'title', 'short_description', 'category', 'features'를 함께 임베딩해 볼 거예요.

다음은 products 딕셔너리 리스트 예시예요:

products = [
    {
        "title": "Smartphone X1",
        "short_description": "The latest flagship smartphone with AI-powered features and 5G connectivity.",
        "price": 799.99,
        "category": "Electronics",
        "features": [
            "6.5-inch AMOLED display",
            "Quad-camera system with 48MP main sensor",
            "Face recognition and fingerprint sensor",
            "Fast wireless charging"
        ]
    },
    ...
]

여러 특성을 하나의 문자열로 합칠 때는 다음 구조를 따라야 해요:

Title: <product title>
Description: <product description>
Category: <product category>
Features: <feature 1>; <feature 2>; <feature 3>; ...

คำแนะนำ

100 XP
  • create_product_text()라는 함수를 정의해 title, short_description, category, features 데이터를 원하는 형식의 하나의 문자열로 결합하세요.
  • create_product_text()를 사용해 products의 각 상품 특성을 결합하고, 결과를 리스트에 저장하세요.
  • product_texts의 텍스트를 임베딩하세요.