API 개요
Source
class Agent
Pydantic 필드:
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonemodel_name:<class 'str'>temperature:<class 'float'>system_message:<class 'str'>tools:list[typing.Any]
method step
state: 환경의 현재 상태.action: 취할 행동. 반환값: 환경의 새로운 상태.
Source
class AgentState
Pydantic 필드:
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonehistory:list[typing.Any]
Source
class AnnotationSpec
Pydantic 필드:
name:str | Nonedescription:str | Nonefield_schema:dict[str, typing.Any]unique_among_creators:<class 'bool'>op_scope:list[str] | None
classmethod preprocess_field_schema
Source
classmethod validate_field_schema
Source
method value_is_valid
-
payload: 스키마에 대해 검증할 데이터 반환값: -
bool: 검증에 성공하면 True, 그렇지 않으면 False
Source
class Audio
지원되는 형식(wav 또는 mp3)의 오디오 데이터를 나타내는 클래스입니다.
이 클래스는 오디오 데이터 저장소를 처리하며 다양한 소스에서 로드하고 파일로 내보내는 메소드를 제공합니다.
속성:
format: 오디오 형식 (현재 ‘wav’ 또는 ‘mp3’ 지원)data: 바이트 형태의 원시 오디오 데이터
-
data: 오디오 데이터 (바이트 또는 base64 인코딩된 문자열) -
format: 오디오 형식 (‘wav’ 또는 ‘mp3’) -
validate_base64: 입력 데이터의 base64 디코딩 시도 여부 예외: -
ValueError: 오디오 데이터가 비어 있거나 형식이 지원되지 않는 경우
method __init__
Source
method export
Source
classmethod from_data
-
path: 오디오 파일이 작성될 경로 인수: -
data: 바이트 또는 base64 인코딩된 문자열 형태의 오디오 데이터 -
format: 오디오 형식 (‘wav’ 또는 ‘mp3’) 반환값: -
Audio: 새로운 Audio 인스턴스
ValueError: 형식이 지원되지 않는 경우
Source
classmethod from_path
-
path: 오디오 파일 경로 (.wav 또는 .mp3 확장자여야 함) 반환값: -
Audio: 파일로부터 로드된 새로운 Audio 인스턴스
ValueError: 파일이 존재하지 않거나 지원되지 않는 확장자인 경우
Source
class Content
다양한 소스로부터의 콘텐츠를 나타내고, 연관된 메타데이터와 함께 통합된 바이트 지향 표현으로 변환하는 클래스입니다.
이 클래스는 다음 classmethod 중 하나를 사용하여 인스턴스화해야 합니다:
- from_path()
- from_bytes()
- from_text()
- from_url()
- from_base64()
- from_data_url()
method __init__
Content.from_path()와 같은 classmethod를 사용하십시오.
Pydantic 필드:
data:<class 'bytes'>size:<class 'int'>mimetype:<class 'str'>digest:<class 'str'>filename:<class 'str'>content_type:typing.Literal['bytes', 'text', 'base64', 'file', 'url', 'data_url', 'data_url:base64', 'data_url:encoding', 'data_url:encoding:base64']input_type:<class 'str'>encoding:<class 'str'>metadata:dict[str, typing.Any] | Noneextension:str | None
property art
property ref
Source
method as_string
encoding 속성을 사용하여 디코딩됩니다. base64인 경우 데이터를 base64 바이트로 다시 인코딩한 다음 ASCII 문자열로 디코딩합니다.
반환값:
str.
Source
classmethod from_base64
Source
classmethod from_bytes
Source
classmethod from_data_url
Source
classmethod from_path
Source
classmethod from_text
Source
classmethod from_url
Source
classmethod model_validate
Source
classmethod model_validate_json
Source
method open
bool: 파일이 성공적으로 열렸으면 True, 그렇지 않으면 False.
Source
method save
Source
method serialize_data
Source
method to_data_url
-
dest: 파일이 복사될 대상 경로 (문자열 또는 pathlib.Path). 대상 경로는 파일 또는 디렉토리일 수 있습니다. dest에 파일 확장자(예: .txt)가 없으면 대상으로 디렉토리로 간주됩니다. 인수: -
use_base64: True이면 데이터가 base64로 인코딩됩니다. 그렇지 않으면 퍼센트 인코딩됩니다. 기본값은 True입니다. 반환값: 데이터 URL 문자열.
Source
class Dataset
간편한 저장 및 자동 버전 관리가 가능한 Dataset 오브젝트입니다.
예시:
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonerows:trace.table.Table | trace.vals.WeaveTable
method add_rows
rows: 데이터셋에 추가할 행들. 반환값: 업데이트된 데이터셋.
Source
classmethod convert_to_table
Source
classmethod from_calls
Source
classmethod from_hf
Source
classmethod from_obj
Source
classmethod from_pandas
Source
method select
indices: 선택할 행을 지정하는 정수 인덱스의 반복 가능한 오브젝트. 반환값: 선택된 행만 포함하는 새로운 Dataset 오브젝트.
Source
method to_hf
Source
method to_pandas
Source
class EasyPrompt
Source
method __init__
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonedata:<class 'list'>config:<class 'dict'>requirements:<class 'dict'>
property as_str
모든 메시지를 단일 문자열로 결합합니다.property is_bound
property messages
property placeholders
property system_message
모든 메시지를 시스템 프롬프트 메시지로 결합합니다.property system_prompt
모든 메시지를 시스템 프롬프트 오브젝트로 결합합니다.property unbound_placeholders
Source
method append
Source
method as_dict
Source
method as_pydantic_dict
Source
method bind
Source
method bind_rows
Source
method config_table
Source
method configure
Source
method dump
Source
method dump_file
Source
method format
Source
classmethod from_obj
Source
classmethod load
Source
classmethod load_file
Source
method messages_table
Source
method print
Source
method publish
Source
method require
Source
method run
Source
method validate_requirement
Source
method validate_requirements
Source
method values_table
Source
class Evaluation
Scorer 세트와 데이터셋을 포함하는 Evaluation을 설정합니다.
evaluation.evaluate(model)를 호출하면 데이터셋의 행들이 모델로 전달되며, 이때 데이터셋의 열 이름이 model.predict의 인수 이름과 매칭됩니다.
그 후 모든 scorer를 호출하고 결과를 Weights & Biases에 저장합니다.
데이터셋의 행을 전처리하고 싶다면 preprocess_model_input에 함수를 전달할 수 있습니다.
예시:
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonedataset:<class 'dataset.dataset.Dataset'>scorers:list[typing.Annotated[trace.op_protocol.Op | flow.scorer.Scorer, BeforeValidator(func=<function cast_to_scorer at 0x7fd95dcf47c0>, json_schema_input_type=PydanticUndefined)]] | Nonepreprocess_model_input:collections.abc.Callable[[dict], dict] | Nonetrials:<class 'int'>metadata:dict[str, typing.Any] | Noneevaluation_name:str | collections.abc.Callable[trace.call.Call, str] | None
method evaluate
Source
classmethod from_obj
Source
method get_eval_results
Source
method get_evaluate_calls
CallsIter: evaluation 실행을 나타내는 Call 오브젝트의 반복자.
ValueError: evaluation에 ref가 없는 경우(아직 저장/실행되지 않음).
Source
method get_score_calls
dict[str, list[Call]]: trace ID를 scorer Call 오브젝트 리스트에 매핑하는 사전. 각 trace ID는 하나의 evaluation 실행을 나타내며, 리스트에는 해당 실행 중에 실행된 모든 scorer call이 포함됩니다.
Source
method get_scores
dict[str, dict[str, list[Any]]]: 다음과 같은 중첩된 사전 구조:- 첫 번째 레벨 키는 trace ID(evaluation 실행)입니다.
- 두 번째 레벨 키는 scorer 이름입니다.
- 값은 해당 실행 및 scorer에 대한 scorer 출력 리스트입니다.
Source
method model_post_init
Source
method predict_and_score
Source
method summarize
Source
class EvaluationLogger
이 클래스는 evaluation 로깅을 위한 명령형 인터페이스를 제공합니다.
log_prediction 메소드를 사용하여 첫 번째 예측값이 로깅될 때 evaluation이 자동으로 시작되며, log_summary 메소드가 호출될 때 종료됩니다.
예측값을 로깅할 때마다 ScoreLogger 오브젝트를 반환받습니다. 이 오브젝트를 사용하여 해당 특정 예측에 대한 점수와 메타데이터를 로깅할 수 있습니다. 자세한 내용은 ScoreLogger 클래스를 참조하십시오.
기본 사용법 - 입력값과 출력값이 포함된 예측값을 직접 로깅:
method __init__
property attributes
property ui_url
Source
method fail
Source
method finish
Source
method log_example
inputs: 예측을 위한 입력 데이터output: 출력 값scores: scorer 이름을 점수 값에 매핑하는 사전 예시:
Source
method log_prediction
inputs: 예측을 위한 입력 데이터output: 출력 값. 기본값은 None입니다. 나중에 pred.output을 사용하여 설정할 수 있습니다. 반환값: 점수 로깅 및 선택적으로 예측 종료를 위한 ScoreLogger.
pred = ev.log_prediction({'q': ’…’}, output=“answer”) pred.log_score(“correctness”, 0.9) pred.finish()
with ev.log_prediction({'q': ’…’}) as pred: response = model(…) pred.output = response pred.log_score(“correctness”, 0.9) # 종료 시 자동으로 finish() 호출
Source
method log_summary
Source
method set_view
weave.views 아래에 view를 첨부합니다.
제공된 콘텐츠를 프로젝트의 오브젝트로 저장하고 evaluation의 evaluate call에 대한 summary.weave.views.<name> 아래에 해당 참조 URI를 작성합니다. 문자열 입력은 제공된 확장자 또는 mimetype을 사용하여 Content.from_text를 통해 텍스트 콘텐츠로 래핑됩니다.
인수:
name: 표시할 view 이름,summary.weave.views아래의 키로 사용됩니다.content: 직렬화할weave.Content인스턴스 또는 문자열.extension: 문자열 콘텐츠 입력에 대한 선택적 파일 확장자.mimetype: 문자열 콘텐츠 입력에 대한 선택적 MIME 유형.metadata: 새로 생성된Content에 첨부되는 선택적 메타데이터.encoding: 문자열 콘텐츠 입력에 대한 텍스트 인코딩. 반환값: None
import weave
ev = weave.EvaluationLogger() ev.set_view(“report”, ”# Report”, extension=“md”)
Source
class File
경로, mimetype 및 크기 정보를 가진 파일을 나타내는 클래스입니다.
Source
method __init__
property filename
파일의 이름을 가져옵니다.-
path: 파일 경로 (문자열 또는 pathlib.Path) -
mimetype: 선택적 MIME 유형 - 제공되지 않으면 확장자로부터 유추됩니다 반환값: -
str: 디렉토리 경로가 제외된 파일 이름.
Source
method open
bool: 파일이 성공적으로 열렸으면 True, 그렇지 않으면 False.
Source
method save
Source
class Markdown
Markdown 렌더링 가능 오브젝트입니다.
-
dest: 파일이 복사될 대상 경로 (문자열 또는 pathlib.Path). 대상 경로는 파일 또는 디렉토리일 수 있습니다. 인수: -
markup(str): 마크다운이 포함된 문자열. -
code_theme(str, 선택 사항): 코드 블록을 위한 Pygments 테마. 기본값은 “monokai”입니다. 코드 테마는 https://pygments.org/styles/ 를 참조하십시오. -
justify(JustifyMethod, 선택 사항): 단락의 정렬 값. 기본값은 None입니다. -
style(Union[str, Style], 선택 사항): 마크다운에 적용할 선택적 스타일. -
hyperlinks(bool, 선택 사항): 하이퍼링크 활성화. 기본값은True입니다.
method __init__
Source
class MessagesPrompt
Source
method __init__
-
inline_code_lexer: (str, 선택 사항): 인라인 코드 강조 표시가 활성화된 경우 사용할 Lexer. 기본값은 None입니다. -
inline_code_theme: (Optional[str], 선택 사항): 인라인 코드 강조 표시를 위한 Pygments 테마, 강조 표시를 하지 않으려면 None. 기본값은 None입니다. Pydantic 필드: -
name:str | None -
description:str | None -
ref:trace.refs.ObjectRef | None -
messages:list[dict]
method format
Source
method format_message
Source
classmethod from_obj
Source
class Model
입력에 대해 작동하는 코드와 데이터의 조합을 캡처하기 위한 것입니다. 예를 들어 예측을 하거나 텍스트를 생성하기 위해 프롬프트와 함께 LLM을 호출할 수 있습니다.
모델을 정의하는 속성이나 코드를 변경하면 이러한 변경 사항이 로깅되고 버전이 업데이트됩니다. 이를 통해 모델의 서로 다른 버전 간에 예측을 비교할 수 있습니다. 프롬프트를 반복 작업하거나 최신 LLM을 시도하고 다양한 설정에서 예측을 비교하는 데 사용하십시오.
예시:
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | None
method get_infer_method
Source
class Monitor
들어오는 call을 자동으로 점수화하는 모니터를 설정합니다.
예시:
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonesampling_rate:<class 'float'>scorers:list[flow.scorer.Scorer]op_names:list[str]query:trace_server.interface.query.Query | Noneactive:<class 'bool'>
method activate
Source
method deactivate
Source
classmethod from_obj
Source
class Object
추적 및 버전 관리가 가능한 Weave 오브젝트의 베이스 클래스입니다.
이 클래스는 Pydantic의 BaseModel을 확장하여 오브젝트 추적, 참조 및 직렬화를 위한 Weave 전용 기능을 제공합니다. 오브젝트는 이름, 설명 및 참조를 가질 수 있어 Weave 시스템에 저장하고 검색할 수 있습니다.
속성:
name(Optional[str]): 오브젝트의 사람이 읽을 수 있는 이름.description(Optional[str]): 오브젝트가 나타내는 내용에 대한 설명.ref(Optional[ObjectRef]): Weave 시스템에 있는 오브젝트의 참조.
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | None
classmethod from_uri
uri(str): 오브젝트를 가리키는 Weave URI.objectify(bool): 결과물을 오브젝트화할지 여부. 기본값은 True입니다.
Self: URI로부터 생성된 클래스의 인스턴스.
NotImplementedError: 클래스가 역직렬화에 필요한 메소드를 구현하지 않은 경우.
Source
classmethod handle_relocatable_object
v(Any): 검증할 값.handler(ValidatorFunctionWrapHandler): 표준 pydantic 검증 핸들러.info(ValidationInfo): 검증 컨텍스트 정보.
Any: 검증된 오브젝트 인스턴스.
ObjectRef가 전달된 경우
obj = MyObject(some_object_ref)WeaveObject가 전달된 경우
obj = MyObject(some_weave_object)property digest
property extra
Source
method as_param_dict
Source
method delete
Source
method get
Source
method is_descended_from
Source
method maybe_parse_uri
Source
method parse_uri
Source
method uri
Source
method with_attr
Source
method with_extra
Source
method with_index
Source
method with_item
Source
method with_key
Source
class EasyPrompt
Source
method __init__
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonedata:<class 'list'>config:<class 'dict'>requirements:<class 'dict'>
property as_str
모든 메시지를 단일 문자열로 결합합니다.property is_bound
property messages
property placeholders
property system_message
모든 메시지를 시스템 프롬프트 메시지로 결합합니다.property system_prompt
모든 메시지를 시스템 프롬프트 오브젝트로 결합합니다.property unbound_placeholders
Source
method append
Source
method as_dict
Source
method as_pydantic_dict
Source
method bind
Source
method bind_rows
Source
method config_table
Source
method configure
Source
method dump
Source
method dump_file
Source
method format
Source
classmethod from_obj
Source
classmethod load
Source
classmethod load_file
Source
method messages_table
Source
method print
Source
method publish
Source
method require
Source
method run
Source
method validate_requirement
Source
method validate_requirements
Source
method values_table
Source
class Prompt
Pydantic 필드:
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | None
method format
Source
class SavedView
SavedView 오브젝트를 다루기 위한 유연한 방식의 클래스입니다.
Source
method __init__
property entity
property label
property project
property view_type
Source
method add_column
Source
method add_columns
Source
method add_filter
Source
method add_sort
Source
method column_index
Source
method filter_op
Source
method get_calls
Source
method get_known_columns
Source
method get_table_columns
Source
method hide_column
Source
method insert_column
Source
classmethod load
Source
method page_size
Source
method pin_column_left
Source
method pin_column_right
Source
method remove_column
Source
method remove_columns
Source
method remove_filter
Source
method remove_filters
Source
method rename
Source
method rename_column
Source
method save
Source
method set_columns
Source
method show_column
Source
method sort_by
Source
method to_grid
Source
method to_rich_table_str
Source
method ui_url
Source
method unpin_column
Source
class Scorer
Pydantic 필드:
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonecolumn_map:dict[str, str] | None
classmethod from_obj
Source
method model_post_init
Source
method score
Source
method summarize
Source
class StringPrompt
Source
method __init__
name:str | Nonedescription:str | Noneref:trace.refs.ObjectRef | Nonecontent:<class 'str'>
method format
Source
classmethod from_obj
Source
class Table
Source
method __init__
property rows
Source
method append
Source
method pop
Source
class ContextAwareThread
호출자의 컨텍스트와 함께 함수를 실행하는 Thread입니다.
이는 threading.Thread를 직접 대체하는 용도로 사용되며, 스레드 내부에서 call이 예상대로 동작하도록 보장합니다. Weave는 특정 contextvar가 설정되어 있어야 하지만(call_context.py 참조), 새로운 스레드는 부모의 컨텍스트를 자동으로 복사하지 않아 call 컨텍스트가 유실될 수 있습니다. 이 클래스는 contextvar 복사를 자동화하여 사용자가 기대하는 대로 스레드를 사용할 수 있게 합니다.
이 클래스를 사용하지 않고도 다음과 같이 작성하여 동일한 효과를 얻을 수 있습니다:
method __init__
property daemon
이 스레드가 데몬 스레드인지 여부를 나타내는 불리언 값입니다. 이 값은 start()가 호출되기 전에 설정되어야 하며, 그렇지 않으면 RuntimeError가 발생합니다. 초기값은 생성한 스레드로부터 상속됩니다. 메인 스레드는 데몬 스레드가 아니므로 메인 스레드에서 생성된 모든 스레드의 기본값은 daemon = False입니다. 데몬 스레드만 남았을 때 전체 Python 프로그램이 종료됩니다.property ident
이 스레드의 식별자이며, 시작되지 않은 경우 None입니다. 이것은 0이 아닌 정수입니다. get_ident() 함수를 참조하십시오. 스레드 식별자는 스레드가 종료되고 다른 스레드가 생성될 때 재사용될 수 있습니다. 식별자는 스레드가 종료된 후에도 사용 가능합니다.property name
식별 목적으로만 사용되는 문자열입니다. 의미론적 의미는 없습니다. 여러 스레드에 동일한 이름을 줄 수 있습니다. 초기 이름은 생성자에 의해 설정됩니다.property native_id
이 스레드의 네이티브 정수 스레드 ID이며, 시작되지 않은 경우 None입니다. 이것은 음수가 아닌 정수입니다. get_native_id() 함수를 참조하십시오. 이것은 커널에 의해 보고되는 스레드 ID를 나타냅니다.Source
method run
Source
class ThreadContext
현재 스레드 및 턴(turn) 정보에 대한 액세스를 제공하는 컨텍스트 오브젝트입니다.
Source
method __init__
property thread_id
이 컨텍스트의 thread_id를 가져옵니다.thread_id: 이 컨텍스트의 스레드 식별자, 비활성화된 경우 None. 반환값: 스레드 식별자, 스레드 추적이 비활성화된 경우 None.
property turn_id
활성 컨텍스트에서 현재 turn_id를 가져옵니다. 반환값: 설정된 경우 현재 turn_id, 그렇지 않으면 None.Source
class ContextAwareThreadPoolExecutor
호출자의 컨텍스트와 함께 함수를 실행하는 ThreadPoolExecutor입니다.
이는 concurrent.futures.ThreadPoolExecutor를 직접 대체하는 용도로 사용되며, executor 내부에서 weave call이 예상대로 동작하도록 보장합니다. Weave는 특정 contextvar가 설정되어 있어야 하지만(call_context.py 참조), 새로운 스레드는 부모의 컨텍스트를 자동으로 복사하지 않아 call 컨텍스트가 유실될 수 있습니다. 이 클래스는 contextvar 복사를 자동화하여 사용자가 기대하는 대로 executor를 사용할 수 있게 합니다.
이 클래스를 사용하지 않고도 다음과 같이 작성하여 동일한 효과를 얻을 수 있습니다:
method __init__
Source
method map
Source
method submit
Source
function as_op
fn: weave.op 데코레이터가 적용된 함수. 반환값: 함수의 Op.
Source
function attributes
Source
function finish
Source
function get
uri: 정규화된 weave ref URI. 반환값: 오브젝트.
Source
function get_client
Source
function get_current_call
반환된 Call의attributes사전은 call이 시작되면 변경 불가능해집니다. Op를 호출하기 전에 call 메타데이터를 설정하려면 :func:weave.attributes를 사용하십시오.summary필드는 Op가 실행되는 동안 업데이트될 수 있으며 call이 종료될 때 계산된 요약 정보와 병합됩니다.
Source
function init
project_name: 로깅할 Weights & Biases 팀 및 프로젝트의 이름입니다. 팀을 지정하지 않으면 기본 엔티티가 사용됩니다. 기본 엔티티를 찾거나 업데이트하려면 W&B Models 문서의 사용자 설정을 참조하십시오.settings: 일반적인 Weave 클라이언트에 대한 설정입니다.autopatch_settings: (사용 중단됨) autopatch 인테그레이션을 위한 설정입니다. 대신 명시적인 패칭을 사용하십시오.global_postprocess_inputs: 모든 op의 모든 입력에 적용될 함수입니다.global_postprocess_output: 모든 op의 모든 출력에 적용될 함수입니다.global_attributes: 모든 trace에 적용될 속성 사전입니다. 반환값: Weave 클라이언트.
Source
function log_call
op(str): 로깅할 작업 이름. 이것은 call의 op_name으로 사용됩니다. 익명 작업(게시된 op를 참조하지 않는 문자열)도 지원됩니다.inputs(dict[str, Any]): 작업의 입력 파라미터 사전.output(Any): 작업의 출력/결과.parent(Call | None): 이 call을 중첩시킬 선택적 부모 call. 제공되지 않으면 call은 루트 레벨 call이 됩니다 (또는 현재 call 컨텍스트가 존재하면 그 아래에 중첩됨). 기본값은 None입니다.attributes(dict[str, Any] | None): call에 첨부할 선택적 메타데이터. 이들은 call이 생성되면 고정됩니다. 기본값은 None입니다.display_name(str | Callable[[Call], str] | None): UI에서 call에 표시될 선택적 이름. 문자열이거나 call을 받아 문자열을 반환하는 콜백일 수 있습니다. 기본값은 None입니다.use_stack(bool): call을 런타임 스택에 푸시할지 여부. True이면 call이 call 컨텍스트에서 사용 가능하며 weave.require_current_call()을 통해 액세스할 수 있습니다. False이면 call은 로깅되지만 call 스택에는 추가되지 않습니다. 기본값은 True입니다.exception(BaseException | None): 작업이 실패한 경우 로깅할 선택적 예외. 기본값은 None입니다.
Call: 전체 trace 정보가 포함된 생성 및 완료된 Call 오브젝트.
Source
function publish
obj: 저장 및 버전 관리할 오브젝트.name: 오브젝트를 저장할 이름. 반환값: 저장된 오브젝트에 대한 Weave Ref.
Source
function ref
location: Weave Ref URI, 또는weave.init()이 호출된 경우name:version또는name. 버전을 제공하지 않으면latest가 사용됩니다. 반환값: 오브젝트에 대한 Weave Ref.
Source
function require_current_call
weave.init에서 반환된 WeaveClient의 get_call 메소드를 사용하여 Call 오브젝트를 검색할 수 있습니다.
call 메소드를 사용할 수 있습니다. 예시:
NoCurrentCallError: 추적이 초기화되지 않았거나 Op 외부에서 이 메소드가 호출된 경우.
Source
function set_view
_weave.views.<name>에 커스텀 view를 첨부합니다.
인수:
name: view 이름 (summary._weave.views아래의 키).content:weave.Content인스턴스 또는 원시 문자열. 문자열은 제공된 확장자 또는 mimetype을 사용하여Content.from_text를 통해 래핑됩니다.extension:content가 문자열일 때 사용할 선택적 파일 확장자.mimetype:content가 문자열일 때 사용할 선택적 MIME 유형.metadata: 텍스트로부터Content를 생성할 때 첨부할 선택적 메타데이터.encoding: 텍스트로부터Content를 생성할 때 적용할 텍스트 인코딩. 반환값: None
import weave
weave.init(“proj”) @weave.op … def foo(): … weave.set_view(“readme”, ”# Hello”, extension=“md”) … return 1 foo()
Source
function thread
-
thread_id: 이 컨텍스트의 call들과 연관시킬 스레드 식별자. 제공되지 않으면 UUID v7이 자동으로 생성됩니다. None인 경우 스레드 추적이 비활성화됩니다. Yields: -
ThreadContext: thread_id 및 현재 turn_id에 대한 액세스를 제공하는 오브젝트.
Source