using System.Text; using AIStudio.Settings; namespace AIStudio.Tools.RAG; /// /// Tells the model which data sources of the chat could not be searched because their server could not be reached. /// /// /// Semantic Search writes this into the description of its tool, or into the system prompt when no /// data source of the chat can be searched and the tool stays out. The classic RAG process writes it /// next to the passages it found. All use the same words, so that the model hears the same in either way. /// Only external data sources have a server which may be out of reach, hence their kind is not /// listed.

/// The note holds nothing but the names the data sources have in AI Studio, configured by the user /// or the organization, and no word of their servers. It therefore needs no prompt-injection filter, /// like the rest of the description of the tool. ///
public static class UnreachableDataSources { /// /// Writes the note on the given data sources. /// /// The builder to write into. /// The data sources whose server could not be reached, in the order to list them. public static void AppendTo(StringBuilder builder, IReadOnlyList dataSources) { builder.AppendLine("These external data sources of this chat could not be reached or signed in to right now, so they cannot be searched. Their content is missing rather than empty; tell the user so when a question concerns them:"); foreach (var dataSource in dataSources) builder.AppendLine($"- name='{dataSource.Name}'"); } }