33
44from assistant_extensions .ai_clients .config import AzureOpenAIClientConfigModel , OpenAIClientConfigModel
55from assistant_extensions .attachments import AttachmentsConfigModel
6+ from assistant_extensions .document_editor import DocumentEditorConfigModel
67from assistant_extensions .mcp import HostedMCPServerConfig , MCPClientRoot , MCPServerConfig
78from content_safety .evaluators import CombinedContentSafetyEvaluatorConfig
89from openai_client import (
1213)
1314from pydantic import BaseModel , Field
1415from semantic_workbench_assistant .config import UISchema , first_env_var
15- from assistant_extensions .document_editor import DocumentEditorConfigModel
1616
1717from . import helpers
1818
2727
2828
2929#
30- # region Assistant Configuration
30+ # region Codespace Assistant Default Configuration
3131#
3232
3333
@@ -491,7 +491,138 @@ class AssistantConfigModel(BaseModel):
491491 # add any additional configuration fields
492492
493493
494+ # endregion
495+
496+
497+ # region: New Workspace Assistant Default Configuration
498+
499+
500+ class WorkspaceHostedMCPServersConfigModel (HostedMCPServersConfigModel ):
501+ web_research : Annotated [
502+ HostedMCPServerConfig ,
503+ Field (
504+ title = "Web Research" ,
505+ description = "Enable your assistant to perform web research on a given topic. It will generate a list of facts it needs to collect and use Bing search and simple web requests to fill in the facts. Once it decides it has enough, it will summarize the information and return it as a report." ,
506+ ),
507+ UISchema (collapsible = False ),
508+ ] = HostedMCPServerConfig .from_env ("web-research" , "MCP_SERVER_WEB_RESEARCH_URL" )
509+
510+ open_deep_research_clone : Annotated [
511+ HostedMCPServerConfig ,
512+ Field (
513+ title = "Open Deep Research Clone" ,
514+ description = "Enable a web research tool that is modeled after the Open Deep Research project as a demonstration of writing routines using our Skills library." ,
515+ ),
516+ UISchema (collapsible = False ),
517+ ] = HostedMCPServerConfig .from_env (
518+ "open-deep-research-clone" , "MCP_SERVER_OPEN_DEEP_RESEARCH_CLONE_URL" , enabled = False
519+ )
520+
521+ giphy : Annotated [
522+ HostedMCPServerConfig ,
523+ Field (
524+ title = "Giphy" ,
525+ description = "Enable your assistant to search for and share GIFs from Giphy." ,
526+ ),
527+ UISchema (collapsible = False ),
528+ ] = HostedMCPServerConfig .from_env ("giphy" , "MCP_SERVER_GIPHY_URL" , enabled = False )
529+
530+ memory_user_bio : Annotated [
531+ HostedMCPServerConfig ,
532+ Field (
533+ title = "User-Bio Memories" ,
534+ description = dedent ("""
535+ Enable this assistant to store long-term memories about you, the user (\" user-bio\" memories).
536+ This implementation is modeled after ChatGPT's memory system.
537+ These memories are available to the assistant in all conversations, much like ChatGPT memories are available
538+ to ChatGPT in all chats.
539+ To determine what memories are saved, you can ask the assistant what memories it has of you.
540+ To forget a memory, you can ask the assistant to forget it.
541+ """ ).strip (),
542+ ),
543+ UISchema (collapsible = False ),
544+ ] = HostedMCPServerConfig .from_env (
545+ "memory-user-bio" ,
546+ "MCP_SERVER_MEMORY_USER_BIO_URL" ,
547+ # scopes the memories to the assistant instance
548+ roots = [MCPClientRoot (name = "session-id" , uri = "file://{assistant_id}" )],
549+ # auto-include the user-bio memory prompt
550+ prompts_to_auto_include = ["user-bio" ],
551+ enabled = True ,
552+ )
553+
554+ filesystem_edit : Annotated [
555+ HostedMCPServerConfig ,
556+ Field (
557+ title = "Document Editor" ,
558+ description = dedent ("""
559+ Enable this to create, edit, and refine documents, all through chat.
560+ """ ).strip (),
561+ ),
562+ UISchema (collapsible = False ),
563+ ] = HostedMCPServerConfig .from_env (
564+ "filesystem-edit" ,
565+ "MCP_SERVER_FILESYSTEM_EDIT_URL" ,
566+ # configures the filesystem edit server to use the client-side storage (using the magic hostname of "workspace")
567+ roots = [MCPClientRoot (name = "root" , uri = "file://workspace/" )],
568+ prompts_to_auto_include = ["instructions" ],
569+ enabled = True ,
570+ )
571+
572+ @property
573+ def mcp_servers (self ) -> list [HostedMCPServerConfig ]:
574+ """
575+ Returns a list of all hosted MCP servers that are configured.
576+ """
577+ # Get all fields that are of type HostedMCPServerConfig
578+ configs = [
579+ getattr (self , field )
580+ for field in self .model_fields
581+ if isinstance (getattr (self , field ), HostedMCPServerConfig )
582+ ]
583+ # Filter out any configs that are missing command (URL)
584+ return [config for config in configs if config .command ]
585+
586+
587+ class WorkspaceAdvancedToolConfigModel (AdvancedToolConfigModel ):
588+ max_steps : Annotated [
589+ int ,
590+ Field (
591+ title = "Maximum Steps" ,
592+ description = "The maximum number of steps to take when using tools, to avoid infinite loops." ,
593+ ),
594+ ] = 15
595+
596+ additional_instructions : Annotated [
597+ str ,
598+ Field (
599+ title = "Tools Instructions" ,
600+ description = dedent ("""
601+ General instructions for using tools. No need to include a list of tools or instruction
602+ on how to use them in general, that will be handled automatically. Instead, use this
603+ space to provide any additional instructions for using specific tools, such folders to
604+ exclude in file searches, or instruction to always re-read a file before using it.
605+ """ ).strip (),
606+ ),
607+ UISchema (widget = "textarea" , enable_markdown_in_description = True ),
608+ ] = ""
609+
610+
494611class WorkspaceMCPToolsConfigModel (MCPToolsConfigModel ):
612+ enabled : Annotated [
613+ bool ,
614+ Field (title = "Enable experimental use of tools" ),
615+ ] = True
616+
617+ hosted_mcp_servers : Annotated [
618+ HostedMCPServersConfigModel ,
619+ Field (
620+ title = "Hosted MCP Servers" ,
621+ description = "Configuration for hosted MCP servers that provide tools to the assistant." ,
622+ ),
623+ UISchema (collapsed = False , items = UISchema (title_fields = ["key" , "enabled" ])),
624+ ] = WorkspaceHostedMCPServersConfigModel ()
625+
495626 personal_mcp_servers : Annotated [
496627 list [MCPServerConfig ],
497628 Field (
@@ -501,13 +632,39 @@ class WorkspaceMCPToolsConfigModel(MCPToolsConfigModel):
501632 UISchema (items = UISchema (collapsible = False , hide_title = True , title_fields = ["key" , "enabled" ])),
502633 ] = []
503634
635+ advanced : Annotated [
636+ AdvancedToolConfigModel ,
637+ Field (
638+ title = "Advanced Tool Settings" ,
639+ ),
640+ ] = WorkspaceAdvancedToolConfigModel ()
641+
642+
643+ class WorkspaceExtensionsConfigModel (ExtensionsConfigModel ):
644+ attachments : Annotated [
645+ AttachmentsConfigModel ,
646+ Field (
647+ title = "Attachments Extension" ,
648+ description = "Configuration for the attachments extension." ,
649+ ),
650+ ] = AttachmentsConfigModel (
651+ context_description = dedent ("""
652+ These attachments were provided for additional context to accompany the
653+ conversation. Consider any rationale provided for why they were included.
654+ Always reference them factually and accurately in your responses.
655+ """ ).strip (),
656+ preferred_message_role = "system" ,
657+ )
658+
504659
505660class WorkspacePromptsConfigModel (PromptsConfigModel ):
506661 instruction_prompt : Annotated [
507662 str ,
508663 Field (
509664 title = "Instruction Prompt" ,
510- description = "The prompt used to instruct the behavior and capabilities of the AI assistant and any preferences." ,
665+ description = dedent ("""
666+ The prompt used to instruct the behavior and capabilities of the AI assistant and any preferences.
667+ """ ).strip (),
511668 ),
512669 UISchema (widget = "textarea" ),
513670 ] = helpers .load_text_include ("instruction_prompt_workspace.txt" )
@@ -516,7 +673,12 @@ class WorkspacePromptsConfigModel(PromptsConfigModel):
516673 str ,
517674 Field (
518675 title = "Guidance Prompt" ,
519- description = "The prompt used to provide a structured set of instructions to carry out a specific workflow from start to finish." ,
676+ description = dedent ("""
677+ The prompt used to provide a structured set of instructions to carry out a specific workflow
678+ from start to finish. It should outline a clear, step-by-step process for gathering necessary
679+ context, breaking down the objective into manageable components, executing the defined steps,
680+ and validating the results.
681+ """ ).strip (),
520682 ),
521683 UISchema (widget = "textarea" ),
522684 ] = helpers .load_text_include ("guidance_prompt_workspace.txt" )
@@ -525,9 +687,14 @@ class WorkspacePromptsConfigModel(PromptsConfigModel):
525687 str ,
526688 Field (
527689 title = "Guardrails Prompt" ,
528- description = "The prompt used to inform the AI assistant about the guardrails to follow." ,
690+ description = (
691+ "The prompt used to inform the AI assistant about the guardrails to follow. Default value based upon"
692+ " recommendations from: [Microsoft OpenAI Service: System message templates]"
693+ "(https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/system-message"
694+ "#define-additional-safety-and-behavioral-guardrails)"
695+ ),
529696 ),
530- UISchema (widget = "textarea" ),
697+ UISchema (widget = "textarea" , enable_markdown_in_description = True ),
531698 ] = helpers .load_text_include ("guardrails_prompt_workspace.txt" )
532699
533700
@@ -539,13 +706,13 @@ class WorkspaceResponseBehaviorConfigModel(ResponseBehaviorConfigModel):
539706 description = "The message to display when the conversation starts." ,
540707 ),
541708 UISchema (widget = "textarea" ),
542- ] = (
543- "Hello! I am an assistant that can help you with projects within the context of the Semantic Workbench, "
544- "your files, and applications. Let's get started by having a conversation about your project. "
545- "You can ask me questions, request code snippets, or ask for help with debugging. I can also help you "
546- "with markdown, code snippets, and other types of content. You can also attach .docx, text, and image files "
547- " to your chat messages to help me better understand the context of our conversation. Where would you like to start?"
548- )
709+ ] = dedent ( """
710+ Welcome to your new Workspace! Here are ideas for how to get started:
711+ - ⚙️ Tell me what you are working on, such as *I'm working on creating a new budget process*
712+ - 🗃️ Upload files you are working with and I'll take it from there
713+ - 📝 I can make you an initial draft like *Write a proposal for new project management software in our department*
714+ - 🧪 Ask me to conduct research for example, *Find me the latest competitors in the wearables market*
715+ """ )
549716
550717
551718class WorkspaceAssistantConfigModel (AssistantConfigModel ):
@@ -557,13 +724,35 @@ class WorkspaceAssistantConfigModel(AssistantConfigModel):
557724 UISchema (collapsed = False , items = UISchema (schema = {"hosted_mcp_servers" : {"ui:options" : {"collapsed" : False }}})),
558725 ] = WorkspaceMCPToolsConfigModel ()
559726
727+ extensions_config : Annotated [
728+ ExtensionsConfigModel ,
729+ Field (
730+ title = "Assistant Extensions" ,
731+ ),
732+ ] = WorkspaceExtensionsConfigModel ()
733+
560734 prompts : Annotated [
561735 PromptsConfigModel ,
562736 Field (
563737 title = "Prompts" ,
738+ description = "Configuration for various prompts used by the assistant." ,
564739 ),
565740 ] = WorkspacePromptsConfigModel ()
566741
742+ response_behavior : Annotated [
743+ ResponseBehaviorConfigModel ,
744+ Field (
745+ title = "Response Behavior" ,
746+ description = "Configuration for the response behavior of the assistant." ,
747+ ),
748+ ] = WorkspaceResponseBehaviorConfigModel ()
749+
750+
751+ # endregion
752+
753+
754+ # region: Context Transfer Assistant Configuration
755+
567756
568757class ContextTransferPromptsConfigModel (PromptsConfigModel ):
569758 instruction_prompt : Annotated [
0 commit comments