mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 10:25:23 -04:00
fix some bugs
This commit is contained in:
@@ -2,7 +2,7 @@ from decimal import Decimal
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from dify_plugin.entities.model import BaseModelConfig, ModelType, ModelUsage, PriceInfo
|
||||
from dify_plugin.entities.model.message import (
|
||||
@@ -139,6 +139,6 @@ class LLMModelConfig(BaseModelConfig):
|
||||
|
||||
model_type: ModelType = ModelType.LLM
|
||||
mode: str
|
||||
completion_params: dict | None = None
|
||||
completion_params: dict = Field(default_factory=dict)
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
@@ -34,6 +34,16 @@ class LLMInvocation(BackwardsInvocation[LLMResultChunk]):
|
||||
stream: Literal[False] = False,
|
||||
) -> LLMResult: ...
|
||||
|
||||
@overload
|
||||
def invoke(
|
||||
self,
|
||||
model_config: LLMModelConfig,
|
||||
prompt_messages: list[PromptMessage],
|
||||
tools: list[PromptMessageTool] | None = None,
|
||||
stop: list[str] | None = None,
|
||||
stream: bool = True,
|
||||
) -> Generator[LLMResultChunk, None, None] | LLMResult: ...
|
||||
|
||||
def invoke(
|
||||
self,
|
||||
model_config: LLMModelConfig,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from dify_plugin.core.entities.invocation import InvokeType
|
||||
from dify_plugin.core.runtime import BackwardsInvocation
|
||||
from dify_plugin.entities.model.text_embedding import TextEmbeddingResult
|
||||
from dify_plugin.entities.model.text_embedding import TextEmbeddingResult, TextEmbeddingModelConfig
|
||||
|
||||
|
||||
class TextEmbeddingInvocation(BackwardsInvocation[TextEmbeddingResult]):
|
||||
def invoke(self, model_config: TextEmbeddingResult, texts: list[str]) -> TextEmbeddingResult:
|
||||
def invoke(self, model_config: TextEmbeddingModelConfig, texts: list[str]) -> TextEmbeddingResult:
|
||||
"""
|
||||
Invoke text embedding
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user