mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
more updates
This commit is contained in:
parent
965de92642
commit
d327aaa92c
4 changed files with 146 additions and 137 deletions
|
|
@ -13,40 +13,40 @@ properties:
|
|||
type: array
|
||||
items:
|
||||
type: object
|
||||
llm_providers_v2:
|
||||
type: object
|
||||
listeners:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
ingress_traffic:
|
||||
type: object
|
||||
properties:
|
||||
address:
|
||||
type: string
|
||||
port:
|
||||
type: integer
|
||||
message_format:
|
||||
type: string
|
||||
enum:
|
||||
- openai
|
||||
timeout:
|
||||
type: string
|
||||
anyOf:
|
||||
- type: array
|
||||
- type: object
|
||||
additionalProperties: false
|
||||
egress_traffic:
|
||||
type: object
|
||||
properties:
|
||||
address:
|
||||
type: string
|
||||
port:
|
||||
type: integer
|
||||
message_format:
|
||||
type: string
|
||||
enum:
|
||||
- openai
|
||||
timeout:
|
||||
type: string
|
||||
additionalProperties: false
|
||||
ingress_traffic:
|
||||
type: object
|
||||
properties:
|
||||
address:
|
||||
type: string
|
||||
port:
|
||||
type: integer
|
||||
message_format:
|
||||
type: string
|
||||
enum:
|
||||
- openai
|
||||
timeout:
|
||||
type: string
|
||||
additionalProperties: false
|
||||
egress_traffic:
|
||||
type: object
|
||||
properties:
|
||||
address:
|
||||
type: string
|
||||
port:
|
||||
type: integer
|
||||
message_format:
|
||||
type: string
|
||||
enum:
|
||||
- openai
|
||||
timeout:
|
||||
type: string
|
||||
additionalProperties: false
|
||||
endpoints:
|
||||
type: object
|
||||
patternProperties:
|
||||
|
|
@ -276,3 +276,4 @@ properties:
|
|||
additionalProperties: false
|
||||
required:
|
||||
- version
|
||||
- listeners
|
||||
|
|
|
|||
|
|
@ -99,38 +99,37 @@ def validate_and_render_schema():
|
|||
model_name_keys = set()
|
||||
model_usage_name_keys = set()
|
||||
|
||||
llm_gateway_listener = config_yaml.get("listeners", {}).get("egress_traffic", {})
|
||||
if llm_gateway_listener.get("port") == None:
|
||||
llm_gateway_listener["port"] = 12000
|
||||
|
||||
if (
|
||||
llm_gateway_listener is None
|
||||
and llm_gateway_listener
|
||||
and config_yaml["llm_providers_v2"]
|
||||
):
|
||||
raise Exception(
|
||||
"Please provide either egress_traffic or llm_providers_v2, not both"
|
||||
)
|
||||
|
||||
if config_yaml.get("llm_providers", None):
|
||||
if config_yaml.get("llm_providers_v2", None) is not None:
|
||||
raise Exception(
|
||||
"Please provide either llm_providers or llm_providers_v2, not both"
|
||||
)
|
||||
config_yaml["llm_providers_v2"] = {
|
||||
"default": {
|
||||
"listener": {
|
||||
"port": llm_gateway_listener["port"],
|
||||
"protocol": llm_gateway_listener.get("message_format", "openai"),
|
||||
},
|
||||
"providers": config_yaml["llm_providers"],
|
||||
# check if type is array or object
|
||||
# if its dict its legacy format let's convert it to array
|
||||
prompt_gateway_listener = None
|
||||
llm_gateway_listener = None
|
||||
if isinstance(config_yaml["listeners"], dict):
|
||||
egress_traffic = config_yaml["listeners"].get("egress_traffic", None)
|
||||
ingress_traffic = config_yaml["listeners"].get("ingress_traffic", None)
|
||||
config_yaml["listeners"] = []
|
||||
if ingress_traffic:
|
||||
prompt_gateway_listener = {
|
||||
"name": "ingress_traffic",
|
||||
"port": ingress_traffic.get("port", 10000),
|
||||
"address": ingress_traffic.get("address", "0.0.0.0"),
|
||||
"timeout": ingress_traffic.get("timeout", "30s"),
|
||||
}
|
||||
}
|
||||
config_yaml["listeners"].append(prompt_gateway_listener)
|
||||
if egress_traffic:
|
||||
llm_gateway_listener = {
|
||||
"name": "egress_traffic",
|
||||
"port": egress_traffic.get("port", 12000),
|
||||
"address": egress_traffic.get("address", "0.0.0.0"),
|
||||
"timeout": egress_traffic.get("timeout", "30s"),
|
||||
"llm_providers": config_yaml.get("llm_providers", []),
|
||||
}
|
||||
config_yaml["listeners"].append(llm_gateway_listener)
|
||||
|
||||
for llm_provider_name, provider_def in config_yaml["llm_providers_v2"].items():
|
||||
provider_listener = provider_def["listener"]
|
||||
for listener in config_yaml["listeners"]:
|
||||
print("Processing listener: ", listener)
|
||||
name = listener.get("name", None)
|
||||
|
||||
for llm_provider in provider_def["providers"]:
|
||||
for llm_provider in listener.get("llm_providers", []):
|
||||
if llm_provider.get("usage", None):
|
||||
llms_with_usage.append(llm_provider["name"])
|
||||
if llm_provider.get("name") in llm_provider_name_set:
|
||||
|
|
@ -243,15 +242,15 @@ def validate_and_render_schema():
|
|||
arch_config_string = yaml.dump(config_yaml)
|
||||
arch_llm_config_string = yaml.dump(config_yaml)
|
||||
|
||||
prompt_gateway_listener = config_yaml.get("listeners", {}).get(
|
||||
"ingress_traffic", {}
|
||||
)
|
||||
if prompt_gateway_listener.get("port") == None:
|
||||
prompt_gateway_listener["port"] = 10000 # default port for prompt gateway
|
||||
if prompt_gateway_listener.get("address") == None:
|
||||
prompt_gateway_listener["address"] = "127.0.0.1"
|
||||
if prompt_gateway_listener.get("timeout") == None:
|
||||
prompt_gateway_listener["timeout"] = "10s"
|
||||
# prompt_gateway_listener = config_yaml.get("listeners", {}).get(
|
||||
# "ingress_traffic", {}
|
||||
# )
|
||||
# if prompt_gateway_listener.get("port") == None:
|
||||
# prompt_gateway_listener["port"] = 10000 # default port for prompt gateway
|
||||
# if prompt_gateway_listener.get("address") == None:
|
||||
# prompt_gateway_listener["address"] = "127.0.0.1"
|
||||
# if prompt_gateway_listener.get("timeout") == None:
|
||||
# prompt_gateway_listener["timeout"] = "10s"
|
||||
|
||||
use_agent_orchestrator = config_yaml.get("overrides", {}).get(
|
||||
"use_agent_orchestrator", False
|
||||
|
|
|
|||
|
|
@ -90,45 +90,49 @@ def test_validate_and_render_happy_path_agent_config(monkeypatch):
|
|||
monkeypatch.setenv("TEMPLATE_ROOT", "../")
|
||||
|
||||
arch_config = """
|
||||
version: v0.1.0
|
||||
version: v0.2.0
|
||||
|
||||
agents:
|
||||
- name: rag_assistant
|
||||
description: t-mobile virtual assistant for device contracts.
|
||||
instructions: |
|
||||
You are a virtual assistant, here to help users answer questions from device contracts team.
|
||||
Use following instructions to process the user request,
|
||||
1. Use query_processor_agent to understand user queries
|
||||
2. Use search_documents to fetch relevant information
|
||||
3. Use response_generator_agent to formulate clear responses
|
||||
model: openai/gpt-4o
|
||||
tools:
|
||||
- name: query_processor_agent
|
||||
# Parses user queries and extracts metadata, also handles clarification workflow
|
||||
protocol: openai
|
||||
endpoint: https://localhost:10500
|
||||
- name: search_documents
|
||||
# Searches the document store for relevant information
|
||||
protocol: openai
|
||||
endpoint: https://localhost:10501
|
||||
- name: response_generator_agent
|
||||
# Generates a final response based on user query and retrieved context
|
||||
protocol: openai
|
||||
endpoint: https://localhost:10502
|
||||
listener:
|
||||
port: 8000
|
||||
protocol: openai
|
||||
path: /v1/chat/completions
|
||||
- name: query_rewriter
|
||||
kind: openai
|
||||
endpoint: openai://localhost:10500
|
||||
- name: context_builder
|
||||
kind: openai
|
||||
endpoint: openai://localhost:10501
|
||||
- name: response_generator
|
||||
kind: openai
|
||||
endpoint: openai://localhost:10502
|
||||
- name: research_agent
|
||||
kind: openai
|
||||
endpoint: https://localhost:10500
|
||||
- name: input_guard_rails
|
||||
kind: openai
|
||||
endpoint: https://localhost:10503
|
||||
|
||||
llm_providers_v2:
|
||||
default:
|
||||
listener:
|
||||
port: 12000
|
||||
protocol: openai
|
||||
providers:
|
||||
- access_key: --
|
||||
listeners:
|
||||
- name: tmobile
|
||||
router: arch_agent_v2
|
||||
agents:
|
||||
- name: simple_tmobile_rag_agent
|
||||
description: t-mobile virtual assistant for device contracts.
|
||||
filter_chain:
|
||||
- query_rewriter
|
||||
- context_builder
|
||||
- response_generator
|
||||
- name: research_agent
|
||||
description: agent to research and gather information from various sources.
|
||||
filter_chain:
|
||||
- research_agent
|
||||
- response_generator
|
||||
port: 8000
|
||||
|
||||
- name: llm_provider
|
||||
description: llm provider configuration
|
||||
port: 12000
|
||||
protocol: openai
|
||||
llm_providers:
|
||||
- access_key: ${OPENAI_API_KEY}
|
||||
model: openai/gpt-4o
|
||||
|
||||
"""
|
||||
arch_config_schema = ""
|
||||
with open("../arch_config_schema.yaml", "r") as file:
|
||||
|
|
|
|||
|
|
@ -1,38 +1,43 @@
|
|||
version: v0.1.0
|
||||
version: v0.2.0
|
||||
|
||||
agents:
|
||||
- name: rag_assistant
|
||||
description: t-mobile virtual assistant for device contracts.
|
||||
instructions: |
|
||||
You are a virtual assistant, here to help users answer questions from device contracts team.
|
||||
Use following instructions to process the user request,
|
||||
1. Use query_processor_agent to understand user queries
|
||||
2. Use search_documents to fetch relevant information
|
||||
3. Use response_generator_agent to formulate clear responses
|
||||
model: openai/gpt-4o
|
||||
tools:
|
||||
- name: query_processor_agent
|
||||
# Parses user queries and extracts metadata, also handles clarification workflow
|
||||
protocol: openai
|
||||
endpoint: https://localhost:10500
|
||||
- name: search_documents_agent
|
||||
# Searches the document store for relevant information
|
||||
protocol: openai
|
||||
endpoint: https://localhost:10501
|
||||
- name: response_generator_agent
|
||||
# Generates a final response based on user query and retrieved context
|
||||
protocol: openai
|
||||
endpoint: https://localhost:10502
|
||||
listener:
|
||||
port: 8000
|
||||
protocol: openai
|
||||
path: /v1/chat/completions
|
||||
- name: query_rewriter
|
||||
kind: openai
|
||||
endpoint: openai://localhost:10500
|
||||
- name: context_builder
|
||||
kind: openai
|
||||
endpoint: openai://localhost:10501
|
||||
- name: response_generator
|
||||
kind: openai
|
||||
endpoint: openai://localhost:10502
|
||||
- name: research_agent
|
||||
kind: openai
|
||||
endpoint: https://localhost:10500
|
||||
- name: input_guard_rails
|
||||
kind: openai
|
||||
endpoint: https://localhost:10503
|
||||
|
||||
llm_providers_v2:
|
||||
default:
|
||||
listener:
|
||||
port: 12000
|
||||
protocol: openai
|
||||
providers:
|
||||
listeners:
|
||||
- name: rag agent
|
||||
router: arch_agent_v2
|
||||
agents:
|
||||
- name: simple_rag_agent
|
||||
description: virtual assistant for device contracts.
|
||||
filter_chain:
|
||||
- query_rewriter
|
||||
- context_builder
|
||||
- response_generator
|
||||
- name: research_agent
|
||||
description: agent to research and gather information from various sources.
|
||||
filter_chain:
|
||||
- research_agent
|
||||
- response_generator
|
||||
port: 8000
|
||||
|
||||
- name: llm_provider
|
||||
description: llm provider configuration
|
||||
port: 12000
|
||||
protocol: openai
|
||||
llm_providers:
|
||||
- access_key: ${OPENAI_API_KEY}
|
||||
model: openai/gpt-4o
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue