Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: supports for new version of openllm (#1554)

takatostd65477073270
diff --git a/api/core/third_party/langchain/llms/openllm.py b/api/core/third_party/langchain/llms/openllm.py
index 6151fe3f1c2..d83f54da6e4 100644
--- a/api/core/third_party/langchain/llms/openllm.py
+++ b/api/core/third_party/langchain/llms/openllm.py
@@ -51,7 +51,8 @@ class OpenLLM(LLM):
) -> str:
params = {
"prompt": prompt,
- "llm_config": self.llm_kwargs
+ "llm_config": self.llm_kwargs,
+ "stop": stop,
}
headers = {"Content-Type": "application/json"}
@@ -65,11 +66,11 @@ class OpenLLM(LLM):
raise ValueError(f"OpenLLM HTTP {response.status_code} error: {response.text}")
json_response = response.json()
- completion = json_response["responses"][0]
+ completion = json_response["outputs"][0]['text']
completion = completion.lstrip(prompt)
- if stop is not None:
- completion = enforce_stop_tokens(completion, stop)
+ # if stop is not None:
+ # completion = enforce_stop_tokens(completion, stop)
return completion