26 references to SharedAIHelpers
Aspire.Dashboard (18)
Mcp\AspireResourceMcpTools.cs (4)
118var (trimmedItems, limitMessage) = SharedAIHelpers.GetLimitFromEndWithSummary( 124SharedAIHelpers.SerializeLogEntry, 125SharedAIHelpers.EstimateTokenCount); 126var consoleLogsText = SharedAIHelpers.SerializeConsoleLogs(trimmedItems);
Mcp\AspireTelemetryMcpTools.cs (1)
127var (tracesData, limitMessage) = SharedAIHelpers.GetTracesJson(
Model\Assistant\AIHelpers.cs (3)
119resourceObj["dashboard_link"] = SharedAIHelpers.GetDashboardLinkObject(dashboardBaseUrl, DashboardUrls.ResourcesUrl(resource: resource.Name), resourceName); 200return SharedAIHelpers.GetStructuredLogsJson(otlpData.ResourceLogs, getResourceName, includeDashboardUrl ? GetDashboardUrl(options) : null); 205return SharedAIHelpers.GetStructuredLogJson(otlpData.ResourceLogs, getResourceName, includeDashboardUrl ? GetDashboardUrl(options) : null);
Model\Assistant\AssistantChatDataContext.cs (6)
102return SharedAIHelpers.GetTraceJson(spans, r => OtlpHelpers.GetResourceName(r, resources), AIHelpers.GetDashboardUrl(_dashboardOptions.CurrentValue)); 180var (tracesData, limitMessage) = SharedAIHelpers.GetTracesJson(spans, r => OtlpHelpers.GetResourceName(r, resources), AIHelpers.GetDashboardUrl(_dashboardOptions.CurrentValue)); 276var (trimmedItems, limitMessage) = SharedAIHelpers.GetLimitFromEndWithSummary( 282SharedAIHelpers.SerializeLogEntry, 283SharedAIHelpers.EstimateTokenCount); 284var consoleLogsText = SharedAIHelpers.SerializeConsoleLogs(trimmedItems);
Model\Assistant\Prompts\KnownChatMessages.cs (3)
290var (tracesData, _) = SharedAIHelpers.GetTracesJson(spans, getResourceName, AIHelpers.GetDashboardUrl(options)); 317var (tracesData, _) = SharedAIHelpers.GetTracesJson(spans, getResourceName, AIHelpers.GetDashboardUrl(options)); 344var (tracesData, limitMessage) = SharedAIHelpers.GetTracesJson(spans, getResourceName, AIHelpers.GetDashboardUrl(options));
src\Shared\ConsoleLogs\PromptContext.cs (1)
21input = SharedAIHelpers.LimitLength(input);
Aspire.Dashboard.Tests (8)
Model\AIAssistant\AIHelpersTests.cs (7)
86var value = SharedAIHelpers.LimitLength("How now brown cow?"); 93var value = SharedAIHelpers.LimitLength(new string('!', 10_000)); 94Assert.Equal($"{new string('!', SharedAIHelpers.MaximumStringLength)}...[TRUNCATED]", value); 108var (items, message) = SharedAIHelpers.GetLimitFromEndWithSummary(values, totalValues: values.Count, limit: 20, "test item", "test items", s => s, s => ((string)s).Length); 126var (items, message) = SharedAIHelpers.GetLimitFromEndWithSummary(values, totalValues: 100, limit: 20, "test item", "test items", s => s, s => ((string)s).Length); 144var (items, message) = SharedAIHelpers.GetLimitFromEndWithSummary(values, totalValues: 100, limit: 5, "test item", "test items", s => s, s => ((string)s).Length); 169var (items, message) = SharedAIHelpers.GetLimitFromEndWithSummary(values, limit: 10, "test item", "test items", s => s, s => ((string)s).Length);
Model\AIAssistant\AssistantChatDataContextTests.cs (1)
123var line = SharedAIHelpers.LimitLength(new string((char)('a' + i), 10_000));