# Ruby

**Objective:**

Ruby uses program dependency graph (PDG) analysis to evaluate code structure similarity. It compares the logical structure and dependencies of generated code with a reference, identifying structural and semantic alignment, making it well-suited for complex programming tasks where accuracy in logic flow is crucial.

**Required Columns in Dataset:**

`Generated Code`, `Reference Code`

**Interpretation:**

* **High Ruby Score:** Suggests that the generated code aligns closely with the logical structure of the reference code.
* **Low Ruby Score:** Indicates deviations in code logic or structure, potentially affecting functionality.

**Execution via UI:**

<figure><img src="/files/w794fPA6k7V8gywv3yMN" alt=""><figcaption></figcaption></figure>

**Execution via SDK:**

```python
metrics=[
    {"name": "Ruby", "schema_mapping": {"generated_code": "Generated Code", "reference_code": "Reference Code"}}
]

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/code-generation/ruby.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
