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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: Ollama modelfeature set vision, and an exception occurred at the… (#8783)
cx128a66f7fe83
diff --git a/api/core/model_runtime/model_providers/ollama/llm/llm.py b/api/core/model_runtime/model_providers/ollama/llm/llm.pyindex ff732e69259..a7ea53e0e99 100644--- a/api/core/model_runtime/model_providers/ollama/llm/llm.py+++ b/api/core/model_runtime/model_providers/ollama/llm/llm.py@@ -364,14 +364,21 @@ class OllamaLargeLanguageModel(LargeLanguageModel):if chunk_json["done"]:# calculate num tokens- if "prompt_eval_count" in chunk_json and "eval_count" in chunk_json:- # transform usage+ if "prompt_eval_count" in chunk_json:prompt_tokens = chunk_json["prompt_eval_count"]- completion_tokens = chunk_json["eval_count"]else:- # calculate num tokens- prompt_tokens = self._get_num_tokens_by_gpt2(prompt_messages[0].content)- completion_tokens = self._get_num_tokens_by_gpt2(full_text)+ prompt_message_content = prompt_messages[0].content+ if isinstance(prompt_message_content, str):+ prompt_tokens = self._get_num_tokens_by_gpt2(prompt_message_content)+ else:+ content_text = ""+ for message_content in prompt_message_content:+ if message_content.type == PromptMessageContentType.TEXT:+ message_content = cast(TextPromptMessageContent, message_content)+ content_text += message_content.data+ prompt_tokens = self._get_num_tokens_by_gpt2(content_text)++ completion_tokens = chunk_json.get("eval_count", self._get_num_tokens_by_gpt2(full_text))# transform usageusage = self._calc_response_usage(model, credentials, prompt_tokens, completion_tokens)