Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up stderr out on tests, use Node.findall in docstring parser #3103

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import tool
from promptflow.core import tool


@tool
Expand Down
2 changes: 1 addition & 1 deletion scripts/tool/templates/tool.py.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import tool
from promptflow.core import tool
from promptflow.connections import CustomConnection


Expand Down
2 changes: 1 addition & 1 deletion scripts/tool/templates/tool2.py.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import ToolProvider, tool
from promptflow.core import ToolProvider, tool
import urllib.request


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def parse_description(docstring: str):
found_param_or_type = False

# Traverse the document tree to process nodes
for node in doctree.traverse():
for node in doctree.findall():
if isinstance(node, docutils.nodes.field):
found_param_or_type = True # Mark when we encounter parameter or type fields
field_name = node.children[0].astext().strip()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import requests

from promptflow import tool, ToolProvider
from promptflow.core import tool, ToolProvider
from promptflow.connections import AzureContentSafetyConnection
from promptflow.tools.exception import AzureContentSafetyInputValueError, AzureContentSafetySystemError

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import ToolProvider, tool
from promptflow.core import ToolProvider, tool
from promptflow.core._connection import AzureOpenAIConnection


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from jinja2 import Template

from promptflow import ToolProvider, tool
from promptflow.connections import AzureOpenAIConnection
from promptflow.contracts.types import PromptTemplate
from promptflow.core import ToolProvider, tool


class TestCustomLLMTool(ToolProvider):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from dataclasses import dataclass

from promptflow import tool
from promptflow._core.tools_manager import register_connections
from promptflow.contracts.types import Secret
from promptflow.core import tool


@dataclass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import ToolProvider, tool
from promptflow.core import ToolProvider, tool


class TestLoadErrorTool(ToolProvider):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import pytest

from promptflow import tool
from promptflow._core.tool import InputSetting, ToolType
from promptflow.core import tool
from promptflow.exceptions import UserErrorException
from promptflow.tracing._tracer import Tracer
from promptflow.tracing.contracts.trace import TraceType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import pytest
from mock import MagicMock

from promptflow import tool
from promptflow._core._errors import InputTypeMismatch, InvalidSource, PackageToolNotFoundError
from promptflow._core.tools_manager import (
BuiltinsManager,
Expand All @@ -18,6 +17,7 @@
from promptflow._utils.yaml_utils import load_yaml_string
from promptflow.contracts.flow import InputAssignment, InputValueType, Node, ToolSource, ToolSourceType
from promptflow.contracts.tool import Tool, ToolFuncCallScenario, ToolType
from promptflow.core import tool
from promptflow.exceptions import UserErrorException


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from promptflow import tool
from promptflow.connections import AzureOpenAIConnection
from promptflow.core import tool


@tool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import pytest

from promptflow import tool
from promptflow.contracts.flow import FlowInputDefinition
from promptflow.contracts.tool import ValueType

from promptflow.core import tool
from promptflow.executor.flow_executor import (
FlowExecutor,
_ensure_node_result_is_serializable,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import tool
from promptflow.core import tool
from promptflow.connections import AzureOpenAIConnection


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import tool
from promptflow.core import tool
from promptflow.connections import AzureOpenAIConnection


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import tool
from promptflow.core import tool


@tool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import uuid
from typing import List

from promptflow import tool
from promptflow.core import tool


def get_question_from_conversation_history(conversation_history: List, question: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import uuid
from typing import List

from promptflow import tool
from promptflow.core import tool


@tool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import uuid
from typing import List

from promptflow import tool
from promptflow.core import tool


def get_question_from_conversation_history(conversation_history: List, question: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import List
from promptflow import tool
from promptflow.core import tool
from promptflow.contracts.multimedia import Image


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import io
import random
from pathlib import Path
from promptflow import tool
from promptflow.core import tool
from promptflow.contracts.multimedia import Image
from PIL import Image as PIL_Image

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random

from promptflow.contracts.multimedia import Image
from promptflow import tool
from promptflow.core import tool


@tool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

from promptflow import tool
from promptflow.core import tool


@tool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import bs4
import requests
import random
from promptflow import tool
from promptflow.core import tool


@tool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promptflow import tool
from promptflow.core import tool


@tool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from promptflow import tool
from promptflow.core import tool
import random

# The inputs section will change based on the arguments of the tool function, after you save the code
Expand Down