mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-15 06:09:21 +03:00
This can only be reviewed by [hiding whitespaces](https://github.com/langchain-ai/langchain/pull/30302/files?diff=unified&w=1). The motivation behind this PR is to get my hands on the docs and make the LangSmith teasing short and clear. Right now I don't know how to do it, but this could be an include in the future. --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
7.2 KiB
7.2 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["LANGSMITH_TRACING"] = "true"
# os.environ["LANGSMITH_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.",
}
)