LLM 애플리케이션을 효율적으로 평가하려면 피드백을 수집하고 분석하기 위한 강력한 도구가 필요합니다. Weave는 통합된 피드백 시스템을 제공하여 사용자가 UI를 통해 직접 또는 SDK를 통해 프로그래밍 방식으로 호출 피드백을 제공할 수 있습니다. 이모티콘 반응, 텍스트 댓글 및 구조화된 데이터를 포함한 다양한 피드백 유형이 지원되어 팀이 다음을 수행할 수 있습니다:
성능 모니터링을 위한 평가 데이터셋 구축.
LLM 콘텐츠 문제를 효과적으로 식별하고 해결.
미세 조정과 같은 고급 작업을 위한 예제 수집.
이 가이드는 UI와 SDK 모두에서 Weave의 피드백 기능을 사용하는 방법, 피드백을 쿼리하고 관리하는 방법, 그리고 상세한 평가를 위해 인간 주석을 사용하는 방법을 다룹니다.
SDK를 사용하여 Weave 프로젝트의 피드백을 쿼리할 수 있습니다. SDK는 다음과 같은 피드백 쿼리 작업을 지원합니다:
client.get_feedback(): 프로젝트의 모든 피드백을 반환합니다.
client.get_feedback("<feedback_uuid>"): <feedback_uuid>로 지정된 특정 피드백 객체를 컬렉션으로 반환합니다.
client.get_feedback(reaction="<reaction_type>"): 특정 반응 유형에 대한 모든 피드백 객체를 반환합니다.
또한 client.get_feedback()에서 각 피드백 객체에 대한 추가 정보를 얻을 수 있습니다:
id: 피드백 객체 ID.
created_at: 피드백 객체의 생성 시간 정보.
feedback_type: 피드백 유형(반응, 메모, 사용자 정의).
payload: 피드백 페이로드
Python
TypeScript
import weaveclient = weave.init('intro-example')# Get all feedback in a projectall_feedback = client.get_feedback()# Fetch a specific feedback object by id.# The API returns a collection, which is expected to contain at most one item.one_feedback = client.get_feedback("<feedback_uuid>")[0]# Find all feedback objects with a specific reaction. You can specify offset and limit.thumbs_up = client.get_feedback(reaction="👍", limit=10)# After retrieval, view the details of individual feedback objects.for f in client.get_feedback(): print(f.id) print(f.created_at) print(f.feedback_type) print(f.payload)
This feature is not available in TypeScript yet. Stay tuned!
호출의 UUID를 사용하여 호출에 피드백을 추가할 수 있습니다. UUID를 사용하여 특정 호출을 가져오려면 호출 실행 중 또는 후에 UUID를 검색하세요. SDK는 호출에 피드백을 추가하기 위한 다음 작업을 지원합니다:
call.feedback.add_reaction("<reaction_type>"): 지원되는 <reaction_types> (이모지) 중 하나를 추가합니다(예: 👍).
call.feedback.add_note("<note>"): 메모를 추가합니다.
call.feedback.add("<label>", <object>): 사용자 정의 피드백 <object>을 <label>로 지정하여 추가합니다.
피드백 메모의 최대 문자 수는 1024자입니다. 메모가 이 제한을 초과하면 생성되지 않습니다.
Python
TypeScript
import weaveclient = weave.init('intro-example')call = client.get_call("<call_uuid>")# Adding an emoji reactioncall.feedback.add_reaction("👍")# Adding a notecall.feedback.add_note("this is a note")# Adding custom key/value pairs.# The first argument is a user-defined "type" string.# Feedback must be JSON serializable and less than 1 KB when serialized.call.feedback.add("correctness", { "value": 5 })
This feature is not available in TypeScript yet. Stay tuned!
import weaveweave.init("uuid")@weave.op()def simple_operation(input_value): # Perform some simple operation output = f"Processed {input_value}" # Get the current call ID current_call = weave.require_current_call() call_id = current_call.id return output, call_id
This feature is not available in TypeScript yet. Stay tuned!
호출 실행 후
또는 call() 메서드를 사용하여 작업을 실행하고 호출 실행 후 ID를 검색할 수 있습니다:
Python
TypeScript
import weaveweave.init("uuid")@weave.op()def simple_operation(input_value): return f"Processed {input_value}"# Execute the operation and retrieve the result and call IDresult, call = simple_operation.call("example input")call_id = call.id
This feature is not available in TypeScript yet. Stay tuned!
다음 예제에서는 두 개의 스코러가 생성됩니다. 첫 번째 스코러인 Temperature는 LLM 호출의 인지된 온도를 점수화하는 데 사용됩니다. 두 번째 스코러인 Tone는 LLM 응답의 톤을 점수화하는 데 사용됩니다. 각 스코러는 save를 사용하여 관련 객체 ID(temperature-scorer 및 tone-scorer)로 생성됩니다.
Python
TypeScript
import weavefrom weave.flow.annotation_spec import AnnotationSpecclient = weave.init("feedback-example")spec1 = AnnotationSpec( name="Temperature", description="The perceived temperature of the llm call", field_schema={ "type": "number", "minimum": -1, "maximum": 1, })spec2 = AnnotationSpec( name="Tone", description="The tone of the llm response", field_schema={ "type": "string", "enum": ["Aggressive", "Neutral", "Polite", "N/A"], },)weave.publish(spec1, "temperature-scorer")weave.publish(spec2, "tone-scorer")
This feature is not available in TypeScript yet. Stay tuned!
다음을 확장하여 API를 사용하여 인간 주석 스코러 만들기, 다음 예제는 원래 객체 ID(Temperature 스코러의 업데이트된 버전을 만듭니다. temperature-scorer)를 publish에 사용합니다. 결과는 모든 버전의 기록이 있는 업데이트된 객체입니다.
인간 주석 스코러 객체 기록은 Scorers 탭의 Human annotations에서 볼 수 있습니다.
Python
TypeScript
import weavefrom weave.flow.annotation_spec import AnnotationSpecclient = weave.init("feedback-example")# create a new version of the scorerspec1 = AnnotationSpec( name="Temperature", description="The perceived temperature of the llm call", field_schema={ "type": "integer", # <<- change type to integer "minimum": -1, "maximum": 1, })weave.publish(spec1, "temperature-scorer")
This feature is not available in TypeScript yet. Stay tuned!