mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-12 21:05:18 +03:00
6.5 KiB
6.5 KiB
Cell:
[Cell type raw - unsupported, skipped]
In [ ]:
import getpass
import os
if not os.getenv("__MODULE_NAME___API_KEY"):
os.environ["__MODULE_NAME___API_KEY"] = getpass.getpass("Enter your __ModuleName__ API key: ")In [ ]:
# os.environ["LANGCHAIN_TRACING_V2"] = "true"
# os.environ["LANGCHAIN_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ")In [ ]:
%pip install -qU __package_name__In [ ]:
from __module_name__ import __ModuleName__LLM
llm = __ModuleName__LLM(
model="model-name",
temperature=0,
max_tokens=None,
timeout=None,
max_retries=2,
# other params...
)In [4]:
input_text = "__ModuleName__ is an AI company that "
completion = llm.invoke(input_text)
completionIn [ ]:
from langchain_core.prompts import PromptTemplate
prompt = PromptTemplate(
"How to say {input} in {output_language}:\n"
)
chain = prompt | llm
chain.invoke(
{
"output_language": "German",
"input": "I love programming.",
}
)