Skip to content

Conversation

@stefanorosanelli
Copy link
Contributor

This commit introduces a new markdown file, services_and_tasks.md, which explains the architecture and usage of Services and Tasks within the Brevia framework.

The documentation covers:

  • The role and implementation of BaseService, including how to create custom services.
  • The role and implementation of BaseAnalysisTask, including how to create custom tasks and their interaction with LangChain.
  • The relationship and typical workflow between Services and Tasks.
  • Guidance on customization, with references to existing tutorials and prompt management.

The mkdocs.yml file has also been updated to include this new page in the site navigation under "Services and Tasks".

This commit introduces a new markdown file, `services_and_tasks.md`, which explains the architecture and usage of Services and Tasks within the Brevia framework.

The documentation covers:
- The role and implementation of `BaseService`, including how to create custom services.
- The role and implementation of `BaseAnalysisTask`, including how to create custom tasks and their interaction with LangChain.
- The relationship and typical workflow between Services and Tasks.
- Guidance on customization, with references to existing tutorials and prompt management.

The `mkdocs.yml` file has also been updated to include this new page in the site navigation under "Services and Tasks".
@stefanorosanelli stefanorosanelli requested a review from Copilot May 21, 2025 14:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds comprehensive documentation for the Services and Tasks architecture in the Brevia framework and updates site navigation.

  • Introduces services_and_tasks.md detailing BaseService, BaseAnalysisTask, typical workflows, and customization guidance.
  • Updates mkdocs.yml to register the new documentation page in the site navigation.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
mkdocs.yml Added “Services and Tasks” to the navigation menu
docs/services_and_tasks.md New documentation on Services, Tasks, and workflows
Comments suppressed due to low confidence (1)

mkdocs.yml:59

  • [nitpick] Indentation here is inconsistent with the surrounding nav entries (which use 4 spaces). Adjust to match the existing format so the page appears correctly under the parent section.
  - Services and Tasks: services_and_tasks.md

Comment on lines +69 to +75
# The run method would raise a ValueError if validate returns False

# print(f"Running with invalid payload (missing key): {invalid_payload_missing}")
# try:
# service.run(invalid_payload_missing)
# except ValueError as e:
# print(f"Error: {e}") # Similar to above
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment contradicts the earlier note about validation printing and returning False. Clarify whether run raises a ValueError on validation failure and update the example comments to reflect the actual behavior.

Suggested change
# The run method would raise a ValueError if validate returns False
# print(f"Running with invalid payload (missing key): {invalid_payload_missing}")
# try:
# service.run(invalid_payload_missing)
# except ValueError as e:
# print(f"Error: {e}") # Similar to above
# The run method does not raise a ValueError; it relies on validate to handle errors.
# print(f"Running with invalid payload (missing key): {invalid_payload_missing}")
# try:
# service.run(invalid_payload_missing)
# except ValueError as e:
# print(f"Error: {e}") # Similar to above: validate prints the error and returns False, but no exception is raised.

Copilot uses AI. Check for mistakes.
class SimpleTextAnalysisTask(BaseAnalysisTask):
"""A simple task to analyze a piece of text."""

def __init__(self, text: str, custom_prompt_template: str | None = None):
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] It’s recommended to call super().__init__() within the constructor to ensure any initialization in BaseAnalysisTask is properly executed.

Suggested change
def __init__(self, text: str, custom_prompt_template: str | None = None):
def __init__(self, text: str, custom_prompt_template: str | None = None):
super().__init__() # Ensure proper initialization of the base class

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants