Fix variable typo (#8084)
This commit is contained in:
parent
b1918dae5e
commit
2d7954c7da
215 changed files with 599 additions and 597 deletions
|
|
@ -46,7 +46,7 @@ class CodeExecutionSandboxConfig(BaseSettings):
|
|||
"""
|
||||
|
||||
CODE_EXECUTION_ENDPOINT: HttpUrl = Field(
|
||||
description="endpoint URL of code execution servcie",
|
||||
description="endpoint URL of code execution service",
|
||||
default="http://sandbox:8194",
|
||||
)
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ class MailConfig(BaseSettings):
|
|||
"""
|
||||
|
||||
MAIL_TYPE: Optional[str] = Field(
|
||||
description="Mail provider type name, default to None, availabile values are `smtp` and `resend`.",
|
||||
description="Mail provider type name, default to None, available values are `smtp` and `resend`.",
|
||||
default=None,
|
||||
)
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -18,7 +18,7 @@ from core.model_runtime.entities.model_entities import ModelType
|
|||
from core.provider_manager import ProviderManager
|
||||
from core.rag.datasource.vdb.vector_type import VectorType
|
||||
from core.rag.extractor.entity.extract_setting import ExtractSetting
|
||||
from core.rag.retrieval.retrival_methods import RetrievalMethod
|
||||
from core.rag.retrieval.retrieval_methods import RetrievalMethod
|
||||
from extensions.ext_database import db
|
||||
from fields.app_fields import related_app_list
|
||||
from fields.dataset_fields import dataset_detail_fields, dataset_query_detail_fields
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class SegmentApi(DatasetApiResource):
|
|||
segments = SegmentService.multi_create_segment(args["segments"], document, dataset)
|
||||
return {"data": marshal(segments, segment_fields), "doc_form": document.doc_form}, 200
|
||||
else:
|
||||
return {"error": "Segemtns is required"}, 400
|
||||
return {"error": "Segments is required"}, 400
|
||||
|
||||
def get(self, tenant_id, dataset_id, document_id):
|
||||
"""Create single segment."""
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ def is_filtered(
|
|||
name_func: Callable[[Any], str],
|
||||
) -> bool:
|
||||
"""
|
||||
Chcek if the object should be filtered out.
|
||||
Check if the object should be filtered out.
|
||||
Overall logic: exclude > include > pin
|
||||
:param include_set: the set of names to be included
|
||||
:param exclude_set: the set of names to be excluded
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ class IndexingRunner:
|
|||
hash = helper.generate_text_hash(document_node.page_content)
|
||||
document_node.metadata['doc_id'] = doc_id
|
||||
document_node.metadata['doc_hash'] = hash
|
||||
# delete Spliter character
|
||||
# delete Splitter character
|
||||
page_content = document_node.page_content
|
||||
if page_content.startswith(".") or page_content.startswith("。"):
|
||||
page_content = page_content[1:]
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ Here is a task description for which I would like you to create a high-quality p
|
|||
{{TASK_DESCRIPTION}}
|
||||
</task_description>
|
||||
Based on task description, please create a well-structured prompt template that another AI could use to consistently complete the task. The prompt template should include:
|
||||
- Do not inlcude <input> or <output> section and variables in the prompt, assume user will add them at their own will.
|
||||
- Do not include <input> or <output> section and variables in the prompt, assume user will add them at their own will.
|
||||
- Clear instructions for the AI that will be using this prompt, demarcated with <instructions> tags. The instructions should provide step-by-step directions on how to complete the task using the input variables. Also Specifies in the instructions that the output should not contain any xml tag.
|
||||
- Relevant examples if needed to clarify the task further, demarcated with <example> tags. Do not include variables in the prompt. Give three pairs of input and output examples.
|
||||
- Include other relevant sections demarcated with appropriate XML tags like <examples>, <instructions>.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
- `mode` (string) voice model.(available for model type `tts`)
|
||||
- `name` (string) voice model display name.(available for model type `tts`)
|
||||
- `language` (string) the voice model supports languages.(available for model type `tts`)
|
||||
- `word_limit` (int) Single conversion word limit, paragraphwise by default(available for model type `tts`)
|
||||
- `word_limit` (int) Single conversion word limit, paragraph-wise by default(available for model type `tts`)
|
||||
- `audio_type` (string) Support audio file extension format, e.g.:mp3,wav(available for model type `tts`)
|
||||
- `max_workers` (int) Number of concurrent workers supporting text and audio conversion(available for model type`tts`)
|
||||
- `max_characters_per_chunk` (int) Maximum characters per chunk (available for model type `moderation`)
|
||||
|
|
@ -150,7 +150,7 @@
|
|||
|
||||
- `input` (float) Input price, i.e., Prompt price
|
||||
- `output` (float) Output price, i.e., returned content price
|
||||
- `unit` (float) Pricing unit, e.g., if the price is meausred in 1M tokens, the corresponding token amount for the unit price is `0.000001`.
|
||||
- `unit` (float) Pricing unit, e.g., if the price is measured in 1M tokens, the corresponding token amount for the unit price is `0.000001`.
|
||||
- `currency` (string) Currency unit
|
||||
|
||||
### ProviderCredentialSchema
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
class TTSModel(AIModel):
|
||||
"""
|
||||
Model class for ttstext model.
|
||||
Model class for TTS model.
|
||||
"""
|
||||
model_type: ModelType = ModelType.TTS
|
||||
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ class AzureOpenAILargeLanguageModel(_CommonAzureOpenAI, LargeLanguageModel):
|
|||
try:
|
||||
schema = json.loads(json_schema)
|
||||
except:
|
||||
raise ValueError(f"not currect json_schema format: {json_schema}")
|
||||
raise ValueError(f"not correct json_schema format: {json_schema}")
|
||||
model_parameters.pop("json_schema")
|
||||
model_parameters["response_format"] = {"type": "json_schema", "json_schema": schema}
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ from core.model_runtime.model_providers.baichuan.llm.baichuan_turbo_errors impor
|
|||
)
|
||||
|
||||
|
||||
class BaichuanLarguageModel(LargeLanguageModel):
|
||||
class BaichuanLanguageModel(LargeLanguageModel):
|
||||
|
||||
def _invoke(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class BaichuanTextEmbeddingModel(TextEmbeddingModel):
|
|||
token_usage = 0
|
||||
|
||||
for chunk in chunks:
|
||||
# embeding chunk
|
||||
# embedding chunk
|
||||
chunk_embeddings, chunk_usage = self.embedding(
|
||||
model=model,
|
||||
api_key=api_key,
|
||||
|
|
|
|||
|
|
@ -793,11 +793,11 @@ class BedrockLargeLanguageModel(LargeLanguageModel):
|
|||
def _invoke_error_mapping(self) -> dict[type[InvokeError], list[type[Exception]]]:
|
||||
"""
|
||||
Map model invoke error to unified error
|
||||
The key is the ermd = genai.GenerativeModel(model)ror type thrown to the caller
|
||||
The value is the md = genai.GenerativeModel(model)error type thrown by the model,
|
||||
The key is the ermd = genai.GenerativeModel(model) error type thrown to the caller
|
||||
The value is the md = genai.GenerativeModel(model) error type thrown by the model,
|
||||
which needs to be converted into a unified error type for the caller.
|
||||
|
||||
:return: Invoke emd = genai.GenerativeModel(model)rror mapping
|
||||
:return: Invoke emd = genai.GenerativeModel(model) error mapping
|
||||
"""
|
||||
return {
|
||||
InvokeConnectionError: [],
|
||||
|
|
|
|||
|
|
@ -130,11 +130,11 @@ class BedrockTextEmbeddingModel(TextEmbeddingModel):
|
|||
def _invoke_error_mapping(self) -> dict[type[InvokeError], list[type[Exception]]]:
|
||||
"""
|
||||
Map model invoke error to unified error
|
||||
The key is the ermd = genai.GenerativeModel(model)ror type thrown to the caller
|
||||
The value is the md = genai.GenerativeModel(model)error type thrown by the model,
|
||||
The key is the ermd = genai.GenerativeModel(model) error type thrown to the caller
|
||||
The value is the md = genai.GenerativeModel(model) error type thrown by the model,
|
||||
which needs to be converted into a unified error type for the caller.
|
||||
|
||||
:return: Invoke emd = genai.GenerativeModel(model)rror mapping
|
||||
:return: Invoke emd = genai.GenerativeModel(model) error mapping
|
||||
"""
|
||||
return {
|
||||
InvokeConnectionError: [],
|
||||
|
|
|
|||
|
|
@ -416,11 +416,11 @@ class GoogleLargeLanguageModel(LargeLanguageModel):
|
|||
def _invoke_error_mapping(self) -> dict[type[InvokeError], list[type[Exception]]]:
|
||||
"""
|
||||
Map model invoke error to unified error
|
||||
The key is the ermd = genai.GenerativeModel(model)ror type thrown to the caller
|
||||
The value is the md = genai.GenerativeModel(model)error type thrown by the model,
|
||||
The key is the ermd = genai.GenerativeModel(model) error type thrown to the caller
|
||||
The value is the md = genai.GenerativeModel(model) error type thrown by the model,
|
||||
which needs to be converted into a unified error type for the caller.
|
||||
|
||||
:return: Invoke emd = genai.GenerativeModel(model)rror mapping
|
||||
:return: Invoke emd = genai.GenerativeModel(model) error mapping
|
||||
"""
|
||||
return {
|
||||
InvokeConnectionError: [
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class MinimaxLargeLanguageModel(LargeLanguageModel):
|
|||
Calculate num tokens for minimax model
|
||||
|
||||
not like ChatGLM, Minimax has a special prompt structure, we could not find a proper way
|
||||
to caculate the num tokens, so we use str() to convert the prompt to string
|
||||
to calculate the num tokens, so we use str() to convert the prompt to string
|
||||
|
||||
Minimax does not provide their own tokenizer of adab5.5 and abab5 model
|
||||
therefore, we use gpt2 tokenizer instead
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from core.model_runtime.model_providers.openai_api_compatible.llm.llm import OAI
|
|||
class NovitaLargeLanguageModel(OAIAPICompatLargeLanguageModel):
|
||||
|
||||
def _update_endpoint_url(self, credentials: dict):
|
||||
|
||||
credentials['endpoint_url'] = "https://api.novita.ai/v3/openai"
|
||||
credentials['extra_headers'] = { 'X-Novita-Source': 'dify.ai' }
|
||||
return credentials
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ class OCILargeLanguageModel(LargeLanguageModel):
|
|||
request_args["compartmentId"] = compartment_id
|
||||
request_args["servingMode"]["modelId"] = model
|
||||
|
||||
chathistory = []
|
||||
chat_history = []
|
||||
system_prompts = []
|
||||
#if "meta.llama" in model:
|
||||
# request_args["chatRequest"]["apiFormat"] = "GENERIC"
|
||||
|
|
@ -273,16 +273,16 @@ class OCILargeLanguageModel(LargeLanguageModel):
|
|||
if isinstance(message.content, str):
|
||||
text = message.content
|
||||
if isinstance(message, UserPromptMessage):
|
||||
chathistory.append({"role": "USER", "message": text})
|
||||
chat_history.append({"role": "USER", "message": text})
|
||||
else:
|
||||
chathistory.append({"role": "CHATBOT", "message": text})
|
||||
chat_history.append({"role": "CHATBOT", "message": text})
|
||||
if isinstance(message, SystemPromptMessage):
|
||||
if isinstance(message.content, str):
|
||||
system_prompts.append(message.content)
|
||||
args = {"apiFormat": "COHERE",
|
||||
"preambleOverride": ' '.join(system_prompts),
|
||||
"message": prompt_messages[-1].content,
|
||||
"chatHistory": chathistory, }
|
||||
"chatHistory": chat_history, }
|
||||
request_args["chatRequest"].update(args)
|
||||
elif model.startswith("meta"):
|
||||
#print("run meta " * 10)
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ class OpenAILargeLanguageModel(_CommonOpenAI, LargeLanguageModel):
|
|||
try:
|
||||
schema = json.loads(json_schema)
|
||||
except:
|
||||
raise ValueError(f"not currect json_schema format: {json_schema}")
|
||||
raise ValueError(f"not correct json_schema format: {json_schema}")
|
||||
model_parameters.pop("json_schema")
|
||||
model_parameters["response_format"] = {"type": "json_schema", "json_schema": schema}
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class FlashRecognitionRequest:
|
|||
|
||||
class FlashRecognizer:
|
||||
"""
|
||||
reponse:
|
||||
response:
|
||||
request_id string
|
||||
status Integer
|
||||
message String
|
||||
|
|
@ -132,9 +132,9 @@ class FlashRecognizer:
|
|||
signstr = self._format_sign_string(query)
|
||||
signature = self._sign(signstr, secret_key)
|
||||
header["Authorization"] = signature
|
||||
requrl = "https://"
|
||||
requrl += signstr[4::]
|
||||
return requrl
|
||||
req_url = "https://"
|
||||
req_url += signstr[4::]
|
||||
return req_url
|
||||
|
||||
def _create_query_arr(self, req):
|
||||
return {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue