Coordinator#
- class lumen.ai.coordinator.Coordinator(llm: Llm | None = None, interface: ChatInterface | None = None, agents: list[Agent | type[Agent]] | None = None, logs_db_path: str = '', **params)#
A Coordinator is responsible for coordinating the actions of a number of agents towards the user defined query by computing an execution graph and then executing each step along the graph.
Parameters#
type: list
default: [<class 'lumen.ai.agents.ChatAgent'>]
List of agents to coordinate.
type: list
default: ['What datasets are available?', 'Show me the the first dataset and its columns.', 'What are some interesting analyses I can do?', 'Perform an analysis using the first suggestion.', 'Show me a plot of these results.']
List of instructions to demo the Coordinator.
type: int
default: 3
bounds: None
Number of previous user-assistant interactions to include in the chat history.
type: panel.chat.ChatInterface
default: None
The ChatInterface for the Coordinator to interact with.
type: lumen.ai.llm.Llm
default: None
The LLM implementation to query.
type: str
default: None
The path to the log file that will store the messages exchanged with the LLM.
type: lumen.ai.memory._Memory
default: None
Local memory which will be used to provide the agent context.If None the global memory will be used.
type: str
default: 'Coordinator'
String identifier for this object.
type: dict
default: {}
A dictionary of prompts used by the actor, indexed by prompt name.Each prompt should be defined as a dictionary containing a template’template’ and optionally a ‘model’ and ‘tools’.
type: bool
default: True
Whether to write outputs to the ChatInterface.
type: list
default: ['What datasets are available?', "What's interesting to analyze?", 'Can you visualize the data?']
Initial list of suggestions of actions the user can take.
type: dict
default: {}
Overrides the template’s ‘instructions’, ‘context’, ‘tools’, or ‘examples’ jinja2 blocks.Is a nested dictionary with the prompt name (e.g. main) as the keyand the block names as the inner keys with the new content as thevalues.
type: list
default: []
Methods#
- async Coordinator.respond(messages: list[Message], **kwargs: dict[str, Any]) str #
Responds to the provided messages.
- Coordinator.servable(title: str | None = None, location: bool | Location = True, area: str = 'main', target: str | None = None) Viewable #
Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.
- Parameters:
title (str) – A string title to give the Document (if served as an app)
location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.
area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.
target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.
- Return type:
The Panel object itself
- Coordinator.show(title: str | None = None, port: int = 0, address: str | None = None, websocket_origin: str | None = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | Location = True, **kwargs) threading.Thread | Server #
Starts a Bokeh server and displays the Viewable in a new tab.
- Parameters:
title (str | None) – A string title to give the Document (if served as an app)
port (int (optional, default=0)) – Allows specifying a specific port
address (str) – The address the server should listen on for HTTP requests.
websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.
threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.
verbose (boolean (optional, default=True)) – Whether to print the address and port
open (boolean (optional, default=True)) – Whether to open the server in a new browser tab
location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.
- Returns:
server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)
- Return type:
bokeh.server.Server or panel.io.server.StoppableThread
Types#
DependencyResolver is a type of Coordinator that chooses the agent
The Planner develops a plan to solve the user query step-by-step