Skip to content

Commit

Permalink
refactor!: Standardize namespace and add CI for API docs (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadeMe authored Feb 9, 2024
1 parent bca7226 commit 969c02b
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 15 deletions.
2 changes: 1 addition & 1 deletion integrations/uptrain/example/example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# A valid OpenAI API key is required to run this example.

from haystack import Pipeline
from haystack_integrations.components.evaluators import UpTrainEvaluator, UpTrainMetric
from haystack_integrations.components.evaluators.uptrain import UpTrainEvaluator, UpTrainMetric
from haystack.utils import Secret

QUESTIONS = [
Expand Down
30 changes: 30 additions & 0 deletions integrations/uptrain/pydoc/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
loaders:
- type: haystack_pydoc_tools.loaders.CustomPythonLoader
search_path: [../src]
modules:
[
"haystack_integrations.components.evaluators.uptrain.evaluator",
"haystack_integrations.components.evaluators.uptrain.metrics",
]
ignore_when_discovered: ["__init__"]
processors:
- type: filter
expression:
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true
- type: smart
- type: crossref
renderer:
type: haystack_pydoc_tools.renderers.ReadmePreviewRenderer
excerpt: UpTrain integration for Haystack
category_slug: haystack-integrations
title: UpTrain
slug: integrations-uptrain
order: 1
markdown:
descriptive_class_title: false
descriptive_module_title: true
add_method_class_prefix: true
add_member_class_prefix: false
filename: _readme_uptrain.md
3 changes: 2 additions & 1 deletion integrations/uptrain/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ root = "../.."
git_describe_command = 'git describe --tags --match="integrations/uptrain-v[0-9]*"'

[tool.hatch.envs.default]
dependencies = ["coverage[toml]>=6.5", "pytest"]
dependencies = ["coverage[toml]>=6.5", "pytest", "haystack-pydoc-tools"]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
cov-report = ["- coverage combine", "coverage report"]
cov = ["test-cov", "cov-report"]
docs = ["pydoc-markdown pydoc/config.yml"]

[[tool.hatch.envs.all.matrix]]
python = ["3.8", "3.9", "3.10", "3.11"]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .evaluator import UpTrainEvaluator
from .metrics import UpTrainMetric

__all__ = (
"UpTrainEvaluator",
"UpTrainMetric",
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@

from haystack import DeserializationError, component, default_from_dict, default_to_dict
from haystack.utils import Secret, deserialize_secrets_inplace
from haystack_integrations.components.evaluators.uptrain_metrics import (

from uptrain import APIClient, EvalLLM, Evals # type: ignore
from uptrain.framework.evals import ParametricEval

from .metrics import (
METRIC_DESCRIPTORS,
InputConverters,
OutputConverters,
UpTrainMetric,
)
from uptrain import APIClient, EvalLLM, Evals
from uptrain.framework.evals import ParametricEval


@component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from functools import partial
from typing import Any, Callable, Dict, Iterable, List, Optional, Type, Union

from uptrain import CritiqueTone, Evals, GuidelineAdherence, ResponseMatching
from uptrain import CritiqueTone, Evals, GuidelineAdherence, ResponseMatching # type: ignore
from uptrain.framework.evals import ParametricEval


Expand Down
2 changes: 1 addition & 1 deletion integrations/uptrain/tests/test_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from haystack import DeserializationError

from haystack_integrations.components.evaluators import UpTrainEvaluator, UpTrainMetric
from haystack_integrations.components.evaluators.uptrain import UpTrainEvaluator, UpTrainMetric
from haystack.utils import Secret

DEFAULT_QUESTIONS = [
Expand Down
2 changes: 1 addition & 1 deletion integrations/uptrain/tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from haystack_integrations.components.evaluators import UpTrainMetric
from haystack_integrations.components.evaluators.uptrain import UpTrainMetric


def test_uptrain_metric():
Expand Down

0 comments on commit 969c02b

Please sign in to comment.