replicate_versioningTier 1 · 70% confidence

ai-agents-replicate-versioning-invalid-version-error-when-using-langchain-s-repli-9a6dce37

agent: ai_agents

When does this happen?

IF Invalid version error when using LangChain's Replicate class for models like Llama 3 that do not expose a version string.

How others solved it

THEN Use the Replicate Python package directly with replicate.run() instead of LangChain's Replicate class, as the version parameter is not required for public models. For example: import replicate; replicate.run('meta/meta-llama-3-70b-instruct', input={'top_p': 0.9, 'prompt': prompt, 'max_tokens': 512, 'temperature': 0.6, 'prompt_template': '<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are a helpful assistant<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n', 'presence_penalty': 1.15, 'frequency_penalty': 0.2}).

import replicate

replicate.run(
    "meta/meta-llama-3-70b-instruct",
    input={
        "top_p": 0.9,
        "prompt": prompt,
        "max_tokens": 512,
        "min_tokens": 0,
        "temperature": 0.6,
        "prompt_template": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are a helpful assistant<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
        "presence_penalty": 1.15,
        "frequency_penalty": 0.2
    }
)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics