Upgrade promptui to conform to Gradio V4 (#98)
This commit is contained in:
committed by
GitHub
parent
797df5a69c
commit
1f927d3391
@@ -84,9 +84,7 @@ def handle_node(node: dict) -> dict:
|
||||
|
||||
def handle_input(pipeline: Union[BaseComponent, Type[BaseComponent]]) -> dict:
|
||||
"""Get the input from the pipeline"""
|
||||
if not hasattr(pipeline, "run_raw"):
|
||||
return {}
|
||||
signature = inspect.signature(pipeline.run_raw)
|
||||
signature = inspect.signature(pipeline.run)
|
||||
inputs: Dict[str, Dict] = {}
|
||||
for name, param in signature.parameters.items():
|
||||
if name in ["self", "args", "kwargs"]:
|
||||
|
@@ -4,7 +4,7 @@ from typing import Any, AsyncGenerator
|
||||
|
||||
import anyio
|
||||
from gradio import ChatInterface
|
||||
from gradio.components import IOComponent, get_component_instance
|
||||
from gradio.components import Component, get_component_instance
|
||||
from gradio.events import on
|
||||
from gradio.helpers import special_args
|
||||
from gradio.routes import Request
|
||||
@@ -20,7 +20,7 @@ class ChatBlock(ChatInterface):
|
||||
def __init__(
|
||||
self,
|
||||
*args,
|
||||
additional_outputs: str | IOComponent | list[str | IOComponent] | None = None,
|
||||
additional_outputs: str | Component | list[str | Component] | None = None,
|
||||
**kwargs,
|
||||
):
|
||||
if additional_outputs:
|
||||
|
@@ -44,7 +44,7 @@ class VectorIndexing(BaseIndexing):
|
||||
qa_pipeline=CitationQAPipeline(**kwargs),
|
||||
)
|
||||
|
||||
def run(self, text: str | list[str] | Document | list[Document]) -> None:
|
||||
def run(self, text: str | list[str] | Document | list[Document]):
|
||||
input_: list[Document] = []
|
||||
if not isinstance(text, list):
|
||||
text = [text]
|
||||
|
@@ -111,7 +111,7 @@ class OpenAI(LCCompletionMixin, LLM):
|
||||
openai_api_base: Optional[str] = None,
|
||||
model_name: str = "text-davinci-003",
|
||||
temperature: float = 0.7,
|
||||
max_token: int = 256,
|
||||
max_tokens: int = 256,
|
||||
top_p: float = 1,
|
||||
frequency_penalty: float = 0,
|
||||
n: int = 1,
|
||||
@@ -126,7 +126,7 @@ class OpenAI(LCCompletionMixin, LLM):
|
||||
openai_api_base=openai_api_base,
|
||||
model_name=model_name,
|
||||
temperature=temperature,
|
||||
max_token=max_token,
|
||||
max_tokens=max_tokens,
|
||||
top_p=top_p,
|
||||
frequency_penalty=frequency_penalty,
|
||||
n=n,
|
||||
@@ -154,7 +154,7 @@ class AzureOpenAI(LCCompletionMixin, LLM):
|
||||
openai_api_key: Optional[str] = None,
|
||||
model_name: str = "text-davinci-003",
|
||||
temperature: float = 0.7,
|
||||
max_token: int = 256,
|
||||
max_tokens: int = 256,
|
||||
top_p: float = 1,
|
||||
frequency_penalty: float = 0,
|
||||
n: int = 1,
|
||||
@@ -171,7 +171,7 @@ class AzureOpenAI(LCCompletionMixin, LLM):
|
||||
openai_api_key=openai_api_key,
|
||||
model_name=model_name,
|
||||
temperature=temperature,
|
||||
max_token=max_token,
|
||||
max_tokens=max_tokens,
|
||||
top_p=top_p,
|
||||
frequency_penalty=frequency_penalty,
|
||||
n=n,
|
||||
|
Reference in New Issue
Block a user