From 79fa14acbe71789e56c10544539407b104331c65 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 2 Jun 2024 15:03:08 -0700 Subject: [PATCH] chore: comments --- blueprints/function_calling_blueprint.py | 5 +++-- examples/filters/conversation_turn_limit_filter.py | 5 +++-- examples/filters/detoxify_filter_pipeline.py | 4 ++-- examples/filters/function_calling_filter_pipeline.py | 6 +++++- examples/filters/langfuse_filter_pipeline.py | 4 ++-- examples/filters/libretranslate_filter_pipeline.py | 4 ++-- examples/filters/rate_limit_filter_pipeline.py | 5 +++-- examples/pipelines/integrations/applescript_pipeline.py | 5 ++--- examples/pipelines/integrations/python_code_pipeline.py | 5 ++++- examples/pipelines/integrations/wikipedia_pipeline.py | 5 +++-- examples/pipelines/providers/azure_openai_pipeline.py | 4 ++-- examples/pipelines/providers/cohere_manifold_pipeline.py | 8 +++++++- examples/pipelines/providers/litellm_manifold_pipeline.py | 4 ++-- .../providers/litellm_subprocess_manifold_pipeline.py | 4 ++-- examples/pipelines/providers/llama_cpp_pipeline.py | 4 ++-- examples/pipelines/providers/mlx_pipeline.py | 4 ++-- examples/pipelines/providers/ollama_manifold_pipeline.py | 4 ++-- examples/pipelines/providers/ollama_pipeline.py | 4 ++-- examples/pipelines/providers/openai_pipeline.py | 4 ++-- examples/scaffolds/example_pipeline_scaffold.py | 7 ++++--- examples/scaffolds/filter_pipeline_scaffold.py | 5 +++-- examples/scaffolds/function_calling_scaffold.py | 7 ++++++- examples/scaffolds/manifold_pipeline_scaffold.py | 4 ++-- 23 files changed, 67 insertions(+), 44 deletions(-) diff --git a/blueprints/function_calling_blueprint.py b/blueprints/function_calling_blueprint.py index f9ad77d..4e0f496 100644 --- a/blueprints/function_calling_blueprint.py +++ b/blueprints/function_calling_blueprint.py @@ -34,10 +34,11 @@ class Pipeline: # You can think of filter pipeline as a middleware that can be used to edit the form data before it is sent to the OpenAI API. self.type = "filter" - # Assign a unique identifier to the pipeline. + # Optionally, you can set the id and name of the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "function_calling_blueprint" + # self.id = "function_calling_blueprint" self.name = "Function Calling Blueprint" # Initialize valves diff --git a/examples/filters/conversation_turn_limit_filter.py b/examples/filters/conversation_turn_limit_filter.py index 54e9483..bb31939 100644 --- a/examples/filters/conversation_turn_limit_filter.py +++ b/examples/filters/conversation_turn_limit_filter.py @@ -25,10 +25,11 @@ class Pipeline: # You can think of filter pipeline as a middleware that can be used to edit the form data before it is sent to the OpenAI API. self.type = "filter" - # Assign a unique identifier to the pipeline. + # Optionally, you can set the id and name of the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "conversation_turn_limit_filter_pipeline" + # self.id = "conversation_turn_limit_filter_pipeline" self.name = "Conversation Turn Limit Filter" self.valves = self.Valves( diff --git a/examples/filters/detoxify_filter_pipeline.py b/examples/filters/detoxify_filter_pipeline.py index 7411b39..73fc3a9 100644 --- a/examples/filters/detoxify_filter_pipeline.py +++ b/examples/filters/detoxify_filter_pipeline.py @@ -33,10 +33,10 @@ class Pipeline: self.type = "filter" # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "detoxify_filter_pipeline" + # self.id = "detoxify_filter_pipeline" self.name = "Detoxify Filter" # Initialize diff --git a/examples/filters/function_calling_filter_pipeline.py b/examples/filters/function_calling_filter_pipeline.py index a0f5298..5ea9957 100644 --- a/examples/filters/function_calling_filter_pipeline.py +++ b/examples/filters/function_calling_filter_pipeline.py @@ -84,7 +84,11 @@ class Pipeline(FunctionCallingBlueprint): def __init__(self): super().__init__() - self.id = "my_tools_pipeline" + # Optionally, you can set the id and name of the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. + # The identifier must be unique across all pipelines. + # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. + # self.id = "my_tools_pipeline" self.name = "My Tools Pipeline" self.valves = self.Valves( **{ diff --git a/examples/filters/langfuse_filter_pipeline.py b/examples/filters/langfuse_filter_pipeline.py index f88cad3..f126a70 100644 --- a/examples/filters/langfuse_filter_pipeline.py +++ b/examples/filters/langfuse_filter_pipeline.py @@ -40,10 +40,10 @@ class Pipeline: self.type = "filter" # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "langfuse_filter_pipeline" + # self.id = "langfuse_filter_pipeline" self.name = "Langfuse Filter" # Initialize diff --git a/examples/filters/libretranslate_filter_pipeline.py b/examples/filters/libretranslate_filter_pipeline.py index 37a3547..39e8c5f 100644 --- a/examples/filters/libretranslate_filter_pipeline.py +++ b/examples/filters/libretranslate_filter_pipeline.py @@ -39,10 +39,10 @@ class Pipeline: self.type = "filter" # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "libretranslate_filter_pipeline" + # self.id = "libretranslate_filter_pipeline" self.name = "LibreTranslate Filter" # Initialize diff --git a/examples/filters/rate_limit_filter_pipeline.py b/examples/filters/rate_limit_filter_pipeline.py index f03e18b..d1e8823 100644 --- a/examples/filters/rate_limit_filter_pipeline.py +++ b/examples/filters/rate_limit_filter_pipeline.py @@ -27,10 +27,11 @@ class Pipeline: # You can think of filter pipeline as a middleware that can be used to edit the form data before it is sent to the OpenAI API. self.type = "filter" - # Assign a unique identifier to the pipeline. + # Optionally, you can set the id and name of the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "rate_limit_filter_pipeline" + # self.id = "rate_limit_filter_pipeline" self.name = "Rate Limit Filter" # Initialize rate limits diff --git a/examples/pipelines/integrations/applescript_pipeline.py b/examples/pipelines/integrations/applescript_pipeline.py index c4910a4..bc6266f 100644 --- a/examples/pipelines/integrations/applescript_pipeline.py +++ b/examples/pipelines/integrations/applescript_pipeline.py @@ -9,11 +9,10 @@ from subprocess import call class Pipeline: def __init__(self): # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - - self.id = "applescript_pipeline" + # self.id = "applescript_pipeline" self.name = "AppleScript Pipeline" pass diff --git a/examples/pipelines/integrations/python_code_pipeline.py b/examples/pipelines/integrations/python_code_pipeline.py index bfe432a..938d984 100644 --- a/examples/pipelines/integrations/python_code_pipeline.py +++ b/examples/pipelines/integrations/python_code_pipeline.py @@ -6,7 +6,10 @@ import subprocess class Pipeline: def __init__(self): # Optionally, you can set the id and name of the pipeline. - self.id = "python_code_pipeline" + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. + # The identifier must be unique across all pipelines. + # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. + # self.id = "python_code_pipeline" self.name = "Python Code Pipeline" pass diff --git a/examples/pipelines/integrations/wikipedia_pipeline.py b/examples/pipelines/integrations/wikipedia_pipeline.py index d430123..433a407 100644 --- a/examples/pipelines/integrations/wikipedia_pipeline.py +++ b/examples/pipelines/integrations/wikipedia_pipeline.py @@ -10,10 +10,11 @@ class Pipeline: pass def __init__(self): - # Assign a unique identifier to the pipeline. + # Optionally, you can set the id and name of the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "wiki_pipeline" + # self.id = "wiki_pipeline" self.name = "Wikipedia Pipeline" # Initialize rate limits diff --git a/examples/pipelines/providers/azure_openai_pipeline.py b/examples/pipelines/providers/azure_openai_pipeline.py index 088d8a8..92ef3ad 100644 --- a/examples/pipelines/providers/azure_openai_pipeline.py +++ b/examples/pipelines/providers/azure_openai_pipeline.py @@ -16,10 +16,10 @@ class Pipeline: def __init__(self): # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "azure_openai_pipeline" + # self.id = "azure_openai_pipeline" self.name = "Azure OpenAI Pipeline" self.valves = self.Valves() pass diff --git a/examples/pipelines/providers/cohere_manifold_pipeline.py b/examples/pipelines/providers/cohere_manifold_pipeline.py index 20bc5ec..c99f8c3 100644 --- a/examples/pipelines/providers/cohere_manifold_pipeline.py +++ b/examples/pipelines/providers/cohere_manifold_pipeline.py @@ -24,7 +24,13 @@ class Pipeline: def __init__(self): self.type = "manifold" - self.id = "cohere" + + # Optionally, you can set the id and name of the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. + # The identifier must be unique across all pipelines. + # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. + # self.id = "cohere" + self.name = "cohere/" self.valves = self.Valves(**{"COHERE_API_KEY": os.getenv("COHERE_API_KEY")}) diff --git a/examples/pipelines/providers/litellm_manifold_pipeline.py b/examples/pipelines/providers/litellm_manifold_pipeline.py index f12e93a..40c891c 100644 --- a/examples/pipelines/providers/litellm_manifold_pipeline.py +++ b/examples/pipelines/providers/litellm_manifold_pipeline.py @@ -25,10 +25,10 @@ class Pipeline: self.type = "manifold" # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "litellm_manifold" + # self.id = "litellm_manifold" # Optionally, you can set the name of the manifold pipeline. self.name = "LiteLLM: " diff --git a/examples/pipelines/providers/litellm_subprocess_manifold_pipeline.py b/examples/pipelines/providers/litellm_subprocess_manifold_pipeline.py index f2bdeff..4fab306 100644 --- a/examples/pipelines/providers/litellm_subprocess_manifold_pipeline.py +++ b/examples/pipelines/providers/litellm_subprocess_manifold_pipeline.py @@ -34,10 +34,10 @@ class Pipeline: self.type = "manifold" # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "litellm_subprocess_manifold" + # self.id = "litellm_subprocess_manifold" # Optionally, you can set the name of the manifold pipeline. self.name = "LiteLLM: " diff --git a/examples/pipelines/providers/llama_cpp_pipeline.py b/examples/pipelines/providers/llama_cpp_pipeline.py index 1bb05a6..51692da 100644 --- a/examples/pipelines/providers/llama_cpp_pipeline.py +++ b/examples/pipelines/providers/llama_cpp_pipeline.py @@ -15,10 +15,10 @@ from schemas import OpenAIChatMessage class Pipeline: def __init__(self): # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "llama_cpp_pipeline" + # self.id = "llama_cpp_pipeline" self.name = "Llama C++ Pipeline" self.llm = None diff --git a/examples/pipelines/providers/mlx_pipeline.py b/examples/pipelines/providers/mlx_pipeline.py index 5ba6e92..3921677 100644 --- a/examples/pipelines/providers/mlx_pipeline.py +++ b/examples/pipelines/providers/mlx_pipeline.py @@ -21,10 +21,10 @@ from huggingface_hub import login class Pipeline: def __init__(self): # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "mlx_pipeline" + # self.id = "mlx_pipeline" self.name = "MLX Pipeline" self.host = os.getenv("MLX_HOST", "localhost") self.port = os.getenv("MLX_PORT", "8080") diff --git a/examples/pipelines/providers/ollama_manifold_pipeline.py b/examples/pipelines/providers/ollama_manifold_pipeline.py index a564113..d2e9fce 100644 --- a/examples/pipelines/providers/ollama_manifold_pipeline.py +++ b/examples/pipelines/providers/ollama_manifold_pipeline.py @@ -16,10 +16,10 @@ class Pipeline: self.type = "manifold" # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "ollama_manifold" + # self.id = "ollama_manifold" # Optionally, you can set the name of the manifold pipeline. self.name = "Ollama: " diff --git a/examples/pipelines/providers/ollama_pipeline.py b/examples/pipelines/providers/ollama_pipeline.py index c7134cc..d2560d6 100644 --- a/examples/pipelines/providers/ollama_pipeline.py +++ b/examples/pipelines/providers/ollama_pipeline.py @@ -6,10 +6,10 @@ import requests class Pipeline: def __init__(self): # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "ollama_pipeline" + # self.id = "ollama_pipeline" self.name = "Ollama Pipeline" pass diff --git a/examples/pipelines/providers/openai_pipeline.py b/examples/pipelines/providers/openai_pipeline.py index e72f369..f56905c 100644 --- a/examples/pipelines/providers/openai_pipeline.py +++ b/examples/pipelines/providers/openai_pipeline.py @@ -6,10 +6,10 @@ import requests class Pipeline: def __init__(self): # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "openai_pipeline" + # self.id = "openai_pipeline" self.name = "OpenAI Pipeline" pass diff --git a/examples/scaffolds/example_pipeline_scaffold.py b/examples/scaffolds/example_pipeline_scaffold.py index c321f4b..11e4f0a 100644 --- a/examples/scaffolds/example_pipeline_scaffold.py +++ b/examples/scaffolds/example_pipeline_scaffold.py @@ -9,12 +9,13 @@ class Pipeline: def __init__(self): # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "pipeline_example" - self.name = "Pipeline Example" + # self.id = "pipeline_example" + # The name of the pipeline. + self.name = "Pipeline Example" pass async def on_startup(self): diff --git a/examples/scaffolds/filter_pipeline_scaffold.py b/examples/scaffolds/filter_pipeline_scaffold.py index 0e303c4..562ced3 100644 --- a/examples/scaffolds/filter_pipeline_scaffold.py +++ b/examples/scaffolds/filter_pipeline_scaffold.py @@ -33,10 +33,11 @@ class Pipeline: self.type = "filter" # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "filter_pipeline" + # self.id = "filter_pipeline" + self.name = "Filter" self.valves = self.Valves(**{"pipelines": ["llama3:latest"]}) diff --git a/examples/scaffolds/function_calling_scaffold.py b/examples/scaffolds/function_calling_scaffold.py index 2c9f726..63940e6 100644 --- a/examples/scaffolds/function_calling_scaffold.py +++ b/examples/scaffolds/function_calling_scaffold.py @@ -17,7 +17,12 @@ class Pipeline(FunctionCallingBlueprint): def __init__(self): super().__init__() - self.id = "my_tools_pipeline" + + # Optionally, you can set the id and name of the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. + # The identifier must be unique across all pipelines. + # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. + # self.id = "my_tools_pipeline" self.name = "My Tools Pipeline" self.valves = self.Valves( **{ diff --git a/examples/scaffolds/manifold_pipeline_scaffold.py b/examples/scaffolds/manifold_pipeline_scaffold.py index 80c64fd..13bfc66 100644 --- a/examples/scaffolds/manifold_pipeline_scaffold.py +++ b/examples/scaffolds/manifold_pipeline_scaffold.py @@ -10,10 +10,10 @@ class Pipeline: self.type = "manifold" # Optionally, you can set the id and name of the pipeline. - # Assign a unique identifier to the pipeline. + # Best practice is to not specify the id so that it can be automatically inferred from the filename, so that users can install multiple versions of the same pipeline. # The identifier must be unique across all pipelines. # The identifier must be an alphanumeric string that can include underscores or hyphens. It cannot contain spaces, special characters, slashes, or backslashes. - self.id = "manifold_pipeline" + # self.id = "manifold_pipeline" # Optionally, you can set the name of the manifold pipeline. self.name = "Manifold: "