> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-update-reference-docs-40.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 모델로 애플리케이션 버전 추적하기

> 데이터와 코드를 결합한 구조화된 모델로 애플리케이션 버전을 추적합니다.

`Model`은 데이터(설정, 트레이닝된 모델 가중치, 기타 정보를 포함할 수 있음)와 모델의 동작 방식을 정의하는 코드의 조합입니다. 이 API와 호환되도록 코드를 구조화하면 애플리케이션을 구조적으로 버전 관리할 수 있어 실험을 더 체계적으로 추적할 수 있습니다.

<Tabs>
  <Tab title="Python">
    Weave에서 모델을 생성하려면 다음이 필요합니다:

    * `weave.Model`을 상속하는 클래스
    * 모든 파라미터에 대한 유형 정의
    * `@weave.op()` 데코레이터가 적용된, 타입이 지정된 `predict` 함수

    ```python lines theme={null}
    from weave import Model
    import weave

    class YourModel(Model):
        attribute1: str
        attribute2: int

        @weave.op()
        def predict(self, input_data: str) -> dict:
            # 모델 로직은 여기에 들어갑니다
            prediction = self.attribute1 + ' ' + input_data
            return {'pred': prediction}
    ```

    다음과 같이 평소처럼 모델을 호출할 수 있습니다:

    ```python lines theme={null}
    import weave
    weave.init('intro-example')

    model = YourModel(attribute1='hello', attribute2=5)
    model.predict('world')
    ```

    이렇게 하면 `predict()`를 호출할 때마다 입력과 출력과 함께 모델 설정도 추적됩니다.

    ## 모델 자동 버전 관리

    모델을 정의하는 파라미터나 코드를 변경하면 이러한 변경 사항이 로깅되고 버전이 업데이트됩니다.
    이를 통해 모델의 서로 다른 버전에서 예측을 비교할 수 있습니다. 이를 사용해 프롬프트를 반복적으로 개선하거나 최신 LLM을 사용해 보고, 서로 다른 설정에서 예측을 비교할 수 있습니다.

    예를 들어, 여기서는 새 모델을 생성합니다:

    ```python lines theme={null}
    import weave
    weave.init('intro-example')

    model = YourModel(attribute1='howdy', attribute2=10)
    model.predict('world')
    ```

    이 코드를 호출한 후에는 UI에서 서로 다른 call이 추적된 이 Model의 두 버전을 확인할 수 있습니다.

    ## 모델 서빙

    모델을 서빙하려면 다음을 호출해 FastAPI 서버를 쉽게 시작할 수 있습니다:

    ```bash theme={null}
    weave serve <your model ref>
    ```

    추가 지침은 [serve](/ko/weave/guides/tools/serve)를 참조하세요.

    ## 프로덕션 call 추적

    프로덕션 call을 분리하려면 UI 또는 API에서 쉽게 필터링할 수 있도록 예측에 추가 속성을 더할 수 있습니다.

    ```python lines theme={null}
    with weave.attributes({'env': 'production'}):
        model.predict('world')
    ```
  </Tab>

  <Tab title="TypeScript">
    ```plaintext theme={null}
    이 기능은 아직 TypeScript에서 사용할 수 없습니다.  곧 제공될 예정입니다!
    ```
  </Tab>
</Tabs>
