🗂️ Request Log esquema

Visualização

Este recurso está na visualização privada. Para experimentar, entre em contato com seu contato do Databricks.

Procurando um documento RAG Studio diferente? Vá para o índice de documentação RAG

df.printSchema()

root
 |-- request: struct (nullable = false)
 |    |-- request_id: string (nullable = true)
 |    |-- conversation_id: string (nullable = true)
 |    |-- timestamp: timestamp (nullable = true)
 |    |-- messages: array (nullable = true)
 |    |    |-- element: struct (containsNull = true)
 |    |    |    |-- role: string (nullable = true)
 |    |    |    |-- content: string (nullable = true)
 |    |-- last_input: string (nullable = true)
 |-- trace: struct (nullable = true)
 |    |-- app_version_id: string (nullable = true)
 |    |-- start_timestamp: timestamp (nullable = true)
 |    |-- end_timestamp: timestamp (nullable = true)
 |    |-- is_truncated: boolean (nullable = true)
 |    |-- steps: array (nullable = true)
 |    |    |-- element: struct (containsNull = true)
 |    |    |    |-- step_id: string (nullable = true)
 |    |    |    |-- name: string (nullable = true)
 |    |    |    |-- type: string (nullable = true)
 |    |    |    |-- start_timestamp: timestamp (nullable = true)
 |    |    |    |-- end_timestamp: timestamp (nullable = true)
 |    |    |    |-- retrieval: struct (nullable = true)
 |    |    |    |    |-- query_text: string (nullable = true)
 |    |    |    |    |-- chunks: array (nullable = true)
 |    |    |    |    |    |-- element: struct (containsNull = true)
 |    |    |    |    |    |    |-- chunk_id: string (nullable = true)
 |    |    |    |    |    |    |-- parent_doc_id: string (nullable = true)
 |    |    |    |    |    |    |-- content: string (nullable = true)
 |    |    |    |-- text_generation: struct (nullable = true)
 |    |    |    |    |-- prompt: string (nullable = true)
 |    |    |    |    |-- generated_text: string (nullable = true)
 |-- output: struct (nullable = false)
 |    |-- choices: array (nullable = true)
 |    |    |-- element: struct (containsNull = true)
 |    |    |    |-- message: struct (nullable = true)
 |    |    |    |    |-- role: string (nullable = true)
 |    |    |    |    |-- content: string (nullable = true)

df.schema

from pyspark.sql.types import *

schema = StructType(
    [
        StructField(
            "request",
            StructType(
                [
                    StructField("request_id", StringType(), True),
                    StructField("conversation_id", StringType(), True),
                    StructField("timestamp", TimestampType(), True),
                    StructField(
                        "messages",
                        ArrayType(
                            StructType(
                                [
                                    StructField("role", StringType(), True),
                                    StructField("content", StringType(), True),
                                ]
                            ),
                            True,
                        ),
                        True,
                    ),
                    StructField("last_input", StringType(), True),
                ]
            ),
            False,
        ),
        StructField(
            "trace",
            StructType(
                [
                    StructField("app_version_id", StringType(), True),
                    StructField("start_timestamp", TimestampType(), True),
                    StructField("end_timestamp", TimestampType(), True),
                    StructField("is_truncated", BooleanType(), True),
                    StructField(
                        "steps",
                        ArrayType(
                            StructType(
                                [
                                    StructField("step_id", StringType(), True),
                                    StructField("name", StringType(), True),
                                    StructField("type", StringType(), True),
                                    StructField(
                                        "start_timestamp", TimestampType(), True
                                    ),
                                    StructField("end_timestamp", TimestampType(), True),
                                    StructField(
                                        "retrieval",
                                        StructType(
                                            [
                                                StructField(
                                                    "query_text", StringType(), True
                                                ),
                                                StructField(
                                                    "chunks",
                                                    ArrayType(
                                                        StructType(
                                                            [
                                                                StructField(
                                                                    "chunk_id",
                                                                    StringType(),
                                                                    True,
                                                                ),
                                                                StructField(
                                                                    "parent_doc_id",
                                                                    StringType(),
                                                                    True,
                                                                ),
                                                                StructField(
                                                                    "content",
                                                                    StringType(),
                                                                    True,
                                                                ),
                                                            ]
                                                        ),
                                                        True,
                                                    ),
                                                    True,
                                                ),
                                            ]
                                        ),
                                        True,
                                    ),
                                    StructField(
                                        "text_generation",
                                        StructType(
                                            [
                                                StructField(
                                                    "prompt", StringType(), True
                                                ),
                                                StructField(
                                                    "generated_text", StringType(), True
                                                ),
                                            ]
                                        ),
                                        True,
                                    ),
                                ]
                            ),
                            True,
                        ),
                        True,
                    ),
                ]
            ),
            True,
        ),
        StructField(
            "output",
            StructType(
                [
                    StructField(
                        "choices",
                        ArrayType(
                            StructType(
                                [
                                    StructField(
                                        "message",
                                        StructType(
                                            [
                                                StructField("role", StringType(), True),
                                                StructField(
                                                    "content", StringType(), True
                                                ),
                                            ]
                                        ),
                                        True,
                                    )
                                ]
                            ),
                            True,
                        ),
                        True,
                    )
                ]
            ),
            False,
        ),
    ]
)