Skip to content

Commit

Permalink
Fix run_api args ; Update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
mpangrazzi committed Jan 24, 2025
1 parent 5f6809d commit 32c0266
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/hayhooks/server/utils/base_pipeline_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,39 @@ def __init__(self):
@abstractmethod
def setup(self) -> None:
"""
Setup the pipeline.
Initialize and configure the pipeline.
This method should be called before using the pipeline.
This method will be called before any pipeline operations.
It should initialize `self.pipeline` with the appropriate pipeline.
Pipelines can be loaded from YAML or provided directly as code.
"""
pass

@abstractmethod
def run_api(self, urls: List[str], question: str) -> dict:
def run_api(self):
"""
Run the pipeline in API mode.
Execute the pipeline in API mode.
Args:
urls: List of URLs to fetch content from
question: Question to be answered
This method provides a generic interface for running the pipeline
with implementation-specific parameters.
Returns:
dict: Pipeline execution results
An API endpoint will call this method and will use dynamically created
pydantic models for request and response validation.
"""
pass

@abstractmethod
def run_chat(self, user_message: str, model_id: str, messages: List[dict], body: dict) -> dict:
def run_chat(self, model_id: str, messages: List[dict], body: dict):
"""
Run the pipeline in chat mode.
This method is called when a user sends an OpenAI-compatible chat completion request.
Args:
user_message: Message from the user
model_id: ID of the model to use
messages: List of previous messages
body: Additional request body parameters
This method handles conversational interactions with the pipeline,
maintaining context and processing chat-specific parameters.
Returns:
dict: Pipeline execution results
Args:
model_id: The model (Haystack pipeline) to run
messages: List of previous conversation messages for context
body: Additional parameters and configuration options
"""
pass

0 comments on commit 32c0266

Please sign in to comment.