rubyllm-observ 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +778 -0
- data/Rakefile +49 -0
- data/app/assets/javascripts/observ/application.js +12 -0
- data/app/assets/javascripts/observ/controllers/autoscroll_controller.js +33 -0
- data/app/assets/javascripts/observ/controllers/chat_form_controller.js +93 -0
- data/app/assets/javascripts/observ/controllers/copy_controller.js +43 -0
- data/app/assets/javascripts/observ/controllers/dashboard_controller.js +58 -0
- data/app/assets/javascripts/observ/controllers/drawer_controller.js +58 -0
- data/app/assets/javascripts/observ/controllers/expandable_controller.js +33 -0
- data/app/assets/javascripts/observ/controllers/filter_controller.js +36 -0
- data/app/assets/javascripts/observ/controllers/index.js +52 -0
- data/app/assets/javascripts/observ/controllers/json_viewer_controller.js +260 -0
- data/app/assets/javascripts/observ/controllers/message_form_controller.js +58 -0
- data/app/assets/javascripts/observ/controllers/prompt_variables_controller.js +64 -0
- data/app/assets/javascripts/observ/controllers/text_select_controller.js +14 -0
- data/app/assets/stylesheets/observ/_annotations.scss +127 -0
- data/app/assets/stylesheets/observ/_card.scss +52 -0
- data/app/assets/stylesheets/observ/_chat.scss +156 -0
- data/app/assets/stylesheets/observ/_components.scss +460 -0
- data/app/assets/stylesheets/observ/_dashboard.scss +40 -0
- data/app/assets/stylesheets/observ/_datasets.scss +697 -0
- data/app/assets/stylesheets/observ/_drawer.scss +273 -0
- data/app/assets/stylesheets/observ/_json_viewer.scss +120 -0
- data/app/assets/stylesheets/observ/_layout.scss +256 -0
- data/app/assets/stylesheets/observ/_metrics.scss +99 -0
- data/app/assets/stylesheets/observ/_observations.scss +160 -0
- data/app/assets/stylesheets/observ/_pagination.scss +143 -0
- data/app/assets/stylesheets/observ/_prompts.scss +365 -0
- data/app/assets/stylesheets/observ/_table.scss +53 -0
- data/app/assets/stylesheets/observ/_variables.scss +53 -0
- data/app/assets/stylesheets/observ/application.scss +15 -0
- data/app/controllers/observ/annotations_controller.rb +144 -0
- data/app/controllers/observ/application_controller.rb +8 -0
- data/app/controllers/observ/chats_controller.rb +58 -0
- data/app/controllers/observ/dashboard_controller.rb +159 -0
- data/app/controllers/observ/dataset_items_controller.rb +85 -0
- data/app/controllers/observ/dataset_run_items_controller.rb +84 -0
- data/app/controllers/observ/dataset_runs_controller.rb +110 -0
- data/app/controllers/observ/datasets_controller.rb +74 -0
- data/app/controllers/observ/messages_controller.rb +26 -0
- data/app/controllers/observ/observations_controller.rb +59 -0
- data/app/controllers/observ/prompt_versions_controller.rb +148 -0
- data/app/controllers/observ/prompts_controller.rb +205 -0
- data/app/controllers/observ/sessions_controller.rb +45 -0
- data/app/controllers/observ/traces_controller.rb +86 -0
- data/app/forms/observ/prompt_form.rb +96 -0
- data/app/helpers/observ/application_helper.rb +9 -0
- data/app/helpers/observ/chats_helper.rb +47 -0
- data/app/helpers/observ/dashboard_helper.rb +154 -0
- data/app/helpers/observ/datasets_helper.rb +62 -0
- data/app/helpers/observ/pagination_helper.rb +38 -0
- data/app/jobs/observ/application_job.rb +4 -0
- data/app/jobs/observ/dataset_runner_job.rb +49 -0
- data/app/mailers/observ/application_mailer.rb +6 -0
- data/app/models/concerns/observ/agent_phaseable.rb +124 -0
- data/app/models/concerns/observ/agent_selectable.rb +50 -0
- data/app/models/concerns/observ/chat_enhancements.rb +109 -0
- data/app/models/concerns/observ/message_enhancements.rb +31 -0
- data/app/models/concerns/observ/observability_instrumentation.rb +124 -0
- data/app/models/concerns/observ/prompt_management.rb +320 -0
- data/app/models/concerns/observ/trace_association.rb +9 -0
- data/app/models/observ/annotation.rb +23 -0
- data/app/models/observ/application_record.rb +5 -0
- data/app/models/observ/dataset.rb +51 -0
- data/app/models/observ/dataset_item.rb +41 -0
- data/app/models/observ/dataset_run.rb +104 -0
- data/app/models/observ/dataset_run_item.rb +111 -0
- data/app/models/observ/generation.rb +56 -0
- data/app/models/observ/null_prompt.rb +59 -0
- data/app/models/observ/observation.rb +38 -0
- data/app/models/observ/prompt.rb +315 -0
- data/app/models/observ/score.rb +51 -0
- data/app/models/observ/session.rb +131 -0
- data/app/models/observ/span.rb +13 -0
- data/app/models/observ/trace.rb +135 -0
- data/app/presenters/observ/agent_select_presenter.rb +59 -0
- data/app/services/observ/agent_executor_service.rb +174 -0
- data/app/services/observ/agent_provider.rb +60 -0
- data/app/services/observ/agent_selection_service.rb +53 -0
- data/app/services/observ/chat_instrumenter.rb +523 -0
- data/app/services/observ/dataset_runner_service.rb +153 -0
- data/app/services/observ/evaluator_runner_service.rb +58 -0
- data/app/services/observ/evaluators/base_evaluator.rb +51 -0
- data/app/services/observ/evaluators/contains_evaluator.rb +53 -0
- data/app/services/observ/evaluators/exact_match_evaluator.rb +23 -0
- data/app/services/observ/evaluators/json_structure_evaluator.rb +44 -0
- data/app/services/observ/prompt_manager/cache_statistics.rb +82 -0
- data/app/services/observ/prompt_manager/caching.rb +167 -0
- data/app/services/observ/prompt_manager/comparison.rb +49 -0
- data/app/services/observ/prompt_manager/version_management.rb +96 -0
- data/app/services/observ/prompt_manager.rb +40 -0
- data/app/services/observ/trace_text_formatter.rb +349 -0
- data/app/validators/observ/prompt_config_validator.rb +187 -0
- data/app/views/kaminari/_first_page.html.erb +11 -0
- data/app/views/kaminari/_gap.html.erb +8 -0
- data/app/views/kaminari/_last_page.html.erb +11 -0
- data/app/views/kaminari/_next_page.html.erb +11 -0
- data/app/views/kaminari/_page.html.erb +12 -0
- data/app/views/kaminari/_paginator.html.erb +25 -0
- data/app/views/kaminari/_prev_page.html.erb +11 -0
- data/app/views/kaminari/observ/_first_page.html.erb +11 -0
- data/app/views/kaminari/observ/_gap.html.erb +8 -0
- data/app/views/kaminari/observ/_last_page.html.erb +11 -0
- data/app/views/kaminari/observ/_next_page.html.erb +11 -0
- data/app/views/kaminari/observ/_page.html.erb +12 -0
- data/app/views/kaminari/observ/_paginator.html.erb +25 -0
- data/app/views/kaminari/observ/_prev_page.html.erb +11 -0
- data/app/views/layouts/observ/application.html.erb +88 -0
- data/app/views/observ/annotations/_annotation.html.erb +13 -0
- data/app/views/observ/annotations/_form.html.erb +28 -0
- data/app/views/observ/annotations/index.html.erb +28 -0
- data/app/views/observ/annotations/sessions_index.html.erb +48 -0
- data/app/views/observ/annotations/traces_index.html.erb +48 -0
- data/app/views/observ/chats/_form.html.erb +45 -0
- data/app/views/observ/chats/index.html.erb +67 -0
- data/app/views/observ/chats/new.html.erb +17 -0
- data/app/views/observ/chats/show.html.erb +34 -0
- data/app/views/observ/dashboard/index.html.erb +236 -0
- data/app/views/observ/dataset_items/_form.html.erb +49 -0
- data/app/views/observ/dataset_items/edit.html.erb +18 -0
- data/app/views/observ/dataset_items/index.html.erb +95 -0
- data/app/views/observ/dataset_items/new.html.erb +18 -0
- data/app/views/observ/dataset_run_items/_score_close_drawer.html.erb +4 -0
- data/app/views/observ/dataset_run_items/_score_drawer.html.erb +75 -0
- data/app/views/observ/dataset_run_items/_score_success.html.erb +29 -0
- data/app/views/observ/dataset_run_items/_scores_cell.html.erb +19 -0
- data/app/views/observ/dataset_run_items/details_drawer.turbo_stream.erb +80 -0
- data/app/views/observ/dataset_run_items/score_drawer.turbo_stream.erb +7 -0
- data/app/views/observ/dataset_runs/index.html.erb +108 -0
- data/app/views/observ/dataset_runs/new.html.erb +57 -0
- data/app/views/observ/dataset_runs/review.html.erb +155 -0
- data/app/views/observ/dataset_runs/show.html.erb +166 -0
- data/app/views/observ/datasets/_form.html.erb +62 -0
- data/app/views/observ/datasets/_items_tab.html.erb +66 -0
- data/app/views/observ/datasets/_runs_tab.html.erb +82 -0
- data/app/views/observ/datasets/edit.html.erb +32 -0
- data/app/views/observ/datasets/index.html.erb +105 -0
- data/app/views/observ/datasets/new.html.erb +18 -0
- data/app/views/observ/datasets/show.html.erb +67 -0
- data/app/views/observ/messages/_content.html.erb +1 -0
- data/app/views/observ/messages/_form.html.erb +33 -0
- data/app/views/observ/messages/_message.html.erb +14 -0
- data/app/views/observ/messages/_tool_calls.html.erb +10 -0
- data/app/views/observ/messages/create.turbo_stream.erb +9 -0
- data/app/views/observ/observations/index.html.erb +97 -0
- data/app/views/observ/observations/show_generation.html.erb +195 -0
- data/app/views/observ/observations/show_span.html.erb +93 -0
- data/app/views/observ/prompts/_diff_content.html.erb +16 -0
- data/app/views/observ/prompts/_form.html.erb +111 -0
- data/app/views/observ/prompts/_new_form.html.erb +102 -0
- data/app/views/observ/prompts/_prompt_actions.html.erb +4 -0
- data/app/views/observ/prompts/_prompt_content_highlighted.html.erb +4 -0
- data/app/views/observ/prompts/_version_actions.html.erb +40 -0
- data/app/views/observ/prompts/compare.html.erb +155 -0
- data/app/views/observ/prompts/edit.html.erb +17 -0
- data/app/views/observ/prompts/index.html.erb +108 -0
- data/app/views/observ/prompts/new.html.erb +17 -0
- data/app/views/observ/prompts/show.html.erb +138 -0
- data/app/views/observ/prompts/versions.html.erb +87 -0
- data/app/views/observ/sessions/annotations_drawer.turbo_stream.erb +25 -0
- data/app/views/observ/sessions/drawer_test.turbo_stream.erb +49 -0
- data/app/views/observ/sessions/index.html.erb +91 -0
- data/app/views/observ/sessions/show.html.erb +251 -0
- data/app/views/observ/traces/add_to_dataset_drawer.turbo_stream.erb +48 -0
- data/app/views/observ/traces/annotations_drawer.turbo_stream.erb +25 -0
- data/app/views/observ/traces/index.html.erb +87 -0
- data/app/views/observ/traces/show.html.erb +285 -0
- data/app/views/observ/traces/text_output_drawer.turbo_stream.erb +48 -0
- data/app/views/shared/_drawer.html.erb +26 -0
- data/config/routes.rb +80 -0
- data/db/migrate/001_create_observ_sessions.rb +21 -0
- data/db/migrate/002_create_observ_traces.rb +25 -0
- data/db/migrate/003_create_observ_observations.rb +42 -0
- data/db/migrate/004_add_message_id_to_observ_traces.rb +7 -0
- data/db/migrate/005_create_observ_prompts.rb +21 -0
- data/db/migrate/006_fix_prompt_config_strings.rb +23 -0
- data/db/migrate/007_create_observ_annotations.rb +12 -0
- data/db/migrate/009_add_prompt_fields_to_observ_chats.rb +11 -0
- data/db/migrate/010_create_observ_datasets.rb +15 -0
- data/db/migrate/011_create_observ_dataset_items.rb +17 -0
- data/db/migrate/012_create_observ_dataset_runs.rb +22 -0
- data/db/migrate/013_create_observ_dataset_run_items.rb +16 -0
- data/db/migrate/014_create_observ_scores.rb +26 -0
- data/lib/generators/observ/add_phase_tracking/add_phase_tracking_generator.rb +150 -0
- data/lib/generators/observ/add_phase_tracking/templates/migration.rb.tt +6 -0
- data/lib/generators/observ/install/USAGE +27 -0
- data/lib/generators/observ/install/install_generator.rb +270 -0
- data/lib/generators/observ/install_chat/install_chat_generator.rb +313 -0
- data/lib/generators/observ/install_chat/templates/agents/base_agent.rb.tt +147 -0
- data/lib/generators/observ/install_chat/templates/agents/simple_agent.rb.tt +55 -0
- data/lib/generators/observ/install_chat/templates/concerns/observ_chat_enhancements.rb.tt +34 -0
- data/lib/generators/observ/install_chat/templates/concerns/observ_message_enhancements.rb.tt +18 -0
- data/lib/generators/observ/install_chat/templates/initializers/observability.rb.tt +20 -0
- data/lib/generators/observ/install_chat/templates/jobs/chat_response_job.rb.tt +56 -0
- data/lib/generators/observ/install_chat/templates/migrations/add_agent_class_name.rb.tt +6 -0
- data/lib/generators/observ/install_chat/templates/migrations/add_observability_session_id.rb.tt +6 -0
- data/lib/generators/observ/install_chat/templates/tools/think_tool.rb.tt +29 -0
- data/lib/generators/observ/install_chat/templates/views/messages/_content.html.erb.tt +1 -0
- data/lib/observ/asset_installer.rb +130 -0
- data/lib/observ/asset_syncer.rb +104 -0
- data/lib/observ/configuration.rb +108 -0
- data/lib/observ/engine.rb +50 -0
- data/lib/observ/index_file_generator.rb +142 -0
- data/lib/observ/instrumenter/ruby_llm.rb +6 -0
- data/lib/observ/version.rb +3 -0
- data/lib/observ.rb +29 -0
- data/lib/tasks/observ_tasks.rake +75 -0
- metadata +453 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
@import 'variables';
|
|
2
|
+
|
|
3
|
+
// Prompts Index Page - Filters
|
|
4
|
+
.observ-prompts-filters {
|
|
5
|
+
margin-bottom: var(--spacing-lg, 1.5rem);
|
|
6
|
+
|
|
7
|
+
&__form {
|
|
8
|
+
display: flex;
|
|
9
|
+
gap: var(--spacing-md, 1rem);
|
|
10
|
+
align-items: flex-end;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&__field {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
|
|
17
|
+
&--search {
|
|
18
|
+
flex: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&--state {
|
|
22
|
+
width: 12rem;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&__label {
|
|
27
|
+
display: block;
|
|
28
|
+
margin-bottom: var(--spacing-xs, 0.5rem);
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
color: $observ-gray-900;
|
|
31
|
+
font-size: $observ-font-size-sm;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&__input,
|
|
35
|
+
&__select {
|
|
36
|
+
width: 100%;
|
|
37
|
+
padding: var(--spacing-sm, 0.5rem);
|
|
38
|
+
border: 1px solid $observ-gray-300;
|
|
39
|
+
border-radius: $observ-border-radius-sm;
|
|
40
|
+
font-size: $observ-font-size-base;
|
|
41
|
+
color: $observ-gray-900;
|
|
42
|
+
transition: border-color 0.2s ease;
|
|
43
|
+
|
|
44
|
+
&:focus {
|
|
45
|
+
outline: none;
|
|
46
|
+
border-color: $observ-primary;
|
|
47
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&::placeholder {
|
|
51
|
+
color: $observ-gray-400;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__actions {
|
|
56
|
+
display: flex;
|
|
57
|
+
gap: var(--spacing-sm, 0.5rem);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Prompts Table - Link Styling
|
|
62
|
+
.observ-prompts-table {
|
|
63
|
+
&__link {
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
color: $observ-primary;
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
transition: color 0.2s ease;
|
|
68
|
+
|
|
69
|
+
&:hover {
|
|
70
|
+
color: darken($observ-primary, 10%);
|
|
71
|
+
text-decoration: underline;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__action-group {
|
|
76
|
+
display: flex;
|
|
77
|
+
gap: var(--spacing-sm, 0.5rem);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Prompts Pagination
|
|
82
|
+
.observ-prompts-pagination {
|
|
83
|
+
margin-top: var(--spacing-lg, 1.5rem);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Empty State
|
|
87
|
+
.observ-card__empty-text {
|
|
88
|
+
margin-bottom: var(--spacing-md, 1rem);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Prompt Show Page - Version Details Layout
|
|
92
|
+
.prompt-details {
|
|
93
|
+
display: grid;
|
|
94
|
+
grid-template-columns: 300px 1fr;
|
|
95
|
+
gap: $observ-spacing-lg;
|
|
96
|
+
|
|
97
|
+
@media (max-width: $observ-breakpoint-md) {
|
|
98
|
+
grid-template-columns: 1fr;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Prompt Versions Sidebar
|
|
103
|
+
.prompt-versions {
|
|
104
|
+
&__sidebar {
|
|
105
|
+
position: sticky;
|
|
106
|
+
top: $observ-spacing-md;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&__header {
|
|
110
|
+
padding: $observ-spacing-lg;
|
|
111
|
+
border-bottom: 1px solid $observ-gray-200;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__title {
|
|
115
|
+
font-size: $observ-font-size-lg;
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
margin: 0;
|
|
118
|
+
color: $observ-gray-900;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&__list {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
padding: 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&__item {
|
|
128
|
+
display: block;
|
|
129
|
+
padding: 0.75rem $observ-spacing-md;
|
|
130
|
+
border-bottom: 1px solid $observ-gray-200;
|
|
131
|
+
text-decoration: none;
|
|
132
|
+
color: inherit;
|
|
133
|
+
transition: $observ-transition;
|
|
134
|
+
|
|
135
|
+
&:hover {
|
|
136
|
+
background-color: $observ-gray-50;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&--active {
|
|
140
|
+
background-color: #eff6ff;
|
|
141
|
+
border-left: 3px solid $observ-primary;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&__item-header {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
justify-content: space-between;
|
|
149
|
+
margin-bottom: $observ-spacing-xs;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&__version-number {
|
|
153
|
+
font-weight: 500;
|
|
154
|
+
color: $observ-gray-900;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&__commit-message {
|
|
158
|
+
font-size: $observ-font-size-xs;
|
|
159
|
+
color: $observ-gray-500;
|
|
160
|
+
margin: $observ-spacing-xs 0;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
text-overflow: ellipsis;
|
|
163
|
+
white-space: nowrap;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&__timestamp {
|
|
167
|
+
font-size: $observ-font-size-xs;
|
|
168
|
+
color: $observ-gray-400;
|
|
169
|
+
margin: $observ-spacing-xs 0 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&__footer {
|
|
173
|
+
padding: 0.75rem $observ-spacing-md;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Prompt Details Panel
|
|
178
|
+
.prompt-detail {
|
|
179
|
+
&__header {
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
gap: $observ-spacing-md;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
&__header-section {
|
|
186
|
+
width: 100%;
|
|
187
|
+
padding-bottom: $observ-spacing-md;
|
|
188
|
+
border-bottom: 1px solid $observ-gray-200;
|
|
189
|
+
|
|
190
|
+
&:last-child {
|
|
191
|
+
border-bottom: none;
|
|
192
|
+
padding-bottom: 0;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&__badges-row {
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
justify-content: space-between;
|
|
200
|
+
width: 100%;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&__badges {
|
|
204
|
+
display: flex;
|
|
205
|
+
align-items: center;
|
|
206
|
+
gap: $observ-spacing-sm;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&__metadata {
|
|
210
|
+
display: grid;
|
|
211
|
+
grid-template-columns: repeat(4, 1fr);
|
|
212
|
+
gap: $observ-spacing-lg;
|
|
213
|
+
font-size: $observ-font-size-sm;
|
|
214
|
+
|
|
215
|
+
@media (max-width: $observ-breakpoint-lg) {
|
|
216
|
+
grid-template-columns: repeat(2, 1fr);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@media (max-width: $observ-breakpoint-sm) {
|
|
220
|
+
grid-template-columns: 1fr;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
&__metadata-item {
|
|
225
|
+
display: flex;
|
|
226
|
+
flex-direction: column;
|
|
227
|
+
gap: $observ-spacing-xs;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&__metadata-label {
|
|
231
|
+
color: $observ-gray-500;
|
|
232
|
+
font-size: $observ-font-size-xs;
|
|
233
|
+
text-transform: uppercase;
|
|
234
|
+
letter-spacing: 0.05em;
|
|
235
|
+
font-weight: 600;
|
|
236
|
+
margin: 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&__metadata-value {
|
|
240
|
+
font-weight: 500;
|
|
241
|
+
color: $observ-gray-900;
|
|
242
|
+
margin: 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
&__commit {
|
|
246
|
+
padding: 0.75rem;
|
|
247
|
+
background-color: $observ-gray-50;
|
|
248
|
+
border-radius: $observ-border-radius-sm;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&__commit-title {
|
|
252
|
+
font-size: $observ-font-size-sm;
|
|
253
|
+
font-weight: 600;
|
|
254
|
+
margin: 0 0 $observ-spacing-xs 0;
|
|
255
|
+
color: $observ-gray-900;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&__commit-message {
|
|
259
|
+
font-size: $observ-font-size-sm;
|
|
260
|
+
color: $observ-gray-700;
|
|
261
|
+
margin: 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&__section-title {
|
|
265
|
+
font-size: $observ-font-size-lg;
|
|
266
|
+
font-weight: 600;
|
|
267
|
+
margin: 0 0 0.75rem;
|
|
268
|
+
color: $observ-gray-900;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&__content-block {
|
|
272
|
+
background-color: $observ-gray-50;
|
|
273
|
+
padding: $observ-spacing-md;
|
|
274
|
+
border-radius: $observ-border-radius-sm;
|
|
275
|
+
overflow-x: auto;
|
|
276
|
+
|
|
277
|
+
pre {
|
|
278
|
+
margin: 0;
|
|
279
|
+
font-family: $observ-font-family-mono;
|
|
280
|
+
font-size: $observ-font-size-sm;
|
|
281
|
+
white-space: pre-wrap;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
&__config-block {
|
|
286
|
+
background-color: $observ-gray-50;
|
|
287
|
+
padding: $observ-spacing-md;
|
|
288
|
+
border-radius: $observ-border-radius-sm;
|
|
289
|
+
overflow-x: auto;
|
|
290
|
+
|
|
291
|
+
pre {
|
|
292
|
+
font-size: $observ-font-size-sm;
|
|
293
|
+
margin: 0;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
&__no-config {
|
|
298
|
+
color: $observ-gray-500;
|
|
299
|
+
font-size: $observ-font-size-sm;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
&__body-section {
|
|
303
|
+
border-bottom: 1px solid $observ-gray-200;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Page Header Customizations for Prompts
|
|
308
|
+
.prompt-page-header {
|
|
309
|
+
&__back-link {
|
|
310
|
+
display: inline-block;
|
|
311
|
+
margin-bottom: $observ-spacing-sm;
|
|
312
|
+
color: $observ-primary;
|
|
313
|
+
text-decoration: none;
|
|
314
|
+
font-weight: 500;
|
|
315
|
+
transition: $observ-transition;
|
|
316
|
+
|
|
317
|
+
&:hover {
|
|
318
|
+
color: darken($observ-primary, 10%);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&__subtitle {
|
|
323
|
+
color: $observ-gray-500;
|
|
324
|
+
margin-top: $observ-spacing-xs;
|
|
325
|
+
font-size: $observ-font-size-sm;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Badge modifier for "default" state
|
|
330
|
+
.observ-badge--default {
|
|
331
|
+
background-color: $observ-gray-100;
|
|
332
|
+
color: $observ-gray-600;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// Prompt Actions Component
|
|
336
|
+
.prompt-actions {
|
|
337
|
+
display: flex;
|
|
338
|
+
gap: $observ-spacing-sm;
|
|
339
|
+
align-items: center;
|
|
340
|
+
|
|
341
|
+
// Ensure button_to forms display inline and don't affect layout
|
|
342
|
+
form {
|
|
343
|
+
display: inline-flex;
|
|
344
|
+
margin: 0;
|
|
345
|
+
padding: 0;
|
|
346
|
+
border: none;
|
|
347
|
+
background: none;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Ensure all buttons (both links and actual buttons) have same height
|
|
351
|
+
.observ-button,
|
|
352
|
+
button.observ-button {
|
|
353
|
+
display: inline-flex;
|
|
354
|
+
align-items: center;
|
|
355
|
+
justify-content: center;
|
|
356
|
+
line-height: 1;
|
|
357
|
+
white-space: nowrap;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// Reset button element defaults
|
|
361
|
+
button.observ-button {
|
|
362
|
+
border: 1px solid $observ-gray-300;
|
|
363
|
+
font-family: inherit;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@import 'variables';
|
|
2
|
+
|
|
3
|
+
.observ-table {
|
|
4
|
+
width: 100%;
|
|
5
|
+
border-collapse: collapse;
|
|
6
|
+
font-size: $observ-font-size-sm;
|
|
7
|
+
|
|
8
|
+
&__header {
|
|
9
|
+
background-color: $observ-gray-50;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&__row {
|
|
13
|
+
border-bottom: 1px solid $observ-gray-200;
|
|
14
|
+
transition: $observ-transition;
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
background-color: $observ-gray-50;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&__cell {
|
|
22
|
+
padding: $observ-spacing-md;
|
|
23
|
+
text-align: left;
|
|
24
|
+
color: $observ-gray-700;
|
|
25
|
+
|
|
26
|
+
&--numeric {
|
|
27
|
+
text-align: right;
|
|
28
|
+
font-variant-numeric: tabular-nums;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&--actions {
|
|
32
|
+
text-align: right;
|
|
33
|
+
width: 1%;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
thead & {
|
|
38
|
+
font-weight: 600;
|
|
39
|
+
color: $observ-gray-900;
|
|
40
|
+
text-transform: uppercase;
|
|
41
|
+
letter-spacing: 0.05em;
|
|
42
|
+
font-size: $observ-font-size-xs;
|
|
43
|
+
padding-top: $observ-spacing-sm;
|
|
44
|
+
padding-bottom: $observ-spacing-sm;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&--compact {
|
|
49
|
+
.observ-table__cell {
|
|
50
|
+
padding: $observ-spacing-sm $observ-spacing-md;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
$observ-primary: #3b82f6;
|
|
2
|
+
$observ-success: #10b981;
|
|
3
|
+
$observ-warning: #f59e0b;
|
|
4
|
+
$observ-danger: #ef4444;
|
|
5
|
+
$observ-info: #06b6d4;
|
|
6
|
+
|
|
7
|
+
$observ-gray-50: #f9fafb;
|
|
8
|
+
$observ-gray-100: #f3f4f6;
|
|
9
|
+
$observ-gray-200: #e5e7eb;
|
|
10
|
+
$observ-gray-300: #d1d5db;
|
|
11
|
+
$observ-gray-400: #9ca3af;
|
|
12
|
+
$observ-gray-500: #6b7280;
|
|
13
|
+
$observ-gray-600: #4b5563;
|
|
14
|
+
$observ-gray-700: #374151;
|
|
15
|
+
$observ-gray-800: #1f2937;
|
|
16
|
+
$observ-gray-900: #111827;
|
|
17
|
+
|
|
18
|
+
$observ-white: #ffffff;
|
|
19
|
+
$observ-black: #000000;
|
|
20
|
+
|
|
21
|
+
$observ-spacing-xs: 0.25rem;
|
|
22
|
+
$observ-spacing-sm: 0.5rem;
|
|
23
|
+
$observ-spacing-md: 1rem;
|
|
24
|
+
$observ-spacing-lg: 1.5rem;
|
|
25
|
+
$observ-spacing-xl: 2rem;
|
|
26
|
+
$observ-spacing-2xl: 3rem;
|
|
27
|
+
|
|
28
|
+
$observ-border-radius: 0.5rem;
|
|
29
|
+
$observ-border-radius-sm: 0.25rem;
|
|
30
|
+
$observ-border-radius-lg: 0.75rem;
|
|
31
|
+
|
|
32
|
+
$observ-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
33
|
+
$observ-font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
|
|
34
|
+
|
|
35
|
+
$observ-font-size-xs: 0.75rem;
|
|
36
|
+
$observ-font-size-sm: 0.875rem;
|
|
37
|
+
$observ-font-size-base: 1rem;
|
|
38
|
+
$observ-font-size-lg: 1.125rem;
|
|
39
|
+
$observ-font-size-xl: 1.25rem;
|
|
40
|
+
$observ-font-size-2xl: 1.5rem;
|
|
41
|
+
$observ-font-size-3xl: 1.875rem;
|
|
42
|
+
|
|
43
|
+
$observ-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
44
|
+
$observ-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
|
|
45
|
+
$observ-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
46
|
+
$observ-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
|
|
47
|
+
|
|
48
|
+
$observ-transition: all 0.15s ease-in-out;
|
|
49
|
+
|
|
50
|
+
$observ-breakpoint-sm: 640px;
|
|
51
|
+
$observ-breakpoint-md: 768px;
|
|
52
|
+
$observ-breakpoint-lg: 1024px;
|
|
53
|
+
$observ-breakpoint-xl: 1280px;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@import 'variables';
|
|
2
|
+
@import 'layout';
|
|
3
|
+
@import 'card';
|
|
4
|
+
@import 'metrics';
|
|
5
|
+
@import 'dashboard';
|
|
6
|
+
@import 'table';
|
|
7
|
+
@import 'components';
|
|
8
|
+
@import 'observations';
|
|
9
|
+
@import 'chat';
|
|
10
|
+
@import 'drawer';
|
|
11
|
+
@import 'annotations';
|
|
12
|
+
@import 'prompts';
|
|
13
|
+
@import 'datasets';
|
|
14
|
+
@import 'json_viewer';
|
|
15
|
+
@import 'pagination';
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
module Observ
|
|
2
|
+
class AnnotationsController < ApplicationController
|
|
3
|
+
before_action :set_annotatable, except: [ :sessions_index, :traces_index, :export ]
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
@annotations = @annotatable.annotations
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def sessions_index
|
|
10
|
+
@sessions = Observ::Session.joins(:annotations)
|
|
11
|
+
.distinct
|
|
12
|
+
.order(created_at: :desc)
|
|
13
|
+
.page(params[:page])
|
|
14
|
+
.per(Observ.config.pagination_per_page)
|
|
15
|
+
|
|
16
|
+
@annotations = Observ::Annotation
|
|
17
|
+
.where(annotatable_type: "Observ::Session")
|
|
18
|
+
.includes(:annotatable)
|
|
19
|
+
.order(created_at: :desc)
|
|
20
|
+
.page(params[:page])
|
|
21
|
+
.per(Observ.config.pagination_per_page)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def traces_index
|
|
25
|
+
@traces = Observ::Trace.joins(:annotations)
|
|
26
|
+
.distinct
|
|
27
|
+
.order(created_at: :desc)
|
|
28
|
+
.page(params[:page])
|
|
29
|
+
.per(Observ.config.pagination_per_page)
|
|
30
|
+
|
|
31
|
+
@annotations = Observ::Annotation
|
|
32
|
+
.where(annotatable_type: "Observ::Trace")
|
|
33
|
+
.includes(:annotatable)
|
|
34
|
+
.order(created_at: :desc)
|
|
35
|
+
.page(params[:page])
|
|
36
|
+
.per(Observ.config.pagination_per_page)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def export
|
|
40
|
+
@annotations = case params[:type]
|
|
41
|
+
when "sessions"
|
|
42
|
+
Observ::Annotation.where(annotatable_type: "Observ::Session").includes(:annotatable).order(created_at: :desc)
|
|
43
|
+
when "traces"
|
|
44
|
+
Observ::Annotation.where(annotatable_type: "Observ::Trace").includes(:annotatable).order(created_at: :desc)
|
|
45
|
+
else
|
|
46
|
+
Observ::Annotation.all.includes(:annotatable).order(created_at: :desc)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
respond_to do |format|
|
|
50
|
+
format.csv do
|
|
51
|
+
send_data generate_csv(@annotations),
|
|
52
|
+
filename: "annotations_#{params[:type] || 'all'}_#{Time.current.strftime('%Y%m%d_%H%M%S')}.csv",
|
|
53
|
+
type: "text/csv"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def create
|
|
59
|
+
@annotation = @annotatable.annotations.build(annotation_params)
|
|
60
|
+
|
|
61
|
+
if @annotation.save
|
|
62
|
+
respond_to do |format|
|
|
63
|
+
format.turbo_stream do
|
|
64
|
+
streams = [
|
|
65
|
+
turbo_stream.prepend(
|
|
66
|
+
"annotations-list",
|
|
67
|
+
partial: "observ/annotations/annotation",
|
|
68
|
+
locals: { annotation: @annotation, annotatable: @annotatable }
|
|
69
|
+
),
|
|
70
|
+
turbo_stream.replace(
|
|
71
|
+
"annotation-form",
|
|
72
|
+
partial: "observ/annotations/form",
|
|
73
|
+
locals: { annotatable: @annotatable, annotation: @annotatable.annotations.build }
|
|
74
|
+
),
|
|
75
|
+
turbo_stream.update("annotations-count", @annotatable.annotations.count)
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
empty_state = helpers.content_tag(:div, id: "annotations-empty-state")
|
|
79
|
+
streams << turbo_stream.remove("annotations-empty-state") if @annotatable.annotations.count == 1
|
|
80
|
+
|
|
81
|
+
render turbo_stream: streams
|
|
82
|
+
end
|
|
83
|
+
format.html { redirect_back(fallback_location: root_path, notice: "Annotation added successfully.") }
|
|
84
|
+
end
|
|
85
|
+
else
|
|
86
|
+
respond_to do |format|
|
|
87
|
+
format.turbo_stream do
|
|
88
|
+
render turbo_stream: turbo_stream.replace(
|
|
89
|
+
"annotation-form",
|
|
90
|
+
partial: "observ/annotations/form",
|
|
91
|
+
locals: { annotatable: @annotatable, annotation: @annotation }
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
format.html { redirect_back(fallback_location: root_path, alert: "Failed to add annotation.") }
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def destroy
|
|
100
|
+
@annotation = @annotatable.annotations.find(params[:id])
|
|
101
|
+
@annotation.destroy
|
|
102
|
+
|
|
103
|
+
respond_to do |format|
|
|
104
|
+
format.turbo_stream do
|
|
105
|
+
render turbo_stream: turbo_stream.remove("annotation_#{@annotation.id}")
|
|
106
|
+
end
|
|
107
|
+
format.html { redirect_back(fallback_location: root_path, notice: "Annotation deleted.") }
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
private
|
|
112
|
+
|
|
113
|
+
def set_annotatable
|
|
114
|
+
if params[:session_id]
|
|
115
|
+
@annotatable = Observ::Session.find(params[:session_id])
|
|
116
|
+
elsif params[:trace_id]
|
|
117
|
+
@annotatable = Observ::Trace.find(params[:trace_id])
|
|
118
|
+
else
|
|
119
|
+
redirect_to root_path, alert: "Invalid resource"
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def annotation_params
|
|
124
|
+
params.require(:annotation).permit(:content)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def generate_csv(annotations)
|
|
128
|
+
CSV.generate(headers: true) do |csv|
|
|
129
|
+
csv << [ "ID", "Content", "Annotatable Type", "Annotatable ID", "Created At", "Updated At" ]
|
|
130
|
+
|
|
131
|
+
annotations.each do |annotation|
|
|
132
|
+
csv << [
|
|
133
|
+
annotation.id,
|
|
134
|
+
annotation.content,
|
|
135
|
+
annotation.annotatable_type,
|
|
136
|
+
annotation.annotatable_id,
|
|
137
|
+
annotation.created_at.iso8601,
|
|
138
|
+
annotation.updated_at.iso8601
|
|
139
|
+
]
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module Observ
|
|
2
|
+
class ChatsController < ApplicationController
|
|
3
|
+
before_action :set_chat, only: [ :show ]
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
@chats = ::Chat.order(created_at: :desc)
|
|
7
|
+
.page(params[:page])
|
|
8
|
+
.per(Observ.config.pagination_per_page)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def new
|
|
12
|
+
@chat = ::Chat.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def create
|
|
16
|
+
@chat = ::Chat.new(params_chat)
|
|
17
|
+
|
|
18
|
+
# Set prompt name from agent if applicable
|
|
19
|
+
set_prompt_info_from_agent
|
|
20
|
+
|
|
21
|
+
if @chat.save
|
|
22
|
+
redirect_to chat_path(@chat), notice: "Chat was successfully created."
|
|
23
|
+
else
|
|
24
|
+
render :new, status: :unprocessable_content
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def show
|
|
29
|
+
@message = @chat.messages.build
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def params_chat
|
|
35
|
+
params.require(:chat).permit(:agent_class_name, :prompt_version)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def set_prompt_info_from_agent
|
|
39
|
+
return unless @chat.agent_class_name.present?
|
|
40
|
+
|
|
41
|
+
agent_class = @chat.agent_class_name.constantize
|
|
42
|
+
|
|
43
|
+
# Check if agent uses prompt management
|
|
44
|
+
if agent_class.included_modules.include?(Observ::PromptManagement) &&
|
|
45
|
+
agent_class.respond_to?(:prompt_management_enabled?) &&
|
|
46
|
+
agent_class.prompt_management_enabled?
|
|
47
|
+
@chat.prompt_name = agent_class.prompt_config[:prompt_name]
|
|
48
|
+
end
|
|
49
|
+
rescue NameError => e
|
|
50
|
+
Rails.logger.warn("Agent class not found: #{@chat.agent_class_name} - #{e.message}")
|
|
51
|
+
# Agent class not found, continue without setting prompt_name
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def set_chat
|
|
55
|
+
@chat = ::Chat.find(params[:id])
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|