From 8bb980e86ac6eb8bab36c83975422c43172740ca Mon Sep 17 00:00:00 2001 From: Isaac Francisco <78627776+isahers1@users.noreply.github.com> Date: Fri, 10 Jan 2025 08:45:47 -0800 Subject: [PATCH 01/34] replace all LANGCHAIN_ flags with LANGSMITH_ flags in the docs (#7495) --- cookbook/basic_critique_revise.ipynb | 4 ++-- docs/core_docs/docs/how_to/agent_executor.ipynb | 4 ++-- docs/core_docs/docs/how_to/debugging.mdx | 4 ++-- docs/core_docs/docs/how_to/graph_constructing.ipynb | 2 +- docs/core_docs/docs/how_to/graph_mapping.ipynb | 2 +- docs/core_docs/docs/how_to/graph_prompting.ipynb | 2 +- docs/core_docs/docs/how_to/graph_semantic.ipynb | 2 +- docs/core_docs/docs/how_to/migrate_agent.ipynb | 8 ++++---- docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb | 4 ++-- docs/core_docs/docs/how_to/qa_citations.ipynb | 4 ++-- docs/core_docs/docs/how_to/qa_per_user.ipynb | 2 +- docs/core_docs/docs/how_to/qa_sources.ipynb | 4 ++-- docs/core_docs/docs/how_to/qa_streaming.ipynb | 4 ++-- docs/core_docs/docs/how_to/query_few_shot.ipynb | 2 +- docs/core_docs/docs/how_to/query_high_cardinality.ipynb | 2 +- docs/core_docs/docs/how_to/query_multiple_queries.ipynb | 2 +- .../core_docs/docs/how_to/query_multiple_retrievers.ipynb | 2 +- docs/core_docs/docs/how_to/query_no_queries.ipynb | 2 +- docs/core_docs/docs/how_to/sql_large_db.mdx | 4 ++-- docs/core_docs/docs/how_to/sql_prompting.mdx | 4 ++-- docs/core_docs/docs/how_to/sql_query_checking.mdx | 4 ++-- docs/core_docs/docs/how_to/tools_prompting.ipynb | 2 +- docs/core_docs/docs/integrations/chat/anthropic.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/azure.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/bedrock.ipynb | 4 ++-- .../docs/integrations/chat/bedrock_converse.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/cerebras.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/cohere.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/fireworks.ipynb | 4 ++-- .../docs/integrations/chat/google_generativeai.ipynb | 4 ++-- .../docs/integrations/chat/google_vertex_ai.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/groq.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/ibm.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/mistral.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/ollama.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/openai.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/togetherai.ipynb | 4 ++-- docs/core_docs/docs/integrations/chat/xai.ipynb | 4 ++-- .../document_loaders/web_loaders/firecrawl.ipynb | 4 ++-- .../integrations/document_loaders/web_loaders/pdf.ipynb | 4 ++-- .../web_loaders/recursive_url_loader.ipynb | 4 ++-- .../document_loaders/web_loaders/web_cheerio.ipynb | 4 ++-- .../document_loaders/web_loaders/web_puppeteer.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/azure.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/bedrock.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/cohere.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/fireworks.ipynb | 4 ++-- .../docs/integrations/llms/google_vertex_ai.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/ibm.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/mistral.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/ollama.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/openai.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/together.ipynb | 4 ++-- .../docs/integrations/text_embedding/azure_openai.ipynb | 4 ++-- .../docs/integrations/text_embedding/bedrock.ipynb | 4 ++-- .../docs/integrations/text_embedding/cloudflare_ai.ipynb | 4 ++-- .../docs/integrations/text_embedding/cohere.ipynb | 4 ++-- .../docs/integrations/text_embedding/fireworks.ipynb | 4 ++-- .../integrations/text_embedding/google_generativeai.ipynb | 4 ++-- .../integrations/text_embedding/google_vertex_ai.ipynb | 4 ++-- docs/core_docs/docs/integrations/text_embedding/ibm.ipynb | 4 ++-- .../docs/integrations/text_embedding/mistralai.ipynb | 4 ++-- .../docs/integrations/text_embedding/ollama.ipynb | 4 ++-- .../docs/integrations/text_embedding/openai.ipynb | 4 ++-- .../docs/integrations/text_embedding/pinecone.ipynb | 4 ++-- .../docs/integrations/text_embedding/togetherai.ipynb | 4 ++-- docs/core_docs/docs/integrations/toolkits/openapi.ipynb | 4 ++-- docs/core_docs/docs/integrations/toolkits/sql.ipynb | 4 ++-- .../docs/integrations/toolkits/vectorstore.ipynb | 4 ++-- .../docs/integrations/tools/duckduckgo_search.ipynb | 4 ++-- docs/core_docs/docs/integrations/tools/exa_search.ipynb | 4 ++-- .../docs/integrations/tools/google_scholar.ipynb | 4 ++-- docs/core_docs/docs/integrations/tools/serpapi.ipynb | 4 ++-- .../core_docs/docs/integrations/tools/tavily_search.ipynb | 4 ++-- .../core_docs/docs/integrations/vectorstores/chroma.ipynb | 4 ++-- .../docs/integrations/vectorstores/elasticsearch.ipynb | 4 ++-- docs/core_docs/docs/integrations/vectorstores/faiss.ipynb | 4 ++-- .../docs/integrations/vectorstores/hnswlib.ipynb | 4 ++-- .../core_docs/docs/integrations/vectorstores/memory.ipynb | 4 ++-- .../docs/integrations/vectorstores/mongodb_atlas.ipynb | 4 ++-- .../docs/integrations/vectorstores/pgvector.ipynb | 4 ++-- .../docs/integrations/vectorstores/pinecone.ipynb | 4 ++-- .../core_docs/docs/integrations/vectorstores/qdrant.ipynb | 4 ++-- docs/core_docs/docs/integrations/vectorstores/redis.ipynb | 4 ++-- .../docs/integrations/vectorstores/supabase.ipynb | 4 ++-- .../docs/integrations/vectorstores/upstash.ipynb | 4 ++-- .../docs/integrations/vectorstores/weaviate.ipynb | 4 ++-- docs/core_docs/docs/tutorials/chatbot.ipynb | 4 ++-- docs/core_docs/docs/tutorials/extraction.ipynb | 4 ++-- docs/core_docs/docs/tutorials/graph.ipynb | 2 +- docs/core_docs/docs/tutorials/llm_chain.ipynb | 4 ++-- docs/core_docs/docs/tutorials/qa_chat_history.ipynb | 4 ++-- docs/core_docs/docs/tutorials/rag.ipynb | 4 ++-- docs/core_docs/docs/tutorials/retrievers.ipynb | 4 ++-- docs/core_docs/docs/tutorials/sql_qa.ipynb | 4 ++-- docs/core_docs/docs/tutorials/summarization.ipynb | 4 ++-- libs/langchain-scripts/src/cli/docs/templates/chat.ipynb | 4 ++-- libs/langchain-scripts/src/cli/docs/templates/llms.ipynb | 4 ++-- .../src/cli/docs/templates/text_embedding.ipynb | 4 ++-- .../src/cli/docs/templates/toolkits.ipynb | 4 ++-- libs/langchain-scripts/src/cli/docs/templates/tools.ipynb | 4 ++-- .../src/cli/docs/templates/vectorstores.ipynb | 4 ++-- 102 files changed, 194 insertions(+), 194 deletions(-) diff --git a/cookbook/basic_critique_revise.ipynb b/cookbook/basic_critique_revise.ipynb index 65d26ec4ef63..ceded916b214 100644 --- a/cookbook/basic_critique_revise.ipynb +++ b/cookbook/basic_critique_revise.ipynb @@ -20,8 +20,8 @@ "outputs": [], "source": [ "Deno.env.set(\"OPENAI_API_KEY\", \"\");\n", - "Deno.env.set(\"LANGCHAIN_API_KEY\", \"\");\n", - "Deno.env.set(\"LANGCHAIN_TRACING_V2\", \"true\");\n", + "Deno.env.set(\"LANGSMITH_API_KEY\", \"\");\n", + "Deno.env.set(\"LANGSMITH_TRACING\", \"true\");\n", "\n", "import { z } from \"npm:zod\";\n", "\n", diff --git a/docs/core_docs/docs/how_to/agent_executor.ipynb b/docs/core_docs/docs/how_to/agent_executor.ipynb index d9d566fb81db..73880fbef354 100644 --- a/docs/core_docs/docs/how_to/agent_executor.ipynb +++ b/docs/core_docs/docs/how_to/agent_executor.ipynb @@ -65,8 +65,8 @@ "After you sign up at the link above, make sure to set your environment variables to start logging traces:\n", "\n", "```shell\n", - "export LANGCHAIN_TRACING_V2=\"true\"\n", - "export LANGCHAIN_API_KEY=\"...\"\n", + "export LANGSMITH_TRACING=\"true\"\n", + "export LANGSMITH_API_KEY=\"...\"\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/debugging.mdx b/docs/core_docs/docs/how_to/debugging.mdx index d1a3527e94a2..1bbacb85b1c8 100644 --- a/docs/core_docs/docs/how_to/debugging.mdx +++ b/docs/core_docs/docs/how_to/debugging.mdx @@ -16,8 +16,8 @@ The best way to do this is with [LangSmith](https://smith.langchain.com). After you sign up at the link above, make sure to set your environment variables to start logging traces: ```shell -export LANGCHAIN_TRACING_V2="true" -export LANGCHAIN_API_KEY="..." +export LANGSMITH_TRACING="true" +export LANGSMITH_API_KEY="..." # Reduce tracing latency if you are not in a serverless environment # export LANGCHAIN_CALLBACKS_BACKGROUND=true diff --git a/docs/core_docs/docs/how_to/graph_constructing.ipynb b/docs/core_docs/docs/how_to/graph_constructing.ipynb index dfee57df8191..18a0c3baf651 100644 --- a/docs/core_docs/docs/how_to/graph_constructing.ipynb +++ b/docs/core_docs/docs/how_to/graph_constructing.ipynb @@ -41,7 +41,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/graph_mapping.ipynb b/docs/core_docs/docs/how_to/graph_mapping.ipynb index 413d8f30f941..43347373d6fc 100644 --- a/docs/core_docs/docs/how_to/graph_mapping.ipynb +++ b/docs/core_docs/docs/how_to/graph_mapping.ipynb @@ -40,7 +40,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/graph_prompting.ipynb b/docs/core_docs/docs/how_to/graph_prompting.ipynb index 03ae3c0de203..faa53db35106 100644 --- a/docs/core_docs/docs/how_to/graph_prompting.ipynb +++ b/docs/core_docs/docs/how_to/graph_prompting.ipynb @@ -49,7 +49,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/graph_semantic.ipynb b/docs/core_docs/docs/how_to/graph_semantic.ipynb index 8cf963e32632..e15bb66c1b3c 100644 --- a/docs/core_docs/docs/how_to/graph_semantic.ipynb +++ b/docs/core_docs/docs/how_to/graph_semantic.ipynb @@ -56,7 +56,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/migrate_agent.ipynb b/docs/core_docs/docs/how_to/migrate_agent.ipynb index 816f45e40fac..5f8a6e253afc 100644 --- a/docs/core_docs/docs/how_to/migrate_agent.ipynb +++ b/docs/core_docs/docs/how_to/migrate_agent.ipynb @@ -57,10 +57,10 @@ "// process.env.OPENAI_API_KEY = \"...\";\n", "\n", "// Optional, add tracing in LangSmith\n", - "// process.env.LANGCHAIN_API_KEY = \"ls...\";\n", + "// process.env.LANGSMITH_API_KEY = \"ls...\";\n", "// process.env.LANGCHAIN_CALLBACKS_BACKGROUND = \"true\";\n", - "// process.env.LANGCHAIN_TRACING_V2 = \"true\";\n", - "// process.env.LANGCHAIN_PROJECT = \"How to migrate: LangGraphJS\";\n", + "// process.env.LANGSMITH_TRACING = \"true\";\n", + "// process.env.LANGSMITH_PROJECT = \"How to migrate: LangGraphJS\";\n", "\n", "// Reduce tracing latency if you are not in a serverless environment\n", "// process.env.LANGCHAIN_CALLBACKS_BACKGROUND = \"true\";" @@ -1337,4 +1337,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb b/docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb index e2cc59b8e9ba..31c684f3b761 100644 --- a/docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb +++ b/docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb @@ -63,8 +63,8 @@ "\n", "\n", "```bash\n", - "export LANGCHAIN_TRACING_V2=true\n", - "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "export LANGSMITH_TRACING=true\n", + "export LANGSMITH_API_KEY=YOUR_KEY\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/qa_citations.ipynb b/docs/core_docs/docs/how_to/qa_citations.ipynb index 701ec0481652..85ee820febde 100644 --- a/docs/core_docs/docs/how_to/qa_citations.ipynb +++ b/docs/core_docs/docs/how_to/qa_citations.ipynb @@ -55,8 +55,8 @@ "\n", "\n", "```bash\n", - "export LANGCHAIN_TRACING_V2=true\n", - "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "export LANGSMITH_TRACING=true\n", + "export LANGSMITH_API_KEY=YOUR_KEY\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/qa_per_user.ipynb b/docs/core_docs/docs/how_to/qa_per_user.ipynb index 4a4cd4eda993..12e4353a77f1 100644 --- a/docs/core_docs/docs/how_to/qa_per_user.ipynb +++ b/docs/core_docs/docs/how_to/qa_per_user.ipynb @@ -88,7 +88,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/qa_sources.ipynb b/docs/core_docs/docs/how_to/qa_sources.ipynb index c3efb34496ab..03a3ed1f350f 100644 --- a/docs/core_docs/docs/how_to/qa_sources.ipynb +++ b/docs/core_docs/docs/how_to/qa_sources.ipynb @@ -53,8 +53,8 @@ "\n", "\n", "```bash\n", - "export LANGCHAIN_TRACING_V2=true\n", - "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "export LANGSMITH_TRACING=true\n", + "export LANGSMITH_API_KEY=YOUR_KEY\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/qa_streaming.ipynb b/docs/core_docs/docs/how_to/qa_streaming.ipynb index 5b2f8ce78565..4b4d4f222b03 100644 --- a/docs/core_docs/docs/how_to/qa_streaming.ipynb +++ b/docs/core_docs/docs/how_to/qa_streaming.ipynb @@ -53,8 +53,8 @@ "\n", "\n", "```bash\n", - "export LANGCHAIN_TRACING_V2=true\n", - "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "export LANGSMITH_TRACING=true\n", + "export LANGSMITH_API_KEY=YOUR_KEY\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/query_few_shot.ipynb b/docs/core_docs/docs/how_to/query_few_shot.ipynb index ba470500e296..5690d7f563e8 100644 --- a/docs/core_docs/docs/how_to/query_few_shot.ipynb +++ b/docs/core_docs/docs/how_to/query_few_shot.ipynb @@ -45,7 +45,7 @@ "```\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/query_high_cardinality.ipynb b/docs/core_docs/docs/how_to/query_high_cardinality.ipynb index 589f4e2cc933..d029e3c8053a 100644 --- a/docs/core_docs/docs/how_to/query_high_cardinality.ipynb +++ b/docs/core_docs/docs/how_to/query_high_cardinality.ipynb @@ -47,7 +47,7 @@ "```\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/query_multiple_queries.ipynb b/docs/core_docs/docs/how_to/query_multiple_queries.ipynb index f8ea45eaad47..0f8cb9f2ebb5 100644 --- a/docs/core_docs/docs/how_to/query_multiple_queries.ipynb +++ b/docs/core_docs/docs/how_to/query_multiple_queries.ipynb @@ -45,7 +45,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb b/docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb index ac52581c8622..485be5b4d19c 100644 --- a/docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb +++ b/docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb @@ -45,7 +45,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/query_no_queries.ipynb b/docs/core_docs/docs/how_to/query_no_queries.ipynb index 53e9b041d1c6..90991b051e1f 100644 --- a/docs/core_docs/docs/how_to/query_no_queries.ipynb +++ b/docs/core_docs/docs/how_to/query_no_queries.ipynb @@ -47,7 +47,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/how_to/sql_large_db.mdx b/docs/core_docs/docs/how_to/sql_large_db.mdx index 9c4895632d0e..c36e5049c095 100644 --- a/docs/core_docs/docs/how_to/sql_large_db.mdx +++ b/docs/core_docs/docs/how_to/sql_large_db.mdx @@ -23,8 +23,8 @@ npm install langchain @langchain/community @langchain/openai typeorm sqlite3 ```bash export OPENAI_API_KEY="your api key" # Uncomment the below to use LangSmith. Not required. -# export LANGCHAIN_API_KEY="your api key" -# export LANGCHAIN_TRACING_V2=true +# export LANGSMITH_API_KEY="your api key" +# export LANGSMITH_TRACING=true # Reduce tracing latency if you are not in a serverless environment # export LANGCHAIN_CALLBACKS_BACKGROUND=true diff --git a/docs/core_docs/docs/how_to/sql_prompting.mdx b/docs/core_docs/docs/how_to/sql_prompting.mdx index ef5f8cdfdf27..c2bd5a78be22 100644 --- a/docs/core_docs/docs/how_to/sql_prompting.mdx +++ b/docs/core_docs/docs/how_to/sql_prompting.mdx @@ -22,8 +22,8 @@ npm install @langchain/community @langchain/openai typeorm sqlite3 ```bash export OPENAI_API_KEY="your api key" # Uncomment the below to use LangSmith. Not required. -# export LANGCHAIN_API_KEY="your api key" -# export LANGCHAIN_TRACING_V2=true +# export LANGSMITH_API_KEY="your api key" +# export LANGSMITH_TRACING=true # Reduce tracing latency if you are not in a serverless environment # export LANGCHAIN_CALLBACKS_BACKGROUND=true diff --git a/docs/core_docs/docs/how_to/sql_query_checking.mdx b/docs/core_docs/docs/how_to/sql_query_checking.mdx index 7cb5146b6e8b..90f3f6cfc7e2 100644 --- a/docs/core_docs/docs/how_to/sql_query_checking.mdx +++ b/docs/core_docs/docs/how_to/sql_query_checking.mdx @@ -26,8 +26,8 @@ npm install @langchain/community @langchain/openai typeorm sqlite3 ```bash export OPENAI_API_KEY="your api key" # Uncomment the below to use LangSmith. Not required. -# export LANGCHAIN_API_KEY="your api key" -# export LANGCHAIN_TRACING_V2=true +# export LANGSMITH_API_KEY="your api key" +# export LANGSMITH_TRACING=true # Reduce tracing latency if you are not in a serverless environment # export LANGCHAIN_CALLBACKS_BACKGROUND=true diff --git a/docs/core_docs/docs/how_to/tools_prompting.ipynb b/docs/core_docs/docs/how_to/tools_prompting.ipynb index 49356ba2e570..875953123ac3 100644 --- a/docs/core_docs/docs/how_to/tools_prompting.ipynb +++ b/docs/core_docs/docs/how_to/tools_prompting.ipynb @@ -52,7 +52,7 @@ "```\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/integrations/chat/anthropic.ipynb b/docs/core_docs/docs/integrations/chat/anthropic.ipynb index b8761588d277..6b431821c4db 100644 --- a/docs/core_docs/docs/integrations/chat/anthropic.ipynb +++ b/docs/core_docs/docs/integrations/chat/anthropic.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/azure.ipynb b/docs/core_docs/docs/integrations/chat/azure.ipynb index 5f6ac31b19b7..1cea976d56b6 100644 --- a/docs/core_docs/docs/integrations/chat/azure.ipynb +++ b/docs/core_docs/docs/integrations/chat/azure.ipynb @@ -66,8 +66,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/bedrock.ipynb b/docs/core_docs/docs/integrations/chat/bedrock.ipynb index dbe56fc26d1a..74b9f3ed9fd2 100644 --- a/docs/core_docs/docs/integrations/chat/bedrock.ipynb +++ b/docs/core_docs/docs/integrations/chat/bedrock.ipynb @@ -57,8 +57,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/bedrock_converse.ipynb b/docs/core_docs/docs/integrations/chat/bedrock_converse.ipynb index b4b4fca65c8f..1d78af2a9c1c 100644 --- a/docs/core_docs/docs/integrations/chat/bedrock_converse.ipynb +++ b/docs/core_docs/docs/integrations/chat/bedrock_converse.ipynb @@ -51,8 +51,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/cerebras.ipynb b/docs/core_docs/docs/integrations/chat/cerebras.ipynb index 10da3ce07bfa..63d562762cbd 100644 --- a/docs/core_docs/docs/integrations/chat/cerebras.ipynb +++ b/docs/core_docs/docs/integrations/chat/cerebras.ipynb @@ -64,8 +64,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/cohere.ipynb b/docs/core_docs/docs/integrations/chat/cohere.ipynb index 97baaf8081e0..931b5abd9011 100644 --- a/docs/core_docs/docs/integrations/chat/cohere.ipynb +++ b/docs/core_docs/docs/integrations/chat/cohere.ipynb @@ -59,8 +59,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/fireworks.ipynb b/docs/core_docs/docs/integrations/chat/fireworks.ipynb index b3115487d98e..0a9b4eca639e 100644 --- a/docs/core_docs/docs/integrations/chat/fireworks.ipynb +++ b/docs/core_docs/docs/integrations/chat/fireworks.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/google_generativeai.ipynb b/docs/core_docs/docs/integrations/chat/google_generativeai.ipynb index 3e2332d74d4b..a7d64bedc25a 100644 --- a/docs/core_docs/docs/integrations/chat/google_generativeai.ipynb +++ b/docs/core_docs/docs/integrations/chat/google_generativeai.ipynb @@ -66,8 +66,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb b/docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb index 8d046defbac1..7d0dca71a23a 100644 --- a/docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb +++ b/docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb @@ -67,8 +67,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/groq.ipynb b/docs/core_docs/docs/integrations/chat/groq.ipynb index 279fa1a74769..cf8265dd6d57 100644 --- a/docs/core_docs/docs/integrations/chat/groq.ipynb +++ b/docs/core_docs/docs/integrations/chat/groq.ipynb @@ -56,8 +56,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/ibm.ipynb b/docs/core_docs/docs/integrations/chat/ibm.ipynb index c3f60d925f99..345203410506 100644 --- a/docs/core_docs/docs/integrations/chat/ibm.ipynb +++ b/docs/core_docs/docs/integrations/chat/ibm.ipynb @@ -124,8 +124,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/mistral.ipynb b/docs/core_docs/docs/integrations/chat/mistral.ipynb index 679bde45a925..4698c67f9f46 100644 --- a/docs/core_docs/docs/integrations/chat/mistral.ipynb +++ b/docs/core_docs/docs/integrations/chat/mistral.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/ollama.ipynb b/docs/core_docs/docs/integrations/chat/ollama.ipynb index 12ea4b4e35c8..23b661bb53b4 100644 --- a/docs/core_docs/docs/integrations/chat/ollama.ipynb +++ b/docs/core_docs/docs/integrations/chat/ollama.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/openai.ipynb b/docs/core_docs/docs/integrations/chat/openai.ipynb index 441580334fc1..800ed7d0b568 100644 --- a/docs/core_docs/docs/integrations/chat/openai.ipynb +++ b/docs/core_docs/docs/integrations/chat/openai.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/togetherai.ipynb b/docs/core_docs/docs/integrations/chat/togetherai.ipynb index 09a0271059d7..b6deed8ccaa3 100644 --- a/docs/core_docs/docs/integrations/chat/togetherai.ipynb +++ b/docs/core_docs/docs/integrations/chat/togetherai.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/chat/xai.ipynb b/docs/core_docs/docs/integrations/chat/xai.ipynb index e07a8079dd0c..830eec608441 100644 --- a/docs/core_docs/docs/integrations/chat/xai.ipynb +++ b/docs/core_docs/docs/integrations/chat/xai.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/document_loaders/web_loaders/firecrawl.ipynb b/docs/core_docs/docs/integrations/document_loaders/web_loaders/firecrawl.ipynb index 31ef76f0797c..2c4b7dc3d90c 100644 --- a/docs/core_docs/docs/integrations/document_loaders/web_loaders/firecrawl.ipynb +++ b/docs/core_docs/docs/integrations/document_loaders/web_loaders/firecrawl.ipynb @@ -52,8 +52,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/document_loaders/web_loaders/pdf.ipynb b/docs/core_docs/docs/integrations/document_loaders/web_loaders/pdf.ipynb index 1c7927de592a..322892e6268e 100644 --- a/docs/core_docs/docs/integrations/document_loaders/web_loaders/pdf.ipynb +++ b/docs/core_docs/docs/integrations/document_loaders/web_loaders/pdf.ipynb @@ -41,8 +41,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/document_loaders/web_loaders/recursive_url_loader.ipynb b/docs/core_docs/docs/integrations/document_loaders/web_loaders/recursive_url_loader.ipynb index 001cd2fe1567..8f438c688142 100644 --- a/docs/core_docs/docs/integrations/document_loaders/web_loaders/recursive_url_loader.ipynb +++ b/docs/core_docs/docs/integrations/document_loaders/web_loaders/recursive_url_loader.ipynb @@ -60,8 +60,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_cheerio.ipynb b/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_cheerio.ipynb index a68f976c0fd8..efbf3c9bf9c6 100644 --- a/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_cheerio.ipynb +++ b/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_cheerio.ipynb @@ -43,8 +43,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb b/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb index 746b88214d54..ca841c111372 100644 --- a/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb +++ b/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb @@ -50,8 +50,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/azure.ipynb b/docs/core_docs/docs/integrations/llms/azure.ipynb index 3ebc20765204..4397a36ad384 100644 --- a/docs/core_docs/docs/integrations/llms/azure.ipynb +++ b/docs/core_docs/docs/integrations/llms/azure.ipynb @@ -76,8 +76,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/bedrock.ipynb b/docs/core_docs/docs/integrations/llms/bedrock.ipynb index 2cfe7a7aaf7a..24ce3378492f 100644 --- a/docs/core_docs/docs/integrations/llms/bedrock.ipynb +++ b/docs/core_docs/docs/integrations/llms/bedrock.ipynb @@ -56,8 +56,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/cohere.ipynb b/docs/core_docs/docs/integrations/llms/cohere.ipynb index 92def6e09adc..e100580b44df 100644 --- a/docs/core_docs/docs/integrations/llms/cohere.ipynb +++ b/docs/core_docs/docs/integrations/llms/cohere.ipynb @@ -62,8 +62,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/fireworks.ipynb b/docs/core_docs/docs/integrations/llms/fireworks.ipynb index ef23f86b3989..fb6015c76613 100644 --- a/docs/core_docs/docs/integrations/llms/fireworks.ipynb +++ b/docs/core_docs/docs/integrations/llms/fireworks.ipynb @@ -54,8 +54,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/google_vertex_ai.ipynb b/docs/core_docs/docs/integrations/llms/google_vertex_ai.ipynb index 8ad068013ecb..a4ab8da0be8b 100644 --- a/docs/core_docs/docs/integrations/llms/google_vertex_ai.ipynb +++ b/docs/core_docs/docs/integrations/llms/google_vertex_ai.ipynb @@ -96,8 +96,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/ibm.ipynb b/docs/core_docs/docs/integrations/llms/ibm.ipynb index 7c47f382e59e..4abbfa25b192 100644 --- a/docs/core_docs/docs/integrations/llms/ibm.ipynb +++ b/docs/core_docs/docs/integrations/llms/ibm.ipynb @@ -119,8 +119,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/mistral.ipynb b/docs/core_docs/docs/integrations/llms/mistral.ipynb index 0e5932455291..4348376a7d5c 100644 --- a/docs/core_docs/docs/integrations/llms/mistral.ipynb +++ b/docs/core_docs/docs/integrations/llms/mistral.ipynb @@ -57,8 +57,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/ollama.ipynb b/docs/core_docs/docs/integrations/llms/ollama.ipynb index cf301f0b65f8..34e72a860af2 100644 --- a/docs/core_docs/docs/integrations/llms/ollama.ipynb +++ b/docs/core_docs/docs/integrations/llms/ollama.ipynb @@ -56,8 +56,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/openai.ipynb b/docs/core_docs/docs/integrations/llms/openai.ipynb index a0ae65f8d079..aceeebf9607c 100644 --- a/docs/core_docs/docs/integrations/llms/openai.ipynb +++ b/docs/core_docs/docs/integrations/llms/openai.ipynb @@ -53,8 +53,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/llms/together.ipynb b/docs/core_docs/docs/integrations/llms/together.ipynb index ebee5f5c4682..0a5a49766d7f 100644 --- a/docs/core_docs/docs/integrations/llms/together.ipynb +++ b/docs/core_docs/docs/integrations/llms/together.ipynb @@ -53,8 +53,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/azure_openai.ipynb b/docs/core_docs/docs/integrations/text_embedding/azure_openai.ipynb index d270824ee0c6..a5225bd11ff8 100644 --- a/docs/core_docs/docs/integrations/text_embedding/azure_openai.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/azure_openai.ipynb @@ -71,8 +71,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/bedrock.ipynb b/docs/core_docs/docs/integrations/text_embedding/bedrock.ipynb index 7d597e9c37d8..36b5b04b2225 100644 --- a/docs/core_docs/docs/integrations/text_embedding/bedrock.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/bedrock.ipynb @@ -43,8 +43,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/cloudflare_ai.ipynb b/docs/core_docs/docs/integrations/text_embedding/cloudflare_ai.ipynb index 21cc3a3dbe65..0cc3c070de72 100644 --- a/docs/core_docs/docs/integrations/text_embedding/cloudflare_ai.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/cloudflare_ai.ipynb @@ -57,8 +57,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/cohere.ipynb b/docs/core_docs/docs/integrations/text_embedding/cohere.ipynb index 209aa6352f5d..890bf3d8708b 100644 --- a/docs/core_docs/docs/integrations/text_embedding/cohere.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/cohere.ipynb @@ -46,8 +46,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/fireworks.ipynb b/docs/core_docs/docs/integrations/text_embedding/fireworks.ipynb index bae29ba34b96..507abbf4f22e 100644 --- a/docs/core_docs/docs/integrations/text_embedding/fireworks.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/fireworks.ipynb @@ -45,8 +45,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/google_generativeai.ipynb b/docs/core_docs/docs/integrations/text_embedding/google_generativeai.ipynb index 91cf095a5e8a..605674d7139d 100644 --- a/docs/core_docs/docs/integrations/text_embedding/google_generativeai.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/google_generativeai.ipynb @@ -47,8 +47,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/google_vertex_ai.ipynb b/docs/core_docs/docs/integrations/text_embedding/google_vertex_ai.ipynb index 870be58b58bf..dd32b96b6325 100644 --- a/docs/core_docs/docs/integrations/text_embedding/google_vertex_ai.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/google_vertex_ai.ipynb @@ -56,8 +56,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/ibm.ipynb b/docs/core_docs/docs/integrations/text_embedding/ibm.ipynb index bac03b424f48..e9c58968de6b 100644 --- a/docs/core_docs/docs/integrations/text_embedding/ibm.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/ibm.ipynb @@ -118,8 +118,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/mistralai.ipynb b/docs/core_docs/docs/integrations/text_embedding/mistralai.ipynb index b272f3208843..d7799dfd6164 100644 --- a/docs/core_docs/docs/integrations/text_embedding/mistralai.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/mistralai.ipynb @@ -45,8 +45,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/ollama.ipynb b/docs/core_docs/docs/integrations/text_embedding/ollama.ipynb index e1aa8cfa7771..7e4a963a16e6 100644 --- a/docs/core_docs/docs/integrations/text_embedding/ollama.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/ollama.ipynb @@ -39,8 +39,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/openai.ipynb b/docs/core_docs/docs/integrations/text_embedding/openai.ipynb index 14001b233f6c..5f7595627be1 100644 --- a/docs/core_docs/docs/integrations/text_embedding/openai.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/openai.ipynb @@ -45,8 +45,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/pinecone.ipynb b/docs/core_docs/docs/integrations/text_embedding/pinecone.ipynb index e3ab07565f27..7df7fb186cdb 100644 --- a/docs/core_docs/docs/integrations/text_embedding/pinecone.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/pinecone.ipynb @@ -45,8 +45,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/togetherai.ipynb b/docs/core_docs/docs/integrations/text_embedding/togetherai.ipynb index 029ab2877261..b94c4bd57820 100644 --- a/docs/core_docs/docs/integrations/text_embedding/togetherai.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/togetherai.ipynb @@ -45,8 +45,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/toolkits/openapi.ipynb b/docs/core_docs/docs/integrations/toolkits/openapi.ipynb index afbc84478784..0f5afc17ee5e 100644 --- a/docs/core_docs/docs/integrations/toolkits/openapi.ipynb +++ b/docs/core_docs/docs/integrations/toolkits/openapi.ipynb @@ -54,8 +54,8 @@ "If you want to get automated tracing from runs of individual tools, you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/toolkits/sql.ipynb b/docs/core_docs/docs/integrations/toolkits/sql.ipynb index fd8e6c949306..1e2512f7754e 100644 --- a/docs/core_docs/docs/integrations/toolkits/sql.ipynb +++ b/docs/core_docs/docs/integrations/toolkits/sql.ipynb @@ -41,8 +41,8 @@ "If you want to get automated tracing from runs of individual tools, you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/toolkits/vectorstore.ipynb b/docs/core_docs/docs/integrations/toolkits/vectorstore.ipynb index fb233438253d..663bba1c1c53 100644 --- a/docs/core_docs/docs/integrations/toolkits/vectorstore.ipynb +++ b/docs/core_docs/docs/integrations/toolkits/vectorstore.ipynb @@ -30,8 +30,8 @@ "If you want to get automated tracing from runs of individual tools, you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/docs/core_docs/docs/integrations/tools/duckduckgo_search.ipynb b/docs/core_docs/docs/integrations/tools/duckduckgo_search.ipynb index 574447b86877..ddb857cb0d4c 100644 --- a/docs/core_docs/docs/integrations/tools/duckduckgo_search.ipynb +++ b/docs/core_docs/docs/integrations/tools/duckduckgo_search.ipynb @@ -53,8 +53,8 @@ "It's also helpful (but not needed) to set up [LangSmith](https://smith.langchain.com/) for best-in-class observability:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/tools/exa_search.ipynb b/docs/core_docs/docs/integrations/tools/exa_search.ipynb index b48ee2d3831f..fcec4fa2a4ee 100644 --- a/docs/core_docs/docs/integrations/tools/exa_search.ipynb +++ b/docs/core_docs/docs/integrations/tools/exa_search.ipynb @@ -48,8 +48,8 @@ "It's also helpful (but not needed) to set up LangSmith for best-in-class observability:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/tools/google_scholar.ipynb b/docs/core_docs/docs/integrations/tools/google_scholar.ipynb index ed6539459e1d..fc02d938c9ac 100644 --- a/docs/core_docs/docs/integrations/tools/google_scholar.ipynb +++ b/docs/core_docs/docs/integrations/tools/google_scholar.ipynb @@ -56,8 +56,8 @@ "It's also helpful to set up [LangSmith](https://smith.langchain.com/) for best-in-class observability:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-langchain-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-langchain-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/tools/serpapi.ipynb b/docs/core_docs/docs/integrations/tools/serpapi.ipynb index 0172711a380e..b928d5ce89e8 100644 --- a/docs/core_docs/docs/integrations/tools/serpapi.ipynb +++ b/docs/core_docs/docs/integrations/tools/serpapi.ipynb @@ -59,8 +59,8 @@ "It's also helpful (but not needed) to set up [LangSmith](https://smith.langchain.com/) for best-in-class observability:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/tools/tavily_search.ipynb b/docs/core_docs/docs/integrations/tools/tavily_search.ipynb index 327c1f677c2c..72e12bd1fc36 100644 --- a/docs/core_docs/docs/integrations/tools/tavily_search.ipynb +++ b/docs/core_docs/docs/integrations/tools/tavily_search.ipynb @@ -59,8 +59,8 @@ "It's also helpful (but not needed) to set up [LangSmith](https://smith.langchain.com/) for best-in-class observability:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/chroma.ipynb b/docs/core_docs/docs/integrations/vectorstores/chroma.ipynb index 567f9415ca5f..28197e2a4087 100644 --- a/docs/core_docs/docs/integrations/vectorstores/chroma.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/chroma.ipynb @@ -84,8 +84,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/elasticsearch.ipynb b/docs/core_docs/docs/integrations/vectorstores/elasticsearch.ipynb index 2b3789eb9a7e..a30f8bb1978a 100644 --- a/docs/core_docs/docs/integrations/vectorstores/elasticsearch.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/elasticsearch.ipynb @@ -91,8 +91,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/faiss.ipynb b/docs/core_docs/docs/integrations/vectorstores/faiss.ipynb index 1d3422ce34f5..95f94c8c4c04 100644 --- a/docs/core_docs/docs/integrations/vectorstores/faiss.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/faiss.ipynb @@ -86,8 +86,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/hnswlib.ipynb b/docs/core_docs/docs/integrations/vectorstores/hnswlib.ipynb index 8ec5ece7ed0b..78b5a1fb2615 100644 --- a/docs/core_docs/docs/integrations/vectorstores/hnswlib.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/hnswlib.ipynb @@ -90,8 +90,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/memory.ipynb b/docs/core_docs/docs/integrations/vectorstores/memory.ipynb index c38d1a03e118..681d81b70078 100644 --- a/docs/core_docs/docs/integrations/vectorstores/memory.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/memory.ipynb @@ -77,8 +77,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/mongodb_atlas.ipynb b/docs/core_docs/docs/integrations/vectorstores/mongodb_atlas.ipynb index e84e4a8bf31d..f697d3629360 100644 --- a/docs/core_docs/docs/integrations/vectorstores/mongodb_atlas.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/mongodb_atlas.ipynb @@ -131,8 +131,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/pgvector.ipynb b/docs/core_docs/docs/integrations/vectorstores/pgvector.ipynb index 29eb2fbe98cc..ca148923f530 100644 --- a/docs/core_docs/docs/integrations/vectorstores/pgvector.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/pgvector.ipynb @@ -110,8 +110,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/pinecone.ipynb b/docs/core_docs/docs/integrations/vectorstores/pinecone.ipynb index d47880caebb0..480c710d9127 100644 --- a/docs/core_docs/docs/integrations/vectorstores/pinecone.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/pinecone.ipynb @@ -83,8 +83,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/qdrant.ipynb b/docs/core_docs/docs/integrations/vectorstores/qdrant.ipynb index ce91818a4ca0..870485c1a5fa 100644 --- a/docs/core_docs/docs/integrations/vectorstores/qdrant.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/qdrant.ipynb @@ -89,8 +89,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/redis.ipynb b/docs/core_docs/docs/integrations/vectorstores/redis.ipynb index 3d6a038d8940..a98fb5b2d4d7 100644 --- a/docs/core_docs/docs/integrations/vectorstores/redis.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/redis.ipynb @@ -88,8 +88,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/supabase.ipynb b/docs/core_docs/docs/integrations/vectorstores/supabase.ipynb index 6b6f49a09d02..3979944bd60e 100644 --- a/docs/core_docs/docs/integrations/vectorstores/supabase.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/supabase.ipynb @@ -127,8 +127,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/upstash.ipynb b/docs/core_docs/docs/integrations/vectorstores/upstash.ipynb index 2817456b4719..882e32beb03c 100644 --- a/docs/core_docs/docs/integrations/vectorstores/upstash.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/upstash.ipynb @@ -90,8 +90,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/integrations/vectorstores/weaviate.ipynb b/docs/core_docs/docs/integrations/vectorstores/weaviate.ipynb index bcee4bf2b3dd..4e10d08a802a 100644 --- a/docs/core_docs/docs/integrations/vectorstores/weaviate.ipynb +++ b/docs/core_docs/docs/integrations/vectorstores/weaviate.ipynb @@ -86,8 +86,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/docs/core_docs/docs/tutorials/chatbot.ipynb b/docs/core_docs/docs/tutorials/chatbot.ipynb index d21d9cd92591..29d8878c2ed6 100644 --- a/docs/core_docs/docs/tutorials/chatbot.ipynb +++ b/docs/core_docs/docs/tutorials/chatbot.ipynb @@ -91,8 +91,8 @@ "After you sign up at the link above, make sure to set your environment variables to start logging traces:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2 = \"true\"\n", - "process.env.LANGCHAIN_API_KEY = \"...\"\n", + "process.env.LANGSMITH_TRACING = \"true\"\n", + "process.env.LANGSMITH_API_KEY = \"...\"\n", "```\n", "\n", "## Quickstart\n", diff --git a/docs/core_docs/docs/tutorials/extraction.ipynb b/docs/core_docs/docs/tutorials/extraction.ipynb index 31f09ab75631..e5a23914627f 100644 --- a/docs/core_docs/docs/tutorials/extraction.ipynb +++ b/docs/core_docs/docs/tutorials/extraction.ipynb @@ -64,8 +64,8 @@ "After you sign up at the link above, make sure to set your environment variables to start logging traces:\n", "\n", "```shell\n", - "export LANGCHAIN_TRACING_V2=\"true\"\n", - "export LANGCHAIN_API_KEY=\"...\"\n", + "export LANGSMITH_TRACING=\"true\"\n", + "export LANGSMITH_API_KEY=\"...\"\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/tutorials/graph.ipynb b/docs/core_docs/docs/tutorials/graph.ipynb index 0d8ab1ba18ad..28bf22191890 100644 --- a/docs/core_docs/docs/tutorials/graph.ipynb +++ b/docs/core_docs/docs/tutorials/graph.ipynb @@ -61,7 +61,7 @@ "\n", "# Optional, use LangSmith for best-in-class observability\n", "LANGSMITH_API_KEY=your-api-key\n", - "LANGCHAIN_TRACING_V2=true\n", + "LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/tutorials/llm_chain.ipynb b/docs/core_docs/docs/tutorials/llm_chain.ipynb index d108edb0d65e..1c04758b0ac0 100644 --- a/docs/core_docs/docs/tutorials/llm_chain.ipynb +++ b/docs/core_docs/docs/tutorials/llm_chain.ipynb @@ -57,8 +57,8 @@ "After you sign up at the link above, make sure to set your environment variables to start logging traces:\n", "\n", "```shell\n", - "export LANGCHAIN_TRACING_V2=\"true\"\n", - "export LANGCHAIN_API_KEY=\"...\"\n", + "export LANGSMITH_TRACING=\"true\"\n", + "export LANGSMITH_API_KEY=\"...\"\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/tutorials/qa_chat_history.ipynb b/docs/core_docs/docs/tutorials/qa_chat_history.ipynb index d97d7d297234..0dc020a50047 100644 --- a/docs/core_docs/docs/tutorials/qa_chat_history.ipynb +++ b/docs/core_docs/docs/tutorials/qa_chat_history.ipynb @@ -164,8 +164,8 @@ "\n", "\n", "```bash\n", - "export LANGCHAIN_TRACING_V2=true\n", - "export LANGCHAIN_API_KEY=YOUR_KEY\n", + "export LANGSMITH_TRACING=true\n", + "export LANGSMITH_API_KEY=YOUR_KEY\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/tutorials/rag.ipynb b/docs/core_docs/docs/tutorials/rag.ipynb index 5de1dd38681f..7d9472d9c00c 100644 --- a/docs/core_docs/docs/tutorials/rag.ipynb +++ b/docs/core_docs/docs/tutorials/rag.ipynb @@ -81,8 +81,8 @@ "After you sign up at the link above, make sure to set your environment variables to start logging traces:\n", "\n", "```shell\n", - "export LANGCHAIN_TRACING_V2=\"true\"\n", - "export LANGCHAIN_API_KEY=\"...\"\n", + "export LANGSMITH_TRACING=\"true\"\n", + "export LANGSMITH_API_KEY=\"...\"\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/tutorials/retrievers.ipynb b/docs/core_docs/docs/tutorials/retrievers.ipynb index 2981196652b2..12a386504417 100644 --- a/docs/core_docs/docs/tutorials/retrievers.ipynb +++ b/docs/core_docs/docs/tutorials/retrievers.ipynb @@ -51,8 +51,8 @@ "After you sign up at the link above, make sure to set your environment variables to start logging traces:\n", "\n", "```shell\n", - "export LANGCHAIN_TRACING_V2=\"true\"\n", - "export LANGCHAIN_API_KEY=\"...\"\n", + "export LANGSMITH_TRACING=\"true\"\n", + "export LANGSMITH_API_KEY=\"...\"\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/tutorials/sql_qa.ipynb b/docs/core_docs/docs/tutorials/sql_qa.ipynb index b072052b56f2..7bf61ea8d0d4 100644 --- a/docs/core_docs/docs/tutorials/sql_qa.ipynb +++ b/docs/core_docs/docs/tutorials/sql_qa.ipynb @@ -43,8 +43,8 @@ "\n", "```shell\n", "# Uncomment the below to use LangSmith. Not required, but recommended for debugging and observability.\n", - "# export LANGCHAIN_API_KEY=\n", - "# export LANGCHAIN_TRACING_V2=true\n", + "# export LANGSMITH_API_KEY=\n", + "# export LANGSMITH_TRACING=true\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/docs/core_docs/docs/tutorials/summarization.ipynb b/docs/core_docs/docs/tutorials/summarization.ipynb index aacf448b7e69..c854982b829e 100644 --- a/docs/core_docs/docs/tutorials/summarization.ipynb +++ b/docs/core_docs/docs/tutorials/summarization.ipynb @@ -79,8 +79,8 @@ "After you sign up at the link above, make sure to set your environment variables to start logging traces:\n", "\n", "```shell\n", - "export LANGCHAIN_TRACING_V2=\"true\"\n", - "export LANGCHAIN_API_KEY=\"...\"\n", + "export LANGSMITH_TRACING=\"true\"\n", + "export LANGSMITH_API_KEY=\"...\"\n", "\n", "# Reduce tracing latency if you are not in a serverless environment\n", "# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n", diff --git a/libs/langchain-scripts/src/cli/docs/templates/chat.ipynb b/libs/langchain-scripts/src/cli/docs/templates/chat.ipynb index 303493051839..a700e4312fc9 100644 --- a/libs/langchain-scripts/src/cli/docs/templates/chat.ipynb +++ b/libs/langchain-scripts/src/cli/docs/templates/chat.ipynb @@ -59,8 +59,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/libs/langchain-scripts/src/cli/docs/templates/llms.ipynb b/libs/langchain-scripts/src/cli/docs/templates/llms.ipynb index 5a27e5839758..ce2b97c41614 100644 --- a/libs/langchain-scripts/src/cli/docs/templates/llms.ipynb +++ b/libs/langchain-scripts/src/cli/docs/templates/llms.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/libs/langchain-scripts/src/cli/docs/templates/text_embedding.ipynb b/libs/langchain-scripts/src/cli/docs/templates/text_embedding.ipynb index b5d950b75b37..8140fc1f6894 100644 --- a/libs/langchain-scripts/src/cli/docs/templates/text_embedding.ipynb +++ b/libs/langchain-scripts/src/cli/docs/templates/text_embedding.ipynb @@ -55,8 +55,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```bash\n", - "# export LANGCHAIN_TRACING_V2=\"true\"\n", - "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "# export LANGSMITH_TRACING=\"true\"\n", + "# export LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/libs/langchain-scripts/src/cli/docs/templates/toolkits.ipynb b/libs/langchain-scripts/src/cli/docs/templates/toolkits.ipynb index 903bc3619cd6..43db0617640b 100644 --- a/libs/langchain-scripts/src/cli/docs/templates/toolkits.ipynb +++ b/libs/langchain-scripts/src/cli/docs/templates/toolkits.ipynb @@ -32,8 +32,8 @@ "If you want to get automated tracing from runs of individual tools, you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```\n", "\n", "### Installation\n", diff --git a/libs/langchain-scripts/src/cli/docs/templates/tools.ipynb b/libs/langchain-scripts/src/cli/docs/templates/tools.ipynb index 0225185d5b6a..3559c528de74 100644 --- a/libs/langchain-scripts/src/cli/docs/templates/tools.ipynb +++ b/libs/langchain-scripts/src/cli/docs/templates/tools.ipynb @@ -69,8 +69,8 @@ "It's also helpful (but not needed) to set up [LangSmith](https://smith.langchain.com/) for best-in-class observability:\n", "\n", "```typescript\n", - "process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "process.env.LANGSMITH_TRACING=\"true\"\n", + "process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, diff --git a/libs/langchain-scripts/src/cli/docs/templates/vectorstores.ipynb b/libs/langchain-scripts/src/cli/docs/templates/vectorstores.ipynb index f3a4714a0f62..ccc4f5a62d31 100644 --- a/libs/langchain-scripts/src/cli/docs/templates/vectorstores.ipynb +++ b/libs/langchain-scripts/src/cli/docs/templates/vectorstores.ipynb @@ -86,8 +86,8 @@ "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", "\n", "```typescript\n", - "// process.env.LANGCHAIN_TRACING_V2=\"true\"\n", - "// process.env.LANGCHAIN_API_KEY=\"your-api-key\"\n", + "// process.env.LANGSMITH_TRACING=\"true\"\n", + "// process.env.LANGSMITH_API_KEY=\"your-api-key\"\n", "```" ] }, From d727338816f2b3c6da01f8816da76da3792ca950 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 10 Jan 2025 13:43:30 -0800 Subject: [PATCH 02/34] fix(langchain,core): Add metadata to pulled hub prompts (#7497) --- langchain-core/src/prompts/base.ts | 15 ++++++++++++++- langchain/src/hub.ts | 19 +++++++++++++++++-- langchain/src/tests/hub.int.test.ts | 8 ++++---- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/langchain-core/src/prompts/base.ts b/langchain-core/src/prompts/base.ts index f9e02387e261..ad5d61b32ffd 100644 --- a/langchain-core/src/prompts/base.ts +++ b/langchain-core/src/prompts/base.ts @@ -74,6 +74,14 @@ export abstract class BasePromptTemplate< partialVariables: PartialValues; + /** + * Metadata to be used for tracing. + */ + metadata?: Record; + + /** Tags to be used for tracing. */ + tags?: string[]; + constructor(input: BasePromptTemplateInput) { super(input); const { inputVariables } = input; @@ -127,10 +135,15 @@ export abstract class BasePromptTemplate< input: RunInput, options?: BaseCallbackConfig ): Promise { + const metadata = { + ...this.metadata, + ...options?.metadata, + }; + const tags = [...(this.tags ?? []), ...(options?.tags ?? [])]; return this._callWithConfig( (input: RunInput) => this.formatPromptValue(input), input, - { ...options, runType: "prompt" } + { ...options, tags, metadata, runType: "prompt" } ); } diff --git a/langchain/src/hub.ts b/langchain/src/hub.ts index 53abe8e8c1fc..1ad631030778 100644 --- a/langchain/src/hub.ts +++ b/langchain/src/hub.ts @@ -50,8 +50,23 @@ export async function pull( options?: { apiKey?: string; apiUrl?: string; includeModel?: boolean } ) { const client = new Client(options); - const result = await client._pullPrompt(ownerRepoCommit, { + + const promptObject = await client.pullPromptCommit(ownerRepoCommit, { includeModel: options?.includeModel, }); - return load(result); + + if (promptObject.manifest.kwargs?.metadata === undefined) { + promptObject.manifest.kwargs = { + ...promptObject.manifest.kwargs, + metadata: {}, + }; + } + + promptObject.manifest.kwargs.metadata = { + ...promptObject.manifest.kwargs.metadata, + lc_hub_owner: promptObject.owner, + lc_hub_repo: promptObject.repo, + lc_hub_commit_hash: promptObject.commit_hash, + }; + return load(JSON.stringify(promptObject.manifest)); } diff --git a/langchain/src/tests/hub.int.test.ts b/langchain/src/tests/hub.int.test.ts index 43b87f699d25..442520289705 100644 --- a/langchain/src/tests/hub.int.test.ts +++ b/langchain/src/tests/hub.int.test.ts @@ -1,10 +1,10 @@ /* eslint-disable no-process-env */ -import { PromptTemplate } from "@langchain/core/prompts"; +import { ChatPromptTemplate } from "@langchain/core/prompts"; import * as hub from "../hub.js"; test("Test LangChain Hub client pushing a new repo", async () => { - const prompt = PromptTemplate.fromTemplate( + const prompt = ChatPromptTemplate.fromTemplate( `You are a parrot. The current date is ${new Date().toISOString()}\n{input}` ); const repoName = `${ @@ -14,7 +14,7 @@ test("Test LangChain Hub client pushing a new repo", async () => { newRepoIsPublic: false, }); const pulledPrompt = await hub.pull(repoName); - expect(prompt.invoke({ input: "testing" })).toEqual( - pulledPrompt.invoke({ input: "testing" }) + expect(await prompt.invoke({ input: "testing" })).toEqual( + await pulledPrompt.invoke({ input: "testing" }) ); }); From 8ad85473a0d294ad596bb9aa280d3b67769ce8d7 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 10 Jan 2025 13:45:59 -0800 Subject: [PATCH 03/34] release(core): 0.3.28 (#7498) --- langchain-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain-core/package.json b/langchain-core/package.json index b938bb050122..6e3ddfc22d88 100644 --- a/langchain-core/package.json +++ b/langchain-core/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/core", - "version": "0.3.27", + "version": "0.3.28", "description": "Core LangChain.js abstractions and schemas", "type": "module", "engines": { From e6fad4abe7eb6c24183e3693bf466ffd192cc6f9 Mon Sep 17 00:00:00 2001 From: Allen Firstenberg Date: Fri, 10 Jan 2025 17:07:18 -0500 Subject: [PATCH 04/34] fix(google-common): Search grounding formatting (#7471) --- .../src/output_parsers.ts | 9 +++++---- .../src/tests/output_parsers.test.ts | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/libs/langchain-google-common/src/output_parsers.ts b/libs/langchain-google-common/src/output_parsers.ts index 8ca9377011ba..2c0d0d031022 100644 --- a/libs/langchain-google-common/src/output_parsers.ts +++ b/libs/langchain-google-common/src/output_parsers.ts @@ -23,9 +23,9 @@ export abstract class BaseGoogleSearchOutputParser extends BaseLLMOutputParser { ret = `${ret}${this.chunkToString(chunk, index)}\n`; }); diff --git a/libs/langchain-google-common/src/tests/output_parsers.test.ts b/libs/langchain-google-common/src/tests/output_parsers.test.ts index ac3c135f5279..f3be76f57456 100644 --- a/libs/langchain-google-common/src/tests/output_parsers.test.ts +++ b/libs/langchain-google-common/src/tests/output_parsers.test.ts @@ -214,4 +214,23 @@ describe("GoogleSearchOutputParsers", () => { expect(result).toEqual(expectation); }); + + test("non-grounded", async () => { + const record: Record = {}; + const projectId = mockId(); + const authOptions: MockClientAuthInfo = { + record, + projectId, + resultFile: "chat-1-mock.json", + }; + + const model = new ChatGoogle({ + authOptions, + modelName: "gemini-1.5-pro-002", + }); + const parser = new SimpleGoogleSearchOutputParser(); + const chain = model.pipe(parser); + const result = await chain.invoke("Flip a coin."); + expect(result).toEqual("T"); + }); }); From acdd97298eb4715105f57aa1a0db8c5109dd6e42 Mon Sep 17 00:00:00 2001 From: Allen Firstenberg Date: Fri, 10 Jan 2025 17:13:36 -0500 Subject: [PATCH 05/34] feat(google-common): Gemini logprobs (#7472) Co-authored-by: jacoblee93 --- .../integrations/chat/google_vertex_ai.ipynb | 4 +- .../src/chat_models.ts | 8 + .../src/tests/chat_models.test.ts | 33 + .../src/tests/data/chat-7-mock.json | 8512 +++++++++++++++++ libs/langchain-google-common/src/types.ts | 68 +- .../src/utils/common.ts | 11 + .../src/utils/gemini.ts | 70 + 7 files changed, 8704 insertions(+), 2 deletions(-) create mode 100644 libs/langchain-google-common/src/tests/data/chat-7-mock.json diff --git a/docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb b/docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb index 7d0dca71a23a..7337779ab8a9 100644 --- a/docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb +++ b/docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb @@ -41,7 +41,9 @@ "\n", "| [Tool calling](/docs/how_to/tool_calling) | [Structured output](/docs/how_to/structured_output/) | JSON mode | [Image input](/docs/how_to/multimodal_inputs/) | Audio input | Video input | [Token-level streaming](/docs/how_to/chat_streaming/) | [Token usage](/docs/how_to/chat_token_usage_tracking/) | [Logprobs](/docs/how_to/logprobs/) |\n", "| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n", - "| ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | \n", + "| ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | \n", + "\n", + "Note that while logprobs are supported, Gemini has fairly restricted usage of them.\n", "\n", "## Setup\n", "\n", diff --git a/libs/langchain-google-common/src/chat_models.ts b/libs/langchain-google-common/src/chat_models.ts index 15bf21fd3c94..a345497c0d8f 100644 --- a/libs/langchain-google-common/src/chat_models.ts +++ b/libs/langchain-google-common/src/chat_models.ts @@ -189,8 +189,16 @@ export abstract class ChatGoogleBase topK = 40; + presencePenalty: number; + + frequencyPenalty: number; + stopSequences: string[] = []; + logprobs: boolean = false; + + topLogprobs: number = 0; + safetySettings: GoogleAISafetySetting[] = []; // May intentionally be undefined, meaning to compute this. diff --git a/libs/langchain-google-common/src/tests/chat_models.test.ts b/libs/langchain-google-common/src/tests/chat_models.test.ts index 0192c5b67710..406e399c12b0 100644 --- a/libs/langchain-google-common/src/tests/chat_models.test.ts +++ b/libs/langchain-google-common/src/tests/chat_models.test.ts @@ -1250,6 +1250,39 @@ describe("Mock ChatGoogle - Gemini", () => { expect(record.opts.data.tools[0]).toHaveProperty("googleSearch"); }); + + test("7. logprobs", async () => { + const record: Record = {}; + const projectId = mockId(); + const authOptions: MockClientAuthInfo = { + record, + projectId, + resultFile: "chat-7-mock.json", + }; + + const model = new ChatGoogle({ + authOptions, + modelName: "gemini-1.5-flash-002", + logprobs: true, + topLogprobs: 5, + }); + const result = await model.invoke( + "What are some names for a company that makes fancy socks?" + ); + // console.log(JSON.stringify(result,null,1)); + expect(result.response_metadata).toHaveProperty("logprobs"); + expect(result.response_metadata.logprobs).toHaveProperty("content"); + const logprobs = result.response_metadata.logprobs.content; + expect(Array.isArray(logprobs)).toBeTruthy(); + expect(logprobs).toHaveLength(303); + const first = logprobs[0]; + expect(first.token).toEqual("Here"); + expect(first.logprob).toEqual(-0.25194553); + expect(first.bytes).toEqual([72, 101, 114, 101]); + expect(first).toHaveProperty("top_logprobs"); + expect(Array.isArray(first.top_logprobs)).toBeTruthy(); + expect(first.top_logprobs).toHaveLength(5); + }); }); describe("Mock ChatGoogle - Anthropic", () => { diff --git a/libs/langchain-google-common/src/tests/data/chat-7-mock.json b/libs/langchain-google-common/src/tests/data/chat-7-mock.json new file mode 100644 index 000000000000..f6cc0c445821 --- /dev/null +++ b/libs/langchain-google-common/src/tests/data/chat-7-mock.json @@ -0,0 +1,8512 @@ +{ + "candidates": [ + { + "content": { + "role": "model", + "parts": [ + { + "text": "Here are some name ideas for a company that makes colorful socks, categorized by approach:\n\n**Playful & Fun:**\n\n* SockHop\n* Toe-tally Rad Socks\n* Happy Feet\n* Rainbow Runners\n* Colour Craze Socks\n* The Sock Drawer\n* Socktastic\n* Footloose & Fancy Free\n* Whimsical Threads\n* Colour Riot Socks\n\n**Sophisticated & Chic:**\n\n* Atelier des Chaussettes (French for \"Sock Atelier\")\n* The Sock Studio\n* Hue & Cry\n* ChromaThreads\n* The Sock Gallery\n* Spectrum Socks\n* Colour Collective\n* Threadbare & Bold\n\n**Unique & Memorable:**\n\n* SoleMates\n* FootPrints\n* Sockfluence\n* Threadbare Tales\n* Knit Wit\n* Legacies\n* The Hosiery House\n\n**Location Specific (if applicable):**\n\n* [City/Region] Sock Co.\n* [Landmark] Socks\n\n**Tips for choosing a name:**\n\n* **Check for availability:** Make sure the name isn't already in use (website domain, trademarks).\n* **Keep it short and memorable:** Easy to recall and share.\n* **Reflect your brand:** Choose a name that aligns with your target audience and brand aesthetic.\n* **Say it out loud:** Ensure it sounds good and is easy to pronounce.\n\n\nRemember to also consider a logo and overall branding to complement your chosen name. Good luck!\n" + } + ] + }, + "finishReason": "STOP", + "avgLogprobs": -0.26434122217763767, + "logprobsResult": { + "topCandidates": [ + { + "candidates": [ + { + "token": "Here", + "logProbability": -0.25194553 + }, + { + "token": "**", + "logProbability": -1.5019455 + }, + { + "token": "##", + "logProbability": -9.916008 + }, + { + "token": "The", + "logProbability": -10.5331955 + }, + { + "token": "These", + "logProbability": -14.1581955 + } + ] + }, + { + "candidates": [ + { + "token": " are", + "logProbability": -1.1922384e-7 + }, + { + "token": "'", + "logProbability": -15.694138 + }, + { + "token": " some", + "logProbability": -20.616405 + }, + { + "token": " a", + "logProbability": -22.49442 + }, + { + "token": " is", + "logProbability": -22.650084 + } + ] + }, + { + "candidates": [ + { + "token": " some", + "logProbability": -3.5760596e-7 + }, + { + "token": " a", + "logProbability": -14.817986 + }, + { + "token": " several", + "logProbability": -20.820503 + }, + { + "token": " name", + "logProbability": -22.420506 + }, + { + "token": " names", + "logProbability": -23.20113 + } + ] + }, + { + "candidates": [ + { + "token": " name", + "logProbability": -0.020438675 + }, + { + "token": " names", + "logProbability": -3.9168255 + }, + { + "token": " good", + "logProbability": -9.115605 + }, + { + "token": " company", + "logProbability": -9.24403 + }, + { + "token": " ideas", + "logProbability": -9.399645 + } + ] + }, + { + "candidates": [ + { + "token": " ideas", + "logProbability": -3.802634e-5 + }, + { + "token": " suggestions", + "logProbability": -10.181425 + }, + { + "token": " options", + "logProbability": -15.738333 + }, + { + "token": " Ideas", + "logProbability": -20.153091 + }, + { + "token": " possibilities", + "logProbability": -20.603498 + } + ] + }, + { + "candidates": [ + { + "token": " for", + "logProbability": -0.00055940077 + }, + { + "token": ",", + "logProbability": -7.4917626 + }, + { + "token": " categorized", + "logProbability": -13.49046 + }, + { + "token": " grouped", + "logProbability": -16.303265 + }, + { + "token": " depending", + "logProbability": -16.397642 + } + ] + }, + { + "candidates": [ + { + "token": " a", + "logProbability": -2.3844768e-7 + }, + { + "token": " colorful", + "logProbability": -16.56449 + }, + { + "token": " company", + "logProbability": -17.571163 + }, + { + "token": " your", + "logProbability": -17.578941 + }, + { + "token": " colourful", + "logProbability": -19.162834 + } + ] + }, + { + "candidates": [ + { + "token": " company", + "logProbability": -0.06226602 + }, + { + "token": " colorful", + "logProbability": -2.8080766 + }, + { + "token": " colourful", + "logProbability": -10.183396 + }, + { + "token": " brightly", + "logProbability": -16.94448 + }, + { + "token": " sock", + "logProbability": -17.014145 + } + ] + }, + { + "candidates": [ + { + "token": " that", + "logProbability": -0.00017984792 + }, + { + "token": " making", + "logProbability": -8.629269 + }, + { + "token": " selling", + "logProbability": -14.107385 + }, + { + "token": " specializing", + "logProbability": -14.895128 + }, + { + "token": " producing", + "logProbability": -16.543829 + } + ] + }, + { + "candidates": [ + { + "token": " makes", + "logProbability": -0.00032727723 + }, + { + "token": " made", + "logProbability": -8.026169 + }, + { + "token": " manufactures", + "logProbability": -15.399625 + }, + { + "token": " sells", + "logProbability": -15.598122 + }, + { + "token": " produces", + "logProbability": -16.080608 + } + ] + }, + { + "candidates": [ + { + "token": " colorful", + "logProbability": -3.7668888e-5 + }, + { + "token": " colourful", + "logProbability": -10.187755 + }, + { + "token": " brightly", + "logProbability": -21.412354 + }, + { + "token": " colored", + "logProbability": -21.490604 + }, + { + "token": " Colorful", + "logProbability": -22.703083 + } + ] + }, + { + "candidates": [ + { + "token": " socks", + "logProbability": 0 + }, + { + "token": ",", + "logProbability": -18.828543 + }, + { + "token": " and", + "logProbability": -19.52954 + }, + { + "token": " (", + "logProbability": -21.187235 + }, + { + "token": " sock", + "logProbability": -21.28269 + } + ] + }, + { + "candidates": [ + { + "token": ",", + "logProbability": -9.537907e-7 + }, + { + "token": " categorized", + "logProbability": -14.790454 + }, + { + "token": ":", + "logProbability": -15.205658 + }, + { + "token": " with", + "logProbability": -17.110876 + }, + { + "token": " based", + "logProbability": -17.174856 + } + ] + }, + { + "candidates": [ + { + "token": " categorized", + "logProbability": -0.0021683632 + }, + { + "token": " broken", + "logProbability": -6.1643405 + }, + { + "token": " grouped", + "logProbability": -9.730553 + }, + { + "token": " catering", + "logProbability": -13.656354 + }, + { + "token": " categor", + "logProbability": -13.759873 + } + ] + }, + { + "candidates": [ + { + "token": " for", + "logProbability": -0.57478875 + }, + { + "token": " by", + "logProbability": -0.82754296 + }, + { + "token": " to", + "logProbability": -9.874866 + }, + { + "token": " ", + "logProbability": -16.26029 + }, + { + "token": " based", + "logProbability": -16.83996 + } + ] + }, + { + "candidates": [ + { + "token": " approach", + "logProbability": -0.40137294 + }, + { + "token": " style", + "logProbability": -1.4607892 + }, + { + "token": " their", + "logProbability": -2.9734 + }, + { + "token": " different", + "logProbability": -3.5953007 + }, + { + "token": " the", + "logProbability": -4.02244 + } + ] + }, + { + "candidates": [ + { + "token": ":", + "logProbability": -1.3112239e-6 + }, + { + "token": " for", + "logProbability": -14.053153 + }, + { + "token": " to", + "logProbability": -14.987548 + }, + { + "token": ",", + "logProbability": -16.462852 + }, + { + "token": " and", + "logProbability": -16.52203 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n", + "logProbability": -0.00023421005 + }, + { + "token": "\n\n\n", + "logProbability": -8.359315 + }, + { + "token": " ", + "logProbability": -18.006403 + }, + { + "token": " ", + "logProbability": -19.611856 + }, + { + "token": "\n\n\n\n", + "logProbability": -19.812788 + } + ] + }, + { + "candidates": [ + { + "token": "**", + "logProbability": 0 + }, + { + "token": " **", + "logProbability": -21.79183 + }, + { + "token": "__", + "logProbability": -22.620869 + }, + { + "token": "*", + "logProbability": -22.67463 + }, + { + "token": "**(", + "logProbability": -23.801506 + } + ] + }, + { + "candidates": [ + { + "token": "Fun", + "logProbability": -0.39541456 + }, + { + "token": "Play", + "logProbability": -1.206775 + }, + { + "token": "Catch", + "logProbability": -3.6572073 + }, + { + "token": "Focusing", + "logProbability": -7.270644 + }, + { + "token": "Whi", + "logProbability": -7.780273 + } + ] + }, + { + "candidates": [ + { + "token": "ful", + "logProbability": 0 + }, + { + "token": "fully", + "logProbability": -21.115334 + }, + { + "token": "full", + "logProbability": -24.071392 + }, + { + "token": "fulness", + "logProbability": -25.680433 + }, + { + "token": " on", + "logProbability": -26.734198 + } + ] + }, + { + "candidates": [ + { + "token": " &", + "logProbability": 0 + }, + { + "token": " and", + "logProbability": -18.132397 + }, + { + "token": "/", + "logProbability": -18.446154 + }, + { + "token": " Names", + "logProbability": -24.019363 + }, + { + "token": ":**", + "logProbability": -25.819286 + } + ] + }, + { + "candidates": [ + { + "token": " Fun", + "logProbability": -0.0060783206 + }, + { + "token": " Whi", + "logProbability": -5.9867797 + }, + { + "token": " Quir", + "logProbability": -6.271792 + }, + { + "token": " Pun", + "logProbability": -6.6368012 + }, + { + "token": " Catch", + "logProbability": -8.071015 + } + ] + }, + { + "candidates": [ + { + "token": ":**", + "logProbability": -3.5760596e-7 + }, + { + "token": " Names", + "logProbability": -15.004901 + }, + { + "token": "-", + "logProbability": -19.099224 + }, + { + "token": "**:", + "logProbability": -19.68233 + }, + { + "token": " names", + "logProbability": -20.531328 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n", + "logProbability": 0 + }, + { + "token": "\n\n\n", + "logProbability": -18.641006 + }, + { + "token": " ", + "logProbability": -23.43147 + }, + { + "token": " ", + "logProbability": -23.431862 + }, + { + "token": "\n", + "logProbability": -23.898985 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -28.686771 + }, + { + "token": " *", + "logProbability": -28.978676 + }, + { + "token": " ", + "logProbability": -29.65638 + }, + { + "token": "-", + "logProbability": -29.814919 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -3.1831478e-5 + }, + { + "token": " Rainbow", + "logProbability": -10.867438 + }, + { + "token": " Happy", + "logProbability": -12.568768 + }, + { + "token": " Pop", + "logProbability": -12.759208 + }, + { + "token": " Toe", + "logProbability": -12.937927 + } + ] + }, + { + "candidates": [ + { + "token": " Hop", + "logProbability": -1.0557756 + }, + { + "token": "d", + "logProbability": -1.1686115 + }, + { + "token": "t", + "logProbability": -2.3179302 + }, + { + "token": "Hop", + "logProbability": -2.8257122 + }, + { + "token": " Riot", + "logProbability": -3.294215 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -7.987648e-6 + }, + { + "token": " Socks", + "logProbability": -12.599591 + }, + { + "token": ":", + "logProbability": -13.429787 + }, + { + "token": " Studios", + "logProbability": -13.770693 + }, + { + "token": " So", + "logProbability": -14.11485 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -23.588676 + }, + { + "token": " ", + "logProbability": -25.453793 + }, + { + "token": " ", + "logProbability": -26.48011 + }, + { + "token": " *", + "logProbability": -26.614914 + } + ] + }, + { + "candidates": [ + { + "token": " Rainbow", + "logProbability": -0.3948412 + }, + { + "token": " Happy", + "logProbability": -1.6377635 + }, + { + "token": " Pop", + "logProbability": -3.0291953 + }, + { + "token": " Toe", + "logProbability": -3.047093 + }, + { + "token": " Sole", + "logProbability": -4.7177978 + } + ] + }, + { + "candidates": [ + { + "token": "-", + "logProbability": -0.012149351 + }, + { + "token": "Tally", + "logProbability": -4.802194 + }, + { + "token": " To", + "logProbability": -6.560666 + }, + { + "token": "T", + "logProbability": -7.3044014 + }, + { + "token": " T", + "logProbability": -7.974076 + } + ] + }, + { + "candidates": [ + { + "token": "tally", + "logProbability": -0.060209215 + }, + { + "token": "Tally", + "logProbability": -2.8411999 + }, + { + "token": "ally", + "logProbability": -9.7796335 + }, + { + "token": "tal", + "logProbability": -10.942186 + }, + { + "token": "T", + "logProbability": -13.92215 + } + ] + }, + { + "candidates": [ + { + "token": " Rad", + "logProbability": -0.46893552 + }, + { + "token": " Awesome", + "logProbability": -0.9830947 + }, + { + "token": " Fun", + "logProbability": -8.986122 + }, + { + "token": " Colorful", + "logProbability": -9.970608 + }, + { + "token": " Tub", + "logProbability": -11.319198 + } + ] + }, + { + "candidates": [ + { + "token": " Socks", + "logProbability": -0.017792623 + }, + { + "token": "\n", + "logProbability": -4.038457 + }, + { + "token": " So", + "logProbability": -12.220973 + }, + { + "token": " Sox", + "logProbability": -12.457627 + }, + { + "token": " Threads", + "logProbability": -13.633727 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -5.9602587e-7 + }, + { + "token": " ", + "logProbability": -14.984302 + }, + { + "token": " (", + "logProbability": -15.797033 + }, + { + "token": " ", + "logProbability": -16.634811 + }, + { + "token": "!", + "logProbability": -18.014585 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -29.215422 + }, + { + "token": " *", + "logProbability": -30.286762 + }, + { + "token": "**", + "logProbability": -32.055237 + }, + { + "token": " ", + "logProbability": -32.096664 + } + ] + }, + { + "candidates": [ + { + "token": " Happy", + "logProbability": -0.35176113 + }, + { + "token": " Rainbow", + "logProbability": -1.493644 + }, + { + "token": " The", + "logProbability": -3.2468503 + }, + { + "token": " Colour", + "logProbability": -4.2815847 + }, + { + "token": " Foot", + "logProbability": -4.733854 + } + ] + }, + { + "candidates": [ + { + "token": " Feet", + "logProbability": -0.002849315 + }, + { + "token": " S", + "logProbability": -5.938133 + }, + { + "token": " To", + "logProbability": -8.904338 + }, + { + "token": " Socks", + "logProbability": -10.025851 + }, + { + "token": "Feet", + "logProbability": -10.782205 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.042537317 + }, + { + "token": " Co", + "logProbability": -3.2540288 + }, + { + "token": " Socks", + "logProbability": -6.636687 + }, + { + "token": " Ho", + "logProbability": -6.8971934 + }, + { + "token": " Inc", + "logProbability": -8.333256 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -24.231586 + }, + { + "token": " ", + "logProbability": -30.789776 + }, + { + "token": " ", + "logProbability": -31.07835 + }, + { + "token": "s", + "logProbability": -33.961777 + } + ] + }, + { + "candidates": [ + { + "token": " Rainbow", + "logProbability": -0.86355895 + }, + { + "token": " Colour", + "logProbability": -1.1040938 + }, + { + "token": " The", + "logProbability": -2.1242 + }, + { + "token": " Sock", + "logProbability": -2.907214 + }, + { + "token": " Color", + "logProbability": -3.134927 + } + ] + }, + { + "candidates": [ + { + "token": " Runners", + "logProbability": -0.09771462 + }, + { + "token": " Threads", + "logProbability": -3.258763 + }, + { + "token": " Feet", + "logProbability": -3.8578773 + }, + { + "token": " Rebels", + "logProbability": -4.177088 + }, + { + "token": " Riders", + "logProbability": -4.897027 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -1.0729074e-6 + }, + { + "token": " ", + "logProbability": -14.387284 + }, + { + "token": " (", + "logProbability": -15.1403475 + }, + { + "token": " ", + "logProbability": -15.795006 + }, + { + "token": "\n\n", + "logProbability": -18.848997 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -27.747837 + }, + { + "token": " ", + "logProbability": -30.685732 + }, + { + "token": " ", + "logProbability": -32.285583 + }, + { + "token": " *", + "logProbability": -32.375206 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.7943715 + }, + { + "token": " Colour", + "logProbability": -1.2459048 + }, + { + "token": " The", + "logProbability": -1.7740592 + }, + { + "token": " Foot", + "logProbability": -3.136529 + }, + { + "token": " Color", + "logProbability": -3.8639731 + } + ] + }, + { + "candidates": [ + { + "token": " Cra", + "logProbability": -0.011012339 + }, + { + "token": " Splash", + "logProbability": -6.1484523 + }, + { + "token": "ful", + "logProbability": -6.4102917 + }, + { + "token": " Burst", + "logProbability": -6.5535054 + }, + { + "token": "Blast", + "logProbability": -6.5723414 + } + ] + }, + { + "candidates": [ + { + "token": "ze", + "logProbability": -0.0008561311 + }, + { + "token": "ve", + "logProbability": -7.4204264 + }, + { + "token": "vings", + "logProbability": -8.456844 + }, + { + "token": "vers", + "logProbability": -10.187937 + }, + { + "token": "fters", + "logProbability": -12.248568 + } + ] + }, + { + "candidates": [ + { + "token": " Socks", + "logProbability": -0.003197624 + }, + { + "token": "\n", + "logProbability": -5.908494 + }, + { + "token": " Crew", + "logProbability": -7.6633654 + }, + { + "token": " Co", + "logProbability": -12.914738 + }, + { + "token": " Sox", + "logProbability": -13.323832 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -8.344534e-7 + }, + { + "token": " (", + "logProbability": -14.536304 + }, + { + "token": "\n\n", + "logProbability": -15.887734 + }, + { + "token": " ", + "logProbability": -16.049927 + }, + { + "token": " ", + "logProbability": -16.142374 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -26.402534 + }, + { + "token": "(", + "logProbability": -30.919502 + }, + { + "token": " ", + "logProbability": -31.108635 + }, + { + "token": " ", + "logProbability": -31.94933 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.49322605 + }, + { + "token": " The", + "logProbability": -1.1768675 + }, + { + "token": " Foot", + "logProbability": -2.8529062 + }, + { + "token": " Sole", + "logProbability": -4.43455 + }, + { + "token": " Whi", + "logProbability": -5.3265457 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -1.8953595e-5 + }, + { + "token": " Stripe", + "logProbability": -11.6607275 + }, + { + "token": " Foot", + "logProbability": -12.897153 + }, + { + "token": " Funky", + "logProbability": -13.1191635 + }, + { + "token": " Ho", + "logProbability": -13.238244 + } + ] + }, + { + "candidates": [ + { + "token": " Drawer", + "logProbability": -0.0005870343 + }, + { + "token": " Whisper", + "logProbability": -7.913459 + }, + { + "token": " Puppet", + "logProbability": -9.4320545 + }, + { + "token": "drawer", + "logProbability": -10.755825 + }, + { + "token": "Drawer", + "logProbability": -10.813411 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.0034885793 + }, + { + "token": " Explosion", + "logProbability": -6.954981 + }, + { + "token": " (", + "logProbability": -7.03 + }, + { + "token": " Explo", + "logProbability": -7.142023 + }, + { + "token": " Riot", + "logProbability": -7.899843 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -20.219494 + }, + { + "token": " ", + "logProbability": -22.82465 + }, + { + "token": " ", + "logProbability": -24.565147 + }, + { + "token": "(", + "logProbability": -25.44522 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.54668313 + }, + { + "token": " Foot", + "logProbability": -1.0322263 + }, + { + "token": " Sole", + "logProbability": -3.241031 + }, + { + "token": " Whi", + "logProbability": -4.410903 + }, + { + "token": " Funky", + "logProbability": -5.175479 + } + ] + }, + { + "candidates": [ + { + "token": " It", + "logProbability": -1.2000517 + }, + { + "token": " Monkeys", + "logProbability": -1.5568886 + }, + { + "token": " Monkey", + "logProbability": -1.6545935 + }, + { + "token": "t", + "logProbability": -2.5100746 + }, + { + "token": "tacular", + "logProbability": -3.0211072 + } + ] + }, + { + "candidates": [ + { + "token": "astic", + "logProbability": -3.5760596e-7 + }, + { + "token": "ropolis", + "logProbability": -14.775976 + }, + { + "token": "asy", + "logProbability": -16.984104 + }, + { + "token": "ástico", + "logProbability": -18.313246 + }, + { + "token": "ásticos", + "logProbability": -21.052626 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.0030594482 + }, + { + "token": "!", + "logProbability": -5.79428 + }, + { + "token": "\n\n", + "logProbability": -11.66045 + }, + { + "token": "\n\n\n", + "logProbability": -14.335386 + }, + { + "token": " ", + "logProbability": -16.261244 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -24.83786 + }, + { + "token": " ", + "logProbability": -27.938646 + }, + { + "token": " ", + "logProbability": -29.6274 + }, + { + "token": " *", + "logProbability": -31.564304 + } + ] + }, + { + "candidates": [ + { + "token": " Foot", + "logProbability": -0.15131043 + }, + { + "token": " Whi", + "logProbability": -2.1988587 + }, + { + "token": " Sole", + "logProbability": -4.5011253 + }, + { + "token": " Funky", + "logProbability": -4.8237505 + }, + { + "token": " Wild", + "logProbability": -5.514442 + } + ] + }, + { + "candidates": [ + { + "token": "loose", + "logProbability": -0.0073479274 + }, + { + "token": "lights", + "logProbability": -5.4821196 + }, + { + "token": " Fiesta", + "logProbability": -5.896083 + }, + { + "token": "Fiesta", + "logProbability": -8.540861 + }, + { + "token": " Fe", + "logProbability": -9.504195 + } + ] + }, + { + "candidates": [ + { + "token": " &", + "logProbability": -0.0020334618 + }, + { + "token": " and", + "logProbability": -7.397156 + }, + { + "token": " Fun", + "logProbability": -7.5915585 + }, + { + "token": " Ph", + "logProbability": -8.100504 + }, + { + "token": " Fancy", + "logProbability": -8.180803 + } + ] + }, + { + "candidates": [ + { + "token": " Fancy", + "logProbability": -7.271795e-6 + }, + { + "token": " Funky", + "logProbability": -11.996225 + }, + { + "token": "Fancy", + "logProbability": -14.006466 + }, + { + "token": " Colorful", + "logProbability": -15.723379 + }, + { + "token": " Fanny", + "logProbability": -16.011332 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.27639958 + }, + { + "token": " Free", + "logProbability": -1.4369822 + }, + { + "token": "\n\n", + "logProbability": -5.912573 + }, + { + "token": "-", + "logProbability": -7.309918 + }, + { + "token": "free", + "logProbability": -8.469003 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.046983317 + }, + { + "token": " Socks", + "logProbability": -3.8080268 + }, + { + "token": "\n\n", + "logProbability": -3.822845 + }, + { + "token": "\n\n\n", + "logProbability": -6.837295 + }, + { + "token": " (", + "logProbability": -7.186525 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -20.495148 + }, + { + "token": " ", + "logProbability": -24.65371 + }, + { + "token": "(", + "logProbability": -24.691565 + }, + { + "token": " ", + "logProbability": -25.267454 + } + ] + }, + { + "candidates": [ + { + "token": " Whi", + "logProbability": -0.16465758 + }, + { + "token": " Sole", + "logProbability": -2.362052 + }, + { + "token": " Wild", + "logProbability": -4.1557035 + }, + { + "token": " Sock", + "logProbability": -4.5941687 + }, + { + "token": " Funky", + "logProbability": -4.9907146 + } + ] + }, + { + "candidates": [ + { + "token": "ms", + "logProbability": -1.1922384e-7 + }, + { + "token": "mis", + "logProbability": -16.29398 + }, + { + "token": "rl", + "logProbability": -20.883486 + }, + { + "token": "z", + "logProbability": -21.404839 + }, + { + "token": "MS", + "logProbability": -22.81121 + } + ] + }, + { + "candidates": [ + { + "token": "ical", + "logProbability": -0.0016447491 + }, + { + "token": "y", + "logProbability": -6.411018 + }, + { + "token": "icle", + "logProbability": -16.001425 + }, + { + "token": "ic", + "logProbability": -19.328379 + }, + { + "token": "icals", + "logProbability": -19.585129 + } + ] + }, + { + "candidates": [ + { + "token": " Threads", + "logProbability": -0.45600042 + }, + { + "token": " Walks", + "logProbability": -1.6016252 + }, + { + "token": " Walk", + "logProbability": -2.410832 + }, + { + "token": " Wo", + "logProbability": -3.3558712 + }, + { + "token": " Wear", + "logProbability": -4.2190995 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.05170492 + }, + { + "token": "\n\n", + "logProbability": -3.0785623 + }, + { + "token": "\n\n\n", + "logProbability": -5.434975 + }, + { + "token": " ", + "logProbability": -12.821057 + }, + { + "token": " (", + "logProbability": -14.334492 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -19.21817 + }, + { + "token": " *", + "logProbability": -24.752285 + }, + { + "token": " ", + "logProbability": -25.791357 + }, + { + "token": " ", + "logProbability": -28.215881 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.6789326 + }, + { + "token": " Pop", + "logProbability": -1.2065983 + }, + { + "token": " Colour", + "logProbability": -2.4246674 + }, + { + "token": " Bright", + "logProbability": -3.6953444 + }, + { + "token": " Sole", + "logProbability": -3.8784428 + } + ] + }, + { + "candidates": [ + { + "token": " Splash", + "logProbability": -0.84925085 + }, + { + "token": " Pop", + "logProbability": -1.6359649 + }, + { + "token": " Riot", + "logProbability": -1.9875677 + }, + { + "token": " Burst", + "logProbability": -2.1552453 + }, + { + "token": "Pop", + "logProbability": -3.0864604 + } + ] + }, + { + "candidates": [ + { + "token": " Socks", + "logProbability": -0.072785005 + }, + { + "token": "\n\n", + "logProbability": -2.8555589 + }, + { + "token": "\n\n\n", + "logProbability": -4.3695216 + }, + { + "token": "\n", + "logProbability": -11.224125 + }, + { + "token": " Sox", + "logProbability": -13.152032 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n", + "logProbability": -0.13055436 + }, + { + "token": "\n\n\n", + "logProbability": -2.101185 + }, + { + "token": "\n", + "logProbability": -9.82724 + }, + { + "token": "\n\n\n\n", + "logProbability": -10.440939 + }, + { + "token": " ", + "logProbability": -13.150607 + } + ] + }, + { + "candidates": [ + { + "token": "**", + "logProbability": 0 + }, + { + "token": " **", + "logProbability": -19.073975 + }, + { + "token": "*", + "logProbability": -23.184353 + }, + { + "token": "**(", + "logProbability": -23.34279 + }, + { + "token": " ", + "logProbability": -23.729431 + } + ] + }, + { + "candidates": [ + { + "token": "Soph", + "logProbability": -0.0070743416 + }, + { + "token": "Trend", + "logProbability": -5.996703 + }, + { + "token": "Chic", + "logProbability": -6.0580153 + }, + { + "token": "Stylish", + "logProbability": -6.447573 + }, + { + "token": "Modern", + "logProbability": -7.6237144 + } + ] + }, + { + "candidates": [ + { + "token": "isticated", + "logProbability": -8.344534e-7 + }, + { + "token": "istic", + "logProbability": -13.967271 + }, + { + "token": "isti", + "logProbability": -24.602676 + }, + { + "token": "istica", + "logProbability": -25.15052 + }, + { + "token": "is", + "logProbability": -26.681797 + } + ] + }, + { + "candidates": [ + { + "token": " &", + "logProbability": 0 + }, + { + "token": "/", + "logProbability": -16.826643 + }, + { + "token": " ", + "logProbability": -19.001947 + }, + { + "token": " and", + "logProbability": -19.553572 + }, + { + "token": ":**", + "logProbability": -20.541435 + } + ] + }, + { + "candidates": [ + { + "token": " Chic", + "logProbability": -0.022171007 + }, + { + "token": " Stylish", + "logProbability": -4.006458 + }, + { + "token": " Trendy", + "logProbability": -5.7175756 + }, + { + "token": " Modern", + "logProbability": -8.264833 + }, + { + "token": " Elegant", + "logProbability": -8.627706 + } + ] + }, + { + "candidates": [ + { + "token": ":**", + "logProbability": -1.1922384e-7 + }, + { + "token": " (", + "logProbability": -16.143423 + }, + { + "token": "**", + "logProbability": -18.271965 + }, + { + "token": "**:", + "logProbability": -19.618092 + }, + { + "token": "/", + "logProbability": -20.301743 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n", + "logProbability": 0 + }, + { + "token": "\n\n\n", + "logProbability": -19.070024 + }, + { + "token": " ", + "logProbability": -21.749325 + }, + { + "token": " ", + "logProbability": -23.086685 + }, + { + "token": "\n", + "logProbability": -25.432482 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -28.950947 + }, + { + "token": " ", + "logProbability": -31.378754 + }, + { + "token": " *", + "logProbability": -31.88961 + }, + { + "token": " ", + "logProbability": -32.163452 + } + ] + }, + { + "candidates": [ + { + "token": " Hue", + "logProbability": -0.18508103 + }, + { + "token": " Atelier", + "logProbability": -2.4749122 + }, + { + "token": " Ch", + "logProbability": -2.981638 + }, + { + "token": " The", + "logProbability": -3.8034577 + }, + { + "token": " Hues", + "logProbability": -5.2300906 + } + ] + }, + { + "candidates": [ + { + "token": " des", + "logProbability": -0.5460347 + }, + { + "token": " de", + "logProbability": -1.358405 + }, + { + "token": " Sock", + "logProbability": -2.0885072 + }, + { + "token": " Socks", + "logProbability": -3.8421555 + }, + { + "token": " du", + "logProbability": -4.1556845 + } + ] + }, + { + "candidates": [ + { + "token": " Cha", + "logProbability": -0.008240157 + }, + { + "token": " Pied", + "logProbability": -5.261421 + }, + { + "token": " Cou", + "logProbability": -6.4205103 + }, + { + "token": " Bas", + "logProbability": -6.998013 + }, + { + "token": " Chau", + "logProbability": -8.399403 + } + ] + }, + { + "candidates": [ + { + "token": "us", + "logProbability": -1.7881898e-6 + }, + { + "token": "uss", + "logProbability": -13.26793 + }, + { + "token": "usses", + "logProbability": -17.146591 + }, + { + "token": "ux", + "logProbability": -18.11422 + }, + { + "token": "usse", + "logProbability": -18.932928 + } + ] + }, + { + "candidates": [ + { + "token": "settes", + "logProbability": -2.3844768e-7 + }, + { + "token": "sette", + "logProbability": -15.741461 + }, + { + "token": "set", + "logProbability": -16.20425 + }, + { + "token": "sets", + "logProbability": -16.586 + }, + { + "token": "sett", + "logProbability": -18.636847 + } + ] + }, + { + "candidates": [ + { + "token": " (", + "logProbability": -0.00072914065 + }, + { + "token": "\n", + "logProbability": -7.254617 + }, + { + "token": " ", + "logProbability": -10.73641 + }, + { + "token": " ", + "logProbability": -16.345737 + }, + { + "token": " (\"", + "logProbability": -16.82432 + } + ] + }, + { + "candidates": [ + { + "token": "French", + "logProbability": -0.0010093687 + }, + { + "token": "Atelier", + "logProbability": -6.912724 + }, + { + "token": "if", + "logProbability": -11.878886 + }, + { + "token": "atelier", + "logProbability": -12.970172 + }, + { + "token": "If", + "logProbability": -13.115428 + } + ] + }, + { + "candidates": [ + { + "token": " for", + "logProbability": -0.0021644344 + }, + { + "token": ",", + "logProbability": -6.173387 + }, + { + "token": " -", + "logProbability": -9.865514 + }, + { + "token": ":", + "logProbability": -10.643089 + }, + { + "token": " –", + "logProbability": -13.4982815 + } + ] + }, + { + "candidates": [ + { + "token": " \"", + "logProbability": -0.00025568233 + }, + { + "token": " Sock", + "logProbability": -8.609175 + }, + { + "token": " Atelier", + "logProbability": -9.854148 + }, + { + "token": " “", + "logProbability": -11.503381 + }, + { + "token": " Socks", + "logProbability": -12.284803 + } + ] + }, + { + "candidates": [ + { + "token": "Sock", + "logProbability": -0.13492844 + }, + { + "token": "Socks", + "logProbability": -2.117852 + }, + { + "token": "Atelier", + "logProbability": -5.3943176 + }, + { + "token": "The", + "logProbability": -6.909135 + }, + { + "token": "sock", + "logProbability": -8.129485 + } + ] + }, + { + "candidates": [ + { + "token": " Atelier", + "logProbability": -0.22585036 + }, + { + "token": " Workshop", + "logProbability": -1.6467097 + }, + { + "token": " Studio", + "logProbability": -4.6707387 + }, + { + "token": " workshop", + "logProbability": -9.192666 + }, + { + "token": " atelier", + "logProbability": -13.804781 + } + ] + }, + { + "candidates": [ + { + "token": "\")", + "logProbability": -4.3627377e-5 + }, + { + "token": ",\"", + "logProbability": -10.373741 + }, + { + "token": "\"", + "logProbability": -11.739271 + }, + { + "token": "\",", + "logProbability": -12.753274 + }, + { + "token": "”)", + "logProbability": -14.194769 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -2.1458147e-6 + }, + { + "token": " ", + "logProbability": -13.987359 + }, + { + "token": " -", + "logProbability": -14.006035 + }, + { + "token": " ", + "logProbability": -15.306158 + }, + { + "token": " –", + "logProbability": -15.358819 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -17.388842 + }, + { + "token": " ", + "logProbability": -27.884277 + }, + { + "token": " ", + "logProbability": -28.35511 + }, + { + "token": " *", + "logProbability": -29.194908 + } + ] + }, + { + "candidates": [ + { + "token": " The", + "logProbability": -0.4336172 + }, + { + "token": " Hue", + "logProbability": -1.1230074 + }, + { + "token": " Ch", + "logProbability": -3.9214158 + }, + { + "token": " Hues", + "logProbability": -5.999377 + }, + { + "token": " Sole", + "logProbability": -6.7031093 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.0006779188 + }, + { + "token": " Ho", + "logProbability": -7.719475 + }, + { + "token": " Colour", + "logProbability": -9.489144 + }, + { + "token": " Stripe", + "logProbability": -9.778251 + }, + { + "token": " Hue", + "logProbability": -11.263412 + } + ] + }, + { + "candidates": [ + { + "token": " Conno", + "logProbability": -1.0879806 + }, + { + "token": " Society", + "logProbability": -1.9071275 + }, + { + "token": " Studio", + "logProbability": -2.1193948 + }, + { + "token": " Gallery", + "logProbability": -2.1985059 + }, + { + "token": "ery", + "logProbability": -2.3618197 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -1.4304238e-6 + }, + { + "token": " ", + "logProbability": -14.212829 + }, + { + "token": " (", + "logProbability": -14.408662 + }, + { + "token": " ", + "logProbability": -15.5283985 + }, + { + "token": "/", + "logProbability": -18.736494 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -16.75806 + }, + { + "token": " ", + "logProbability": -22.470188 + }, + { + "token": " *", + "logProbability": -23.941341 + }, + { + "token": " ", + "logProbability": -24.452946 + } + ] + }, + { + "candidates": [ + { + "token": " Hue", + "logProbability": -0.0403958 + }, + { + "token": " Ch", + "logProbability": -3.6772184 + }, + { + "token": " Hues", + "logProbability": -5.083918 + }, + { + "token": " Colour", + "logProbability": -5.409491 + }, + { + "token": " Sole", + "logProbability": -7.082041 + } + ] + }, + { + "candidates": [ + { + "token": " &", + "logProbability": -0.00032251154 + }, + { + "token": " Society", + "logProbability": -8.267763 + }, + { + "token": " +", + "logProbability": -10.824852 + }, + { + "token": " Collective", + "logProbability": -11.003895 + }, + { + "token": "tiful", + "logProbability": -11.15172 + } + ] + }, + { + "candidates": [ + { + "token": " Cry", + "logProbability": -2.121776e-5 + }, + { + "token": " Kry", + "logProbability": -11.282984 + }, + { + "token": " Harmony", + "logProbability": -12.72592 + }, + { + "token": " Tone", + "logProbability": -12.823809 + }, + { + "token": " Crimson", + "logProbability": -14.557804 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.4465648 + }, + { + "token": " Socks", + "logProbability": -1.0231563 + }, + { + "token": " (", + "logProbability": -7.2214365 + }, + { + "token": " ", + "logProbability": -11.173811 + }, + { + "token": " Ho", + "logProbability": -12.612512 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -21.572386 + }, + { + "token": " ", + "logProbability": -29.579395 + }, + { + "token": " ", + "logProbability": -29.70463 + }, + { + "token": "(", + "logProbability": -30.033924 + } + ] + }, + { + "candidates": [ + { + "token": " Ch", + "logProbability": -0.22707948 + }, + { + "token": " Spectrum", + "logProbability": -2.1817608 + }, + { + "token": " Chrom", + "logProbability": -3.83007 + }, + { + "token": " Colour", + "logProbability": -3.9441772 + }, + { + "token": " Sock", + "logProbability": -4.295108 + } + ] + }, + { + "candidates": [ + { + "token": "roma", + "logProbability": 0 + }, + { + "token": "ro", + "logProbability": -19.957212 + }, + { + "token": "assé", + "logProbability": -20.54567 + }, + { + "token": "ROMA", + "logProbability": -22.021149 + }, + { + "token": "intz", + "logProbability": -22.071991 + } + ] + }, + { + "candidates": [ + { + "token": "Socks", + "logProbability": -0.88281155 + }, + { + "token": " Threads", + "logProbability": -1.061373 + }, + { + "token": "Threads", + "logProbability": -2.319378 + }, + { + "token": "Sole", + "logProbability": -2.5739677 + }, + { + "token": " Socks", + "logProbability": -3.2988436 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -4.1724998e-6 + }, + { + "token": " ", + "logProbability": -13.372194 + }, + { + "token": " ", + "logProbability": -13.711927 + }, + { + "token": " Socks", + "logProbability": -14.104038 + }, + { + "token": " (", + "logProbability": -14.576601 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -22.161816 + }, + { + "token": " ", + "logProbability": -26.146996 + }, + { + "token": " ", + "logProbability": -27.694077 + }, + { + "token": " *", + "logProbability": -28.271252 + } + ] + }, + { + "candidates": [ + { + "token": " Spectrum", + "logProbability": -0.2697204 + }, + { + "token": " Sock", + "logProbability": -2.4377744 + }, + { + "token": " Colour", + "logProbability": -2.8034108 + }, + { + "token": " The", + "logProbability": -3.448003 + }, + { + "token": " Sole", + "logProbability": -3.7338922 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.03975758 + }, + { + "token": " Colour", + "logProbability": -3.6663516 + }, + { + "token": " Knit", + "logProbability": -5.2005305 + }, + { + "token": " Ho", + "logProbability": -5.885814 + }, + { + "token": " Stripe", + "logProbability": -6.566864 + } + ] + }, + { + "candidates": [ + { + "token": " Gallery", + "logProbability": -0.86014694 + }, + { + "token": " Society", + "logProbability": -1.6984994 + }, + { + "token": " Alchemist", + "logProbability": -2.5521855 + }, + { + "token": " Collective", + "logProbability": -2.554714 + }, + { + "token": " Conno", + "logProbability": -2.8500156 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -1.9075815e-6 + }, + { + "token": " (", + "logProbability": -13.889581 + }, + { + "token": "\n\n\n", + "logProbability": -14.829371 + }, + { + "token": " ", + "logProbability": -15.16239 + }, + { + "token": " ", + "logProbability": -15.258266 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -22.313166 + }, + { + "token": " ", + "logProbability": -26.62952 + }, + { + "token": " ", + "logProbability": -27.421139 + }, + { + "token": " *", + "logProbability": -29.027884 + } + ] + }, + { + "candidates": [ + { + "token": " Spectrum", + "logProbability": -0.76918274 + }, + { + "token": " Colour", + "logProbability": -1.0446382 + }, + { + "token": " Sole", + "logProbability": -3.1063085 + }, + { + "token": " Leg", + "logProbability": -3.77421 + }, + { + "token": " ", + "logProbability": -4.150187 + } + ] + }, + { + "candidates": [ + { + "token": " Sole", + "logProbability": -0.60698473 + }, + { + "token": " Socks", + "logProbability": -0.86054623 + }, + { + "token": " Feet", + "logProbability": -3.8683538 + }, + { + "token": "Sole", + "logProbability": -5.055775 + }, + { + "token": " Sox", + "logProbability": -6.62616 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.0006556438 + }, + { + "token": "\n\n", + "logProbability": -8.037246 + }, + { + "token": "\n\n\n", + "logProbability": -8.158708 + }, + { + "token": " (", + "logProbability": -10.079251 + }, + { + "token": " ", + "logProbability": -13.186156 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -19.564072 + }, + { + "token": " ", + "logProbability": -25.717999 + }, + { + "token": " ", + "logProbability": -26.395712 + }, + { + "token": "**", + "logProbability": -27.13117 + } + ] + }, + { + "candidates": [ + { + "token": " Colour", + "logProbability": -1.2110671 + }, + { + "token": " Knit", + "logProbability": -2.5123887 + }, + { + "token": " Sock", + "logProbability": -2.5753646 + }, + { + "token": " Thread", + "logProbability": -2.7863264 + }, + { + "token": " E", + "logProbability": -2.8431592 + } + ] + }, + { + "candidates": [ + { + "token": " Collective", + "logProbability": -0.71306264 + }, + { + "token": " Story", + "logProbability": -1.3236057 + }, + { + "token": " Canvas", + "logProbability": -2.4055963 + }, + { + "token": "Story", + "logProbability": -2.9033594 + }, + { + "token": "Craft", + "logProbability": -3.560647 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.031042011 + }, + { + "token": "\n\n", + "logProbability": -3.7111359 + }, + { + "token": "\n\n\n", + "logProbability": -5.100775 + }, + { + "token": " Socks", + "logProbability": -11.372219 + }, + { + "token": " ", + "logProbability": -12.019875 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -23.564774 + }, + { + "token": "(", + "logProbability": -27.021004 + }, + { + "token": "**", + "logProbability": -27.05265 + }, + { + "token": " ", + "logProbability": -27.070122 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -1.1484648 + }, + { + "token": " Knit", + "logProbability": -1.9204394 + }, + { + "token": " Thread", + "logProbability": -2.0178218 + }, + { + "token": " E", + "logProbability": -2.9918423 + }, + { + "token": " Polished", + "logProbability": -2.993928 + } + ] + }, + { + "candidates": [ + { + "token": "bare", + "logProbability": -0.01844945 + }, + { + "token": " &", + "logProbability": -4.00528 + }, + { + "token": " Theory", + "logProbability": -10.88698 + }, + { + "token": "Bare", + "logProbability": -11.354895 + }, + { + "token": "ology", + "logProbability": -11.487275 + } + ] + }, + { + "candidates": [ + { + "token": " &", + "logProbability": -0.04435469 + }, + { + "token": " Chic", + "logProbability": -4.2123966 + }, + { + "token": " Elegance", + "logProbability": -4.3101964 + }, + { + "token": " Tales", + "logProbability": -4.860884 + }, + { + "token": " (", + "logProbability": -5.4993434 + } + ] + }, + { + "candidates": [ + { + "token": " Bold", + "logProbability": -0.0051981206 + }, + { + "token": " Chic", + "logProbability": -5.438663 + }, + { + "token": " Bright", + "logProbability": -7.482536 + }, + { + "token": " Co", + "logProbability": -9.445776 + }, + { + "token": " True", + "logProbability": -9.631507 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n", + "logProbability": -0.2817244 + }, + { + "token": "\n", + "logProbability": -2.1638198 + }, + { + "token": "\n\n\n", + "logProbability": -2.1921306 + }, + { + "token": " (", + "logProbability": -3.9735484 + }, + { + "token": " ", + "logProbability": -8.932349 + } + ] + }, + { + "candidates": [ + { + "token": "**", + "logProbability": -4.7689537e-7 + }, + { + "token": " **", + "logProbability": -14.554417 + }, + { + "token": " ", + "logProbability": -18.572453 + }, + { + "token": "**(", + "logProbability": -20.031082 + }, + { + "token": "*", + "logProbability": -20.040232 + } + ] + }, + { + "candidates": [ + { + "token": "Unique", + "logProbability": -0.3719452 + }, + { + "token": "Descriptive", + "logProbability": -1.2553852 + }, + { + "token": "Modern", + "logProbability": -4.148743 + }, + { + "token": "Creative", + "logProbability": -5.46636 + }, + { + "token": "Bold", + "logProbability": -5.7196927 + } + ] + }, + { + "candidates": [ + { + "token": " &", + "logProbability": 0 + }, + { + "token": " and", + "logProbability": -17.39827 + }, + { + "token": "/", + "logProbability": -18.870487 + }, + { + "token": " or", + "logProbability": -20.947422 + }, + { + "token": " ", + "logProbability": -21.304794 + } + ] + }, + { + "candidates": [ + { + "token": " Quir", + "logProbability": -0.43957087 + }, + { + "token": " Mem", + "logProbability": -1.1436048 + }, + { + "token": " Catch", + "logProbability": -3.4836898 + }, + { + "token": " Creative", + "logProbability": -5.7516336 + }, + { + "token": " Ev", + "logProbability": -5.8841457 + } + ] + }, + { + "candidates": [ + { + "token": "orable", + "logProbability": 0 + }, + { + "token": "oral", + "logProbability": -21.998163 + }, + { + "token": "ora", + "logProbability": -22.905865 + }, + { + "token": "mor", + "logProbability": -23.686138 + }, + { + "token": "rable", + "logProbability": -24.479437 + } + ] + }, + { + "candidates": [ + { + "token": ":**", + "logProbability": -3.2185512e-6 + }, + { + "token": " (", + "logProbability": -12.681903 + }, + { + "token": " Names", + "logProbability": -15.9296 + }, + { + "token": "**", + "logProbability": -17.38312 + }, + { + "token": "**:", + "logProbability": -18.497967 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n", + "logProbability": -1.1922384e-7 + }, + { + "token": "\n\n\n", + "logProbability": -15.656075 + }, + { + "token": " ", + "logProbability": -18.053047 + }, + { + "token": " ", + "logProbability": -21.412514 + }, + { + "token": " **", + "logProbability": -22.125584 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -30.81646 + }, + { + "token": " *", + "logProbability": -32.08621 + }, + { + "token": " ", + "logProbability": -33.35688 + }, + { + "token": " ", + "logProbability": -33.955956 + } + ] + }, + { + "candidates": [ + { + "token": " Sole", + "logProbability": -0.32002398 + }, + { + "token": " Foot", + "logProbability": -2.0226493 + }, + { + "token": " Sock", + "logProbability": -2.0358987 + }, + { + "token": " Sol", + "logProbability": -5.3784313 + }, + { + "token": " Odd", + "logProbability": -6.220826 + } + ] + }, + { + "candidates": [ + { + "token": "M", + "logProbability": -0.26338503 + }, + { + "token": " M", + "logProbability": -1.6433303 + }, + { + "token": "mates", + "logProbability": -3.875701 + }, + { + "token": " Mate", + "logProbability": -4.7185893 + }, + { + "token": "Mate", + "logProbability": -4.8438826 + } + ] + }, + { + "candidates": [ + { + "token": "ates", + "logProbability": 0 + }, + { + "token": "ated", + "logProbability": -19.004541 + }, + { + "token": "8", + "logProbability": -19.236742 + }, + { + "token": "atiz", + "logProbability": -23.513582 + }, + { + "token": "akers", + "logProbability": -23.688063 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.00020714411 + }, + { + "token": " (", + "logProbability": -8.861996 + }, + { + "token": " Socks", + "logProbability": -9.725747 + }, + { + "token": " ", + "logProbability": -12.8248415 + }, + { + "token": " ", + "logProbability": -13.058762 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -25.238182 + }, + { + "token": " *", + "logProbability": -29.95517 + }, + { + "token": " ", + "logProbability": -30.816076 + }, + { + "token": " ", + "logProbability": -31.554377 + } + ] + }, + { + "candidates": [ + { + "token": " Foot", + "logProbability": -0.03555266 + }, + { + "token": " Sock", + "logProbability": -3.3977745 + }, + { + "token": " Knit", + "logProbability": -7.349258 + }, + { + "token": " Step", + "logProbability": -7.9976935 + }, + { + "token": " Thread", + "logProbability": -8.434785 + } + ] + }, + { + "candidates": [ + { + "token": "prints", + "logProbability": -0.38319305 + }, + { + "token": "Prints", + "logProbability": -1.1619806 + }, + { + "token": "notes", + "logProbability": -5.6306567 + }, + { + "token": "lights", + "logProbability": -6.6503987 + }, + { + "token": " Prints", + "logProbability": -8.148404 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.00018187401 + }, + { + "token": " of", + "logProbability": -9.076464 + }, + { + "token": " (", + "logProbability": -9.9143505 + }, + { + "token": " &", + "logProbability": -11.86058 + }, + { + "token": " ", + "logProbability": -13.1041765 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -22.277386 + }, + { + "token": "**", + "logProbability": -28.446087 + }, + { + "token": " *", + "logProbability": -28.581348 + }, + { + "token": " ", + "logProbability": -28.715809 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.05234257 + }, + { + "token": " Thread", + "logProbability": -3.7410243 + }, + { + "token": " Knit", + "logProbability": -4.0962524 + }, + { + "token": " Step", + "logProbability": -5.8673396 + }, + { + "token": " Stepping", + "logProbability": -6.2153974 + } + ] + }, + { + "candidates": [ + { + "token": "ology", + "logProbability": -1.3356875 + }, + { + "token": "fluence", + "logProbability": -1.6918598 + }, + { + "token": " It", + "logProbability": -2.2164712 + }, + { + "token": " Monkey", + "logProbability": -2.9945955 + }, + { + "token": "It", + "logProbability": -3.2632651 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -4.6607358e-5 + }, + { + "token": " (", + "logProbability": -10.069546 + }, + { + "token": " ", + "logProbability": -12.714156 + }, + { + "token": " ", + "logProbability": -13.958015 + }, + { + "token": "\n\n\n", + "logProbability": -16.491392 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -25.680817 + }, + { + "token": " ", + "logProbability": -31.70393 + }, + { + "token": " ", + "logProbability": -32.220592 + }, + { + "token": "(", + "logProbability": -32.246452 + } + ] + }, + { + "candidates": [ + { + "token": " Knit", + "logProbability": -0.74905014 + }, + { + "token": " Thread", + "logProbability": -1.0182276 + }, + { + "token": " The", + "logProbability": -2.6706038 + }, + { + "token": " Leg", + "logProbability": -3.2716398 + }, + { + "token": " Yarn", + "logProbability": -4.100731 + } + ] + }, + { + "candidates": [ + { + "token": "bare", + "logProbability": -0.22781493 + }, + { + "token": " &", + "logProbability": -2.7221773 + }, + { + "token": " Tales", + "logProbability": -3.5019326 + }, + { + "token": " Theory", + "logProbability": -3.7482207 + }, + { + "token": "ology", + "logProbability": -3.9954522 + } + ] + }, + { + "candidates": [ + { + "token": " Tales", + "logProbability": -0.0003030922 + }, + { + "token": " Stories", + "logProbability": -8.529766 + }, + { + "token": " Treasures", + "logProbability": -10.473243 + }, + { + "token": " Legends", + "logProbability": -10.873333 + }, + { + "token": " &", + "logProbability": -11.196561 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.002686422 + }, + { + "token": " (", + "logProbability": -5.98248 + }, + { + "token": "\n\n\n", + "logProbability": -9.4983635 + }, + { + "token": " ", + "logProbability": -10.0096855 + }, + { + "token": "\n\n", + "logProbability": -10.374742 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -16.753197 + }, + { + "token": " ", + "logProbability": -20.581684 + }, + { + "token": "(", + "logProbability": -22.021753 + }, + { + "token": " *", + "logProbability": -22.103308 + } + ] + }, + { + "candidates": [ + { + "token": " Knit", + "logProbability": -0.8322125 + }, + { + "token": " The", + "logProbability": -0.8507939 + }, + { + "token": " Kale", + "logProbability": -2.7086916 + }, + { + "token": " Walking", + "logProbability": -4.523139 + }, + { + "token": " Leg", + "logProbability": -4.5286636 + } + ] + }, + { + "candidates": [ + { + "token": "Wit", + "logProbability": -1.119102 + }, + { + "token": " Knot", + "logProbability": -1.3013508 + }, + { + "token": "Knot", + "logProbability": -1.575696 + }, + { + "token": " Wit", + "logProbability": -1.7551354 + }, + { + "token": "wit", + "logProbability": -4.8439794 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.00013981262 + }, + { + "token": "\n\n", + "logProbability": -9.557038 + }, + { + "token": "\n\n\n", + "logProbability": -9.726325 + }, + { + "token": " Socks", + "logProbability": -12.042843 + }, + { + "token": " (", + "logProbability": -13.105741 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -18.053675 + }, + { + "token": " ", + "logProbability": -23.017117 + }, + { + "token": " ", + "logProbability": -24.777744 + }, + { + "token": " *", + "logProbability": -25.322525 + } + ] + }, + { + "candidates": [ + { + "token": " The", + "logProbability": -0.13912207 + }, + { + "token": " Yarn", + "logProbability": -3.9950943 + }, + { + "token": " Leg", + "logProbability": -4.018093 + }, + { + "token": " Foot", + "logProbability": -4.212929 + }, + { + "token": " Sock", + "logProbability": -4.2382765 + } + ] + }, + { + "candidates": [ + { + "token": "acies", + "logProbability": -0.2952639 + }, + { + "token": "-", + "logProbability": -2.3648338 + }, + { + "token": "alese", + "logProbability": -2.6893601 + }, + { + "token": "ac", + "logProbability": -3.8373237 + }, + { + "token": "ili", + "logProbability": -4.3632526 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.7574003 + }, + { + "token": " of", + "logProbability": -1.0481098 + }, + { + "token": " (", + "logProbability": -2.6493351 + }, + { + "token": "\n\n", + "logProbability": -3.1815221 + }, + { + "token": " in", + "logProbability": -3.3629572 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -19.253796 + }, + { + "token": " ", + "logProbability": -24.169157 + }, + { + "token": " ", + "logProbability": -24.500504 + }, + { + "token": "(", + "logProbability": -24.690495 + } + ] + }, + { + "candidates": [ + { + "token": " The", + "logProbability": -0.16780898 + }, + { + "token": " Stepping", + "logProbability": -3.43112 + }, + { + "token": " Step", + "logProbability": -3.7869444 + }, + { + "token": " Sock", + "logProbability": -3.8763394 + }, + { + "token": " Foot", + "logProbability": -4.633666 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.2953931 + }, + { + "token": " Ho", + "logProbability": -2.0705957 + }, + { + "token": " Daily", + "logProbability": -3.0579596 + }, + { + "token": " Stripe", + "logProbability": -4.090448 + }, + { + "token": " Yarn", + "logProbability": -4.2937775 + } + ] + }, + { + "candidates": [ + { + "token": "siery", + "logProbability": -0.00021405888 + }, + { + "token": "sier", + "logProbability": -8.698625 + }, + { + "token": "ppin", + "logProbability": -10.647244 + }, + { + "token": "pping", + "logProbability": -10.960693 + }, + { + "token": "si", + "logProbability": -13.338115 + } + ] + }, + { + "candidates": [ + { + "token": " House", + "logProbability": -0.107407786 + }, + { + "token": " Alchemist", + "logProbability": -3.0680592 + }, + { + "token": " Hub", + "logProbability": -3.9183762 + }, + { + "token": " Hound", + "logProbability": -4.261615 + }, + { + "token": " Haus", + "logProbability": -4.7971053 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n\n", + "logProbability": -0.59764373 + }, + { + "token": "\n\n", + "logProbability": -0.9995049 + }, + { + "token": "\n", + "logProbability": -2.5566053 + }, + { + "token": " (", + "logProbability": -5.5364447 + }, + { + "token": "\n\n\n\n", + "logProbability": -8.283385 + } + ] + }, + { + "candidates": [ + { + "token": "**", + "logProbability": -2.3844768e-7 + }, + { + "token": " **", + "logProbability": -15.342089 + }, + { + "token": "When", + "logProbability": -18.708923 + }, + { + "token": "**(", + "logProbability": -18.80758 + }, + { + "token": " ", + "logProbability": -19.307182 + } + ] + }, + { + "candidates": [ + { + "token": "Location", + "logProbability": -0.0125602735 + }, + { + "token": "Names", + "logProbability": -4.994824 + }, + { + "token": "Descriptive", + "logProbability": -5.9875226 + }, + { + "token": "Emp", + "logProbability": -6.417997 + }, + { + "token": "Focusing", + "logProbability": -7.647607 + } + ] + }, + { + "candidates": [ + { + "token": " Specific", + "logProbability": -0.01011511 + }, + { + "token": "-", + "logProbability": -4.7674346 + }, + { + "token": " Based", + "logProbability": -6.9162793 + }, + { + "token": " specific", + "logProbability": -7.5277867 + }, + { + "token": " based", + "logProbability": -10.437627 + } + ] + }, + { + "candidates": [ + { + "token": " (", + "logProbability": -3.4570896e-6 + }, + { + "token": ":**", + "logProbability": -13.623717 + }, + { + "token": " ", + "logProbability": -14.073292 + }, + { + "token": " *(", + "logProbability": -14.62182 + }, + { + "token": "**", + "logProbability": -15.176929 + } + ] + }, + { + "candidates": [ + { + "token": "if", + "logProbability": -0.2524224 + }, + { + "token": "If", + "logProbability": -2.00426 + }, + { + "token": "replace", + "logProbability": -2.4532032 + }, + { + "token": "Replace", + "logProbability": -6.382903 + }, + { + "token": "adapt", + "logProbability": -7.3914986 + } + ] + }, + { + "candidates": [ + { + "token": " applicable", + "logProbability": -0.0002407691 + }, + { + "token": " relevant", + "logProbability": -8.397732 + }, + { + "token": " Applicable", + "logProbability": -11.751858 + }, + { + "token": " appropriate", + "logProbability": -12.406185 + }, + { + "token": " you", + "logProbability": -12.739385 + } + ] + }, + { + "candidates": [ + { + "token": "):", + "logProbability": -0.00011717935 + }, + { + "token": ",", + "logProbability": -9.641147 + }, + { + "token": " -", + "logProbability": -10.187923 + }, + { + "token": ")", + "logProbability": -11.608294 + }, + { + "token": ";", + "logProbability": -13.064154 + } + ] + }, + { + "candidates": [ + { + "token": "**", + "logProbability": -0.0001095468 + }, + { + "token": " [", + "logProbability": -9.351396 + }, + { + "token": " ", + "logProbability": -10.855468 + }, + { + "token": " (", + "logProbability": -14.39501 + }, + { + "token": "[", + "logProbability": -14.467649 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n", + "logProbability": -0.0018100317 + }, + { + "token": " ", + "logProbability": -6.35406 + }, + { + "token": " [", + "logProbability": -10.246637 + }, + { + "token": "\n\n\n", + "logProbability": -10.5872965 + }, + { + "token": " ", + "logProbability": -13.198058 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": -4.5415305e-5 + }, + { + "token": "*[", + "logProbability": -10.431948 + }, + { + "token": "*(", + "logProbability": -11.626853 + }, + { + "token": " ", + "logProbability": -12.244446 + }, + { + "token": "[", + "logProbability": -13.609145 + } + ] + }, + { + "candidates": [ + { + "token": " [", + "logProbability": -0.00010716193 + }, + { + "token": " (", + "logProbability": -9.808499 + }, + { + "token": " ", + "logProbability": -9.917678 + }, + { + "token": " *", + "logProbability": -14.197388 + }, + { + "token": " _(", + "logProbability": -14.438379 + } + ] + }, + { + "candidates": [ + { + "token": "Your", + "logProbability": -0.6833985 + }, + { + "token": "City", + "logProbability": -0.7048428 + }, + { + "token": "Town", + "logProbability": -7.1533184 + }, + { + "token": "Location", + "logProbability": -9.399476 + }, + { + "token": "your", + "logProbability": -10.566728 + } + ] + }, + { + "candidates": [ + { + "token": "/", + "logProbability": -0.22593477 + }, + { + "token": " Name", + "logProbability": -1.5986135 + }, + { + "token": " name", + "logProbability": -10.068577 + }, + { + "token": "]", + "logProbability": -13.767429 + }, + { + "token": "Name", + "logProbability": -14.56571 + } + ] + }, + { + "candidates": [ + { + "token": "Region", + "logProbability": -0.03399348 + }, + { + "token": "Town", + "logProbability": -3.423845 + }, + { + "token": "region", + "logProbability": -7.7174296 + }, + { + "token": "State", + "logProbability": -8.428002 + }, + { + "token": "town", + "logProbability": -9.117612 + } + ] + }, + { + "candidates": [ + { + "token": "]", + "logProbability": -0.0011304824 + }, + { + "token": " Name", + "logProbability": -6.830021 + }, + { + "token": "]'", + "logProbability": -10.1377535 + }, + { + "token": "]-", + "logProbability": -11.926504 + }, + { + "token": " name", + "logProbability": -13.342395 + } + ] + }, + { + "candidates": [ + { + "token": " Sock", + "logProbability": -0.006740053 + }, + { + "token": " Socks", + "logProbability": -5.037519 + }, + { + "token": " Colour", + "logProbability": -9.304969 + }, + { + "token": " Stock", + "logProbability": -10.140259 + }, + { + "token": " Hues", + "logProbability": -10.462252 + } + ] + }, + { + "candidates": [ + { + "token": " Co", + "logProbability": -0.0152717335 + }, + { + "token": " Company", + "logProbability": -4.703984 + }, + { + "token": "works", + "logProbability": -5.182561 + }, + { + "token": "ery", + "logProbability": -8.332621 + }, + { + "token": " Works", + "logProbability": -8.473015 + } + ] + }, + { + "candidates": [ + { + "token": ".", + "logProbability": -1.4424305e-5 + }, + { + "token": "\n", + "logProbability": -11.315609 + }, + { + "token": "\n\n\n", + "logProbability": -13.418517 + }, + { + "token": "\n\n", + "logProbability": -14.327352 + }, + { + "token": ".,", + "logProbability": -16.409313 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.0040531945 + }, + { + "token": "\n\n\n", + "logProbability": -6.126358 + }, + { + "token": " ", + "logProbability": -6.427843 + }, + { + "token": "\n\n", + "logProbability": -8.973826 + }, + { + "token": " (", + "logProbability": -9.114639 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": -7.152119e-7 + }, + { + "token": " ", + "logProbability": -14.210004 + }, + { + "token": " ", + "logProbability": -17.855415 + }, + { + "token": " ", + "logProbability": -18.093838 + }, + { + "token": "(", + "logProbability": -18.48766 + } + ] + }, + { + "candidates": [ + { + "token": " [", + "logProbability": -0.0024865945 + }, + { + "token": " The", + "logProbability": -6.096851 + }, + { + "token": " Coastal", + "logProbability": -8.648011 + }, + { + "token": " ", + "logProbability": -10.487071 + }, + { + "token": " Coast", + "logProbability": -11.084495 + } + ] + }, + { + "candidates": [ + { + "token": "Landmark", + "logProbability": -0.047960762 + }, + { + "token": "Local", + "logProbability": -3.106893 + }, + { + "token": "Mountain", + "logProbability": -6.909003 + }, + { + "token": "Land", + "logProbability": -7.297751 + }, + { + "token": "Neighborhood", + "logProbability": -8.383187 + } + ] + }, + { + "candidates": [ + { + "token": "]", + "logProbability": -0.00017710685 + }, + { + "token": "]-", + "logProbability": -9.123598 + }, + { + "token": "/", + "logProbability": -9.920908 + }, + { + "token": " Name", + "logProbability": -11.467941 + }, + { + "token": "]'", + "logProbability": -12.839821 + } + ] + }, + { + "candidates": [ + { + "token": " Socks", + "logProbability": -0.092020914 + }, + { + "token": " Ho", + "logProbability": -3.186329 + }, + { + "token": " Threads", + "logProbability": -3.231619 + }, + { + "token": " Leg", + "logProbability": -5.862904 + }, + { + "token": " Sock", + "logProbability": -5.916276 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n\n", + "logProbability": -0.23384827 + }, + { + "token": "\n\n", + "logProbability": -1.5681398 + }, + { + "token": "\n\n\n\n", + "logProbability": -9.583561 + }, + { + "token": "\n", + "logProbability": -10.244542 + }, + { + "token": " ", + "logProbability": -13.52511 + } + ] + }, + { + "candidates": [ + { + "token": "**", + "logProbability": -9.202131e-5 + }, + { + "token": "When", + "logProbability": -9.35206 + }, + { + "token": "Remember", + "logProbability": -12.37234 + }, + { + "token": "Before", + "logProbability": -14.812255 + }, + { + "token": "Consider", + "logProbability": -15.196058 + } + ] + }, + { + "candidates": [ + { + "token": "Tips", + "logProbability": -0.0032254215 + }, + { + "token": "Things", + "logProbability": -5.89133 + }, + { + "token": "Before", + "logProbability": -8.171983 + }, + { + "token": "Consider", + "logProbability": -9.395593 + }, + { + "token": "Considerations", + "logProbability": -9.594294 + } + ] + }, + { + "candidates": [ + { + "token": " for", + "logProbability": -1.7523887e-5 + }, + { + "token": " when", + "logProbability": -11.265533 + }, + { + "token": " For", + "logProbability": -12.98726 + }, + { + "token": " on", + "logProbability": -13.631147 + }, + { + "token": " to", + "logProbability": -14.059435 + } + ] + }, + { + "candidates": [ + { + "token": " Choosing", + "logProbability": -0.43066922 + }, + { + "token": " choosing", + "logProbability": -1.0499891 + }, + { + "token": " picking", + "logProbability": -12.733246 + }, + { + "token": " Picking", + "logProbability": -13.76381 + }, + { + "token": " selecting", + "logProbability": -15.341447 + } + ] + }, + { + "candidates": [ + { + "token": " a", + "logProbability": -0.40812367 + }, + { + "token": " the", + "logProbability": -1.575053 + }, + { + "token": ":**", + "logProbability": -2.0553348 + }, + { + "token": " your", + "logProbability": -12.077208 + }, + { + "token": "**:", + "logProbability": -13.627996 + } + ] + }, + { + "candidates": [ + { + "token": " name", + "logProbability": -0.00013695363 + }, + { + "token": " good", + "logProbability": -9.126887 + }, + { + "token": " Name", + "logProbability": -10.669062 + }, + { + "token": " final", + "logProbability": -13.12908 + }, + { + "token": " great", + "logProbability": -13.139804 + } + ] + }, + { + "candidates": [ + { + "token": ":**", + "logProbability": 0 + }, + { + "token": "**:", + "logProbability": -17.379961 + }, + { + "token": " beyond", + "logProbability": -19.450964 + }, + { + "token": ":*", + "logProbability": -20.949842 + }, + { + "token": " consider", + "logProbability": -21.192934 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n", + "logProbability": -2.3844768e-7 + }, + { + "token": "\n\n\n", + "logProbability": -15.087653 + }, + { + "token": " ", + "logProbability": -18.74584 + }, + { + "token": "\n", + "logProbability": -21.035065 + }, + { + "token": " ", + "logProbability": -21.29893 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": "Consider", + "logProbability": -21.87358 + }, + { + "token": "1", + "logProbability": -23.99545 + }, + { + "token": " ", + "logProbability": -24.126543 + }, + { + "token": "-", + "logProbability": -24.422108 + } + ] + }, + { + "candidates": [ + { + "token": " **", + "logProbability": 0 + }, + { + "token": " Check", + "logProbability": -17.321415 + }, + { + "token": " ", + "logProbability": -17.889145 + }, + { + "token": " Keep", + "logProbability": -18.022614 + }, + { + "token": " Make", + "logProbability": -19.524502 + } + ] + }, + { + "candidates": [ + { + "token": "Check", + "logProbability": -0.032968074 + }, + { + "token": "Keep", + "logProbability": -3.4445214 + }, + { + "token": "Availability", + "logProbability": -7.616365 + }, + { + "token": "Target", + "logProbability": -11.718522 + }, + { + "token": "Consider", + "logProbability": -12.070712 + } + ] + }, + { + "candidates": [ + { + "token": " for", + "logProbability": -8.2248516e-5 + }, + { + "token": " availability", + "logProbability": -9.438935 + }, + { + "token": " Availability", + "logProbability": -13.055138 + }, + { + "token": " domain", + "logProbability": -14.629294 + }, + { + "token": " Trademark", + "logProbability": -16.811152 + } + ] + }, + { + "candidates": [ + { + "token": " availability", + "logProbability": -0.03969529 + }, + { + "token": " trademark", + "logProbability": -3.4611754 + }, + { + "token": " Trademark", + "logProbability": -4.9872804 + }, + { + "token": " Availability", + "logProbability": -7.5530543 + }, + { + "token": " domain", + "logProbability": -8.822123 + } + ] + }, + { + "candidates": [ + { + "token": ":**", + "logProbability": 0 + }, + { + "token": "**:", + "logProbability": -18.204645 + }, + { + "token": ".**", + "logProbability": -19.701946 + }, + { + "token": " of", + "logProbability": -21.757675 + }, + { + "token": " (", + "logProbability": -21.872736 + } + ] + }, + { + "candidates": [ + { + "token": " Make", + "logProbability": -0.050556663 + }, + { + "token": " ", + "logProbability": -3.0166583 + }, + { + "token": " Before", + "logProbability": -8.396169 + }, + { + "token": " Ensure", + "logProbability": -9.194931 + }, + { + "token": " See", + "logProbability": -11.740526 + } + ] + }, + { + "candidates": [ + { + "token": " sure", + "logProbability": 0 + }, + { + "token": " certain", + "logProbability": -19.742668 + }, + { + "token": " absolutely", + "logProbability": -20.50027 + }, + { + "token": " ", + "logProbability": -21.230976 + }, + { + "token": " a", + "logProbability": -22.114021 + } + ] + }, + { + "candidates": [ + { + "token": " the", + "logProbability": -5.9600343e-6 + }, + { + "token": " your", + "logProbability": -12.192578 + }, + { + "token": " that", + "logProbability": -15.235574 + }, + { + "token": " no", + "logProbability": -15.32501 + }, + { + "token": " there", + "logProbability": -16.066107 + } + ] + }, + { + "candidates": [ + { + "token": " name", + "logProbability": -1.2277732e-5 + }, + { + "token": " domain", + "logProbability": -11.338766 + }, + { + "token": " website", + "logProbability": -15.407257 + }, + { + "token": " company", + "logProbability": -15.989598 + }, + { + "token": " business", + "logProbability": -17.345444 + } + ] + }, + { + "candidates": [ + { + "token": " isn", + "logProbability": -0.00961137 + }, + { + "token": " is", + "logProbability": -4.968263 + }, + { + "token": " and", + "logProbability": -5.9490094 + }, + { + "token": " (", + "logProbability": -13.172875 + }, + { + "token": ",", + "logProbability": -14.24288 + } + ] + }, + { + "candidates": [ + { + "token": "'", + "logProbability": -3.2185512e-6 + }, + { + "token": "’", + "logProbability": -12.632797 + }, + { + "token": "´", + "logProbability": -21.24039 + }, + { + "token": "`", + "logProbability": -24.54179 + }, + { + "token": " ", + "logProbability": -26.307964 + } + ] + }, + { + "candidates": [ + { + "token": "t", + "logProbability": -9.537907e-7 + }, + { + "token": "s", + "logProbability": -15.260585 + }, + { + "token": "ts", + "logProbability": -15.488982 + }, + { + "token": " t", + "logProbability": -16.231005 + }, + { + "token": "tt", + "logProbability": -16.975851 + } + ] + }, + { + "candidates": [ + { + "token": " already", + "logProbability": -1.6689067e-6 + }, + { + "token": " taken", + "logProbability": -13.37627 + }, + { + "token": " trade", + "logProbability": -15.990261 + }, + { + "token": " in", + "logProbability": -19.208584 + }, + { + "token": " being", + "logProbability": -22.86012 + } + ] + }, + { + "candidates": [ + { + "token": " taken", + "logProbability": -0.4037476 + }, + { + "token": " in", + "logProbability": -1.104073 + }, + { + "token": " trade", + "logProbability": -7.1834106 + }, + { + "token": " being", + "logProbability": -13.089279 + }, + { + "token": " used", + "logProbability": -13.500933 + } + ] + }, + { + "candidates": [ + { + "token": " use", + "logProbability": 0 + }, + { + "token": " used", + "logProbability": -19.72862 + }, + { + "token": "-", + "logProbability": -20.875303 + }, + { + "token": " ", + "logProbability": -22.076096 + }, + { + "token": " the", + "logProbability": -23.04501 + } + ] + }, + { + "candidates": [ + { + "token": " (", + "logProbability": -0.5516647 + }, + { + "token": " and", + "logProbability": -0.88276136 + }, + { + "token": ",", + "logProbability": -4.596046 + }, + { + "token": " by", + "logProbability": -8.974329 + }, + { + "token": " as", + "logProbability": -9.0876 + } + ] + }, + { + "candidates": [ + { + "token": "website", + "logProbability": -0.03536837 + }, + { + "token": "domain", + "logProbability": -3.439405 + }, + { + "token": "especially", + "logProbability": -6.3984127 + }, + { + "token": "check", + "logProbability": -7.271854 + }, + { + "token": "trade", + "logProbability": -8.278599 + } + ] + }, + { + "candidates": [ + { + "token": " domain", + "logProbability": -7.140589e-5 + }, + { + "token": " domains", + "logProbability": -9.5483465 + }, + { + "token": ",", + "logProbability": -16.486391 + }, + { + "token": " address", + "logProbability": -17.564074 + }, + { + "token": " URL", + "logProbability": -17.832184 + } + ] + }, + { + "candidates": [ + { + "token": ",", + "logProbability": -4.7680274e-5 + }, + { + "token": " and", + "logProbability": -10.274318 + }, + { + "token": " name", + "logProbability": -11.3488655 + }, + { + "token": " &", + "logProbability": -13.659832 + }, + { + "token": " names", + "logProbability": -15.669761 + } + ] + }, + { + "candidates": [ + { + "token": " trademark", + "logProbability": -0.345583 + }, + { + "token": " trademarks", + "logProbability": -1.2400084 + }, + { + "token": " social", + "logProbability": -5.8948855 + }, + { + "token": " trade", + "logProbability": -15.458683 + }, + { + "token": " Trademark", + "logProbability": -15.661454 + } + ] + }, + { + "candidates": [ + { + "token": ").", + "logProbability": -0.016963713 + }, + { + "token": ",", + "logProbability": -4.0971503 + }, + { + "token": " etc", + "logProbability": -8.60422 + }, + { + "token": ")", + "logProbability": -10.950926 + }, + { + "token": "),", + "logProbability": -17.006065 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -4.7689537e-7 + }, + { + "token": " ", + "logProbability": -14.672548 + }, + { + "token": "\n\n", + "logProbability": -17.749062 + }, + { + "token": " Use", + "logProbability": -18.207859 + }, + { + "token": " ", + "logProbability": -19.174932 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -23.25437 + }, + { + "token": " ", + "logProbability": -25.546465 + }, + { + "token": " ", + "logProbability": -25.729185 + }, + { + "token": " *", + "logProbability": -27.688852 + } + ] + }, + { + "candidates": [ + { + "token": " **", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -19.669802 + }, + { + "token": "**", + "logProbability": -20.44493 + }, + { + "token": " ", + "logProbability": -23.737879 + }, + { + "token": " Keep", + "logProbability": -23.845089 + } + ] + }, + { + "candidates": [ + { + "token": "Keep", + "logProbability": -0.0002531811 + }, + { + "token": "Consider", + "logProbability": -8.34956 + }, + { + "token": "Target", + "logProbability": -11.034764 + }, + { + "token": "Easy", + "logProbability": -14.737743 + }, + { + "token": "Say", + "logProbability": -16.92406 + } + ] + }, + { + "candidates": [ + { + "token": " it", + "logProbability": 0 + }, + { + "token": " in", + "logProbability": -19.249023 + }, + { + "token": " It", + "logProbability": -19.738518 + }, + { + "token": " is", + "logProbability": -20.508121 + }, + { + "token": " the", + "logProbability": -21.031273 + } + ] + }, + { + "candidates": [ + { + "token": " short", + "logProbability": -0.011662084 + }, + { + "token": " concise", + "logProbability": -4.458677 + }, + { + "token": " simple", + "logProbability": -10.992084 + }, + { + "token": " brief", + "logProbability": -14.338952 + }, + { + "token": " memorable", + "logProbability": -14.411281 + } + ] + }, + { + "candidates": [ + { + "token": " and", + "logProbability": -0.0001768685 + }, + { + "token": " &", + "logProbability": -8.640805 + }, + { + "token": ",", + "logProbability": -16.443502 + }, + { + "token": ":**", + "logProbability": -17.629215 + }, + { + "token": " ", + "logProbability": -22.11592 + } + ] + }, + { + "candidates": [ + { + "token": " memorable", + "logProbability": -1.8834444e-5 + }, + { + "token": " catchy", + "logProbability": -11.073781 + }, + { + "token": " easy", + "logProbability": -12.620126 + }, + { + "token": " memor", + "logProbability": -17.717049 + }, + { + "token": " sweet", + "logProbability": -18.367167 + } + ] + }, + { + "candidates": [ + { + "token": ":**", + "logProbability": -1.6689067e-6 + }, + { + "token": ".**", + "logProbability": -13.286257 + }, + { + "token": "**:", + "logProbability": -18.000015 + }, + { + "token": ".:", + "logProbability": -19.122313 + }, + { + "token": " (", + "logProbability": -19.48232 + } + ] + }, + { + "candidates": [ + { + "token": " Easy", + "logProbability": -0.6181912 + }, + { + "token": " ", + "logProbability": -0.8364815 + }, + { + "token": " Easier", + "logProbability": -3.5819259 + }, + { + "token": " Aim", + "logProbability": -11.596145 + }, + { + "token": " Easily", + "logProbability": -11.6554575 + } + ] + }, + { + "candidates": [ + { + "token": " to", + "logProbability": -4.8873435e-6 + }, + { + "token": " for", + "logProbability": -12.361993 + }, + { + "token": " recall", + "logProbability": -14.9288645 + }, + { + "token": "-", + "logProbability": -15.139157 + }, + { + "token": " names", + "logProbability": -16.782171 + } + ] + }, + { + "candidates": [ + { + "token": " recall", + "logProbability": -0.046240393 + }, + { + "token": " say", + "logProbability": -3.122583 + }, + { + "token": " remember", + "logProbability": -6.998323 + }, + { + "token": " pronounce", + "logProbability": -8.38622 + }, + { + "token": " spell", + "logProbability": -12.442145 + } + ] + }, + { + "candidates": [ + { + "token": " and", + "logProbability": -1.02513495e-5 + }, + { + "token": ",", + "logProbability": -12.126953 + }, + { + "token": " &", + "logProbability": -12.724938 + }, + { + "token": " is", + "logProbability": -13.540508 + }, + { + "token": " for", + "logProbability": -15.356405 + } + ] + }, + { + "candidates": [ + { + "token": " share", + "logProbability": -0.06211961 + }, + { + "token": " pronounce", + "logProbability": -2.9159062 + }, + { + "token": " recommend", + "logProbability": -5.64827 + }, + { + "token": " say", + "logProbability": -6.425309 + }, + { + "token": " spell", + "logProbability": -7.3509107 + } + ] + }, + { + "candidates": [ + { + "token": ".", + "logProbability": -2.861005e-5 + }, + { + "token": " with", + "logProbability": -11.2972355 + }, + { + "token": " verbally", + "logProbability": -11.317955 + }, + { + "token": " is", + "logProbability": -13.279898 + }, + { + "token": "\n", + "logProbability": -14.447924 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -16.987432 + }, + { + "token": " ", + "logProbability": -21.468847 + }, + { + "token": "\n\n\n", + "logProbability": -21.845173 + }, + { + "token": "\n\n", + "logProbability": -21.905588 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -19.430336 + }, + { + "token": " ", + "logProbability": -22.358711 + }, + { + "token": " ", + "logProbability": -23.701683 + }, + { + "token": " *", + "logProbability": -25.12267 + } + ] + }, + { + "candidates": [ + { + "token": " **", + "logProbability": -3.5760596e-7 + }, + { + "token": " ", + "logProbability": -15.493866 + }, + { + "token": "**", + "logProbability": -16.143871 + }, + { + "token": " Reflect", + "logProbability": -20.527035 + }, + { + "token": " ", + "logProbability": -20.84292 + } + ] + }, + { + "candidates": [ + { + "token": "Reflect", + "logProbability": -0.0026395652 + }, + { + "token": "Consider", + "logProbability": -5.952985 + }, + { + "token": "Target", + "logProbability": -10.369704 + }, + { + "token": "Make", + "logProbability": -12.395447 + }, + { + "token": "Match", + "logProbability": -13.391828 + } + ] + }, + { + "candidates": [ + { + "token": " your", + "logProbability": -7.712471e-5 + }, + { + "token": " the", + "logProbability": -9.828625 + }, + { + "token": " brand", + "logProbability": -10.668744 + }, + { + "token": "s", + "logProbability": -17.426825 + }, + { + "token": " Your", + "logProbability": -18.46581 + } + ] + }, + { + "candidates": [ + { + "token": " brand", + "logProbability": -1.0729074e-6 + }, + { + "token": " target", + "logProbability": -14.341959 + }, + { + "token": " branding", + "logProbability": -14.679212 + }, + { + "token": " Brand", + "logProbability": -17.866316 + }, + { + "token": " style", + "logProbability": -19.38002 + } + ] + }, + { + "candidates": [ + { + "token": ":**", + "logProbability": -0.043970577 + }, + { + "token": " personality", + "logProbability": -3.7035375 + }, + { + "token": " identity", + "logProbability": -4.618109 + }, + { + "token": "'", + "logProbability": -4.7807145 + }, + { + "token": " image", + "logProbability": -9.863998 + } + ] + }, + { + "candidates": [ + { + "token": " ", + "logProbability": -0.044675775 + }, + { + "token": " Does", + "logProbability": -4.008547 + }, + { + "token": " Choose", + "logProbability": -4.041092 + }, + { + "token": " Play", + "logProbability": -5.7363234 + }, + { + "token": " Consider", + "logProbability": -6.349637 + } + ] + }, + { + "candidates": [ + { + "token": "Does", + "logProbability": -0.33518785 + }, + { + "token": "Choose", + "logProbability": -1.6609783 + }, + { + "token": "The", + "logProbability": -3.0974445 + }, + { + "token": "Is", + "logProbability": -3.5886374 + }, + { + "token": "Consider", + "logProbability": -4.6004534 + } + ] + }, + { + "candidates": [ + { + "token": " a", + "logProbability": -1.4662876e-5 + }, + { + "token": " something", + "logProbability": -11.249111 + }, + { + "token": " ", + "logProbability": -14.776858 + }, + { + "token": " names", + "logProbability": -14.848242 + }, + { + "token": " the", + "logProbability": -14.860705 + } + ] + }, + { + "candidates": [ + { + "token": " name", + "logProbability": -4.923015e-5 + }, + { + "token": " style", + "logProbability": -9.956228 + }, + { + "token": " tone", + "logProbability": -13.491678 + }, + { + "token": " ", + "logProbability": -15.726757 + }, + { + "token": " naming", + "logProbability": -16.881725 + } + ] + }, + { + "candidates": [ + { + "token": " that", + "logProbability": -0.00018306584 + }, + { + "token": " consistent", + "logProbability": -9.285699 + }, + { + "token": " aligning", + "logProbability": -10.083582 + }, + { + "token": " aligned", + "logProbability": -10.663624 + }, + { + "token": " reflecting", + "logProbability": -11.450212 + } + ] + }, + { + "candidates": [ + { + "token": " aligns", + "logProbability": -0.18756618 + }, + { + "token": " matches", + "logProbability": -2.373197 + }, + { + "token": " reflects", + "logProbability": -3.0672736 + }, + { + "token": " fits", + "logProbability": -3.9934058 + }, + { + "token": " conveys", + "logProbability": -4.795976 + } + ] + }, + { + "candidates": [ + { + "token": " with", + "logProbability": -3.5760596e-7 + }, + { + "token": " your", + "logProbability": -15.786232 + }, + { + "token": " well", + "logProbability": -16.375853 + }, + { + "token": " ", + "logProbability": -16.727472 + }, + { + "token": " to", + "logProbability": -17.175974 + } + ] + }, + { + "candidates": [ + { + "token": " your", + "logProbability": -0.0031875274 + }, + { + "token": " the", + "logProbability": -5.750342 + }, + { + "token": " ", + "logProbability": -14.567538 + }, + { + "token": " overall", + "logProbability": -17.986858 + }, + { + "token": " its", + "logProbability": -18.012613 + } + ] + }, + { + "candidates": [ + { + "token": " target", + "logProbability": -0.0050847274 + }, + { + "token": " style", + "logProbability": -5.7609887 + }, + { + "token": " brand", + "logProbability": -6.8963275 + }, + { + "token": " company", + "logProbability": -7.743197 + }, + { + "token": " overall", + "logProbability": -7.9207654 + } + ] + }, + { + "candidates": [ + { + "token": " audience", + "logProbability": -0.0013331324 + }, + { + "token": " market", + "logProbability": -6.623122 + }, + { + "token": " customer", + "logProbability": -12.719181 + }, + { + "token": " customers", + "logProbability": -16.416183 + }, + { + "token": " demographic", + "logProbability": -17.36795 + } + ] + }, + { + "candidates": [ + { + "token": " and", + "logProbability": -0.0001196841 + }, + { + "token": " (", + "logProbability": -9.2622385 + }, + { + "token": "'", + "logProbability": -11.375453 + }, + { + "token": " &", + "logProbability": -11.597282 + }, + { + "token": ".", + "logProbability": -12.683573 + } + ] + }, + { + "candidates": [ + { + "token": " brand", + "logProbability": -0.6301888 + }, + { + "token": " the", + "logProbability": -1.2887143 + }, + { + "token": " style", + "logProbability": -1.8369063 + }, + { + "token": " overall", + "logProbability": -4.079262 + }, + { + "token": " aesthetic", + "logProbability": -4.566267 + } + ] + }, + { + "candidates": [ + { + "token": " aesthetic", + "logProbability": -0.4539902 + }, + { + "token": " personality", + "logProbability": -1.0220597 + }, + { + "token": " aesthetics", + "logProbability": -6.302149 + }, + { + "token": " style", + "logProbability": -6.370862 + }, + { + "token": " image", + "logProbability": -6.7803264 + } + ] + }, + { + "candidates": [ + { + "token": ".", + "logProbability": -0.12146552 + }, + { + "token": " (", + "logProbability": -2.1682603 + }, + { + "token": " ", + "logProbability": -12.461348 + }, + { + "token": " –", + "logProbability": -13.035048 + }, + { + "token": ",", + "logProbability": -15.248569 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.00025985116 + }, + { + "token": " ", + "logProbability": -8.543066 + }, + { + "token": "\n\n\n", + "logProbability": -9.748028 + }, + { + "token": " (", + "logProbability": -12.697121 + }, + { + "token": "\n\n", + "logProbability": -13.031556 + } + ] + }, + { + "candidates": [ + { + "token": "*", + "logProbability": 0 + }, + { + "token": " ", + "logProbability": -17.673256 + }, + { + "token": " ", + "logProbability": -20.781792 + }, + { + "token": " ", + "logProbability": -21.054531 + }, + { + "token": "*.", + "logProbability": -21.175182 + } + ] + }, + { + "candidates": [ + { + "token": " **", + "logProbability": -1.0729074e-6 + }, + { + "token": " ", + "logProbability": -13.699566 + }, + { + "token": "**", + "logProbability": -18.550268 + }, + { + "token": " Say", + "logProbability": -19.498484 + }, + { + "token": " Get", + "logProbability": -19.628721 + } + ] + }, + { + "candidates": [ + { + "token": "Say", + "logProbability": -0.43699056 + }, + { + "token": "Get", + "logProbability": -1.231077 + }, + { + "token": "Consider", + "logProbability": -2.792652 + }, + { + "token": "Test", + "logProbability": -7.273884 + }, + { + "token": "Easy", + "logProbability": -10.176586 + } + ] + }, + { + "candidates": [ + { + "token": " it", + "logProbability": -2.2649522e-6 + }, + { + "token": " the", + "logProbability": -13.04769 + }, + { + "token": " your", + "logProbability": -16.127533 + }, + { + "token": " aloud", + "logProbability": -18.961933 + }, + { + "token": " It", + "logProbability": -19.594812 + } + ] + }, + { + "candidates": [ + { + "token": " aloud", + "logProbability": -0.6340595 + }, + { + "token": " out", + "logProbability": -0.7559491 + }, + { + "token": " Out", + "logProbability": -15.573956 + }, + { + "token": " al", + "logProbability": -16.425806 + }, + { + "token": " and", + "logProbability": -18.161318 + } + ] + }, + { + "candidates": [ + { + "token": " loud", + "logProbability": -1.1922384e-7 + }, + { + "token": "loud", + "logProbability": -15.621031 + }, + { + "token": " aloud", + "logProbability": -17.267965 + }, + { + "token": " load", + "logProbability": -18.296562 + }, + { + "token": " Loud", + "logProbability": -18.368011 + } + ] + }, + { + "candidates": [ + { + "token": ":**", + "logProbability": -2.3844768e-7 + }, + { + "token": "!", + "logProbability": -16.522572 + }, + { + "token": "**:", + "logProbability": -16.670797 + }, + { + "token": "!:", + "logProbability": -16.766304 + }, + { + "token": ".**", + "logProbability": -17.750212 + } + ] + }, + { + "candidates": [ + { + "token": " ", + "logProbability": -0.16322772 + }, + { + "token": " Does", + "logProbability": -2.2083843 + }, + { + "token": " Make", + "logProbability": -3.8833454 + }, + { + "token": " Ensure", + "logProbability": -3.931977 + }, + { + "token": " See", + "logProbability": -8.552757 + } + ] + }, + { + "candidates": [ + { + "token": "Does", + "logProbability": -0.2503621 + }, + { + "token": "Make", + "logProbability": -1.7969568 + }, + { + "token": "Ensure", + "logProbability": -2.9228675 + }, + { + "token": "See", + "logProbability": -6.688292 + }, + { + "token": "How", + "logProbability": -7.563668 + } + ] + }, + { + "candidates": [ + { + "token": " it", + "logProbability": -0.00877871 + }, + { + "token": " the", + "logProbability": -4.739915 + }, + { + "token": " that", + "logProbability": -14.43771 + }, + { + "token": " easy", + "logProbability": -14.981517 + }, + { + "token": " its", + "logProbability": -16.070211 + } + ] + }, + { + "candidates": [ + { + "token": " sounds", + "logProbability": -0.1372306 + }, + { + "token": "'", + "logProbability": -2.081045 + }, + { + "token": " flows", + "logProbability": -5.694453 + }, + { + "token": "’", + "logProbability": -9.622174 + }, + { + "token": " rolls", + "logProbability": -11.980244 + } + ] + }, + { + "candidates": [ + { + "token": " good", + "logProbability": -7.355035e-5 + }, + { + "token": " pleasing", + "logProbability": -10.233749 + }, + { + "token": " pleasant", + "logProbability": -10.311743 + }, + { + "token": " appealing", + "logProbability": -12.656746 + }, + { + "token": " nice", + "logProbability": -13.592858 + } + ] + }, + { + "candidates": [ + { + "token": " and", + "logProbability": -0.0005582097 + }, + { + "token": " when", + "logProbability": -7.603948 + }, + { + "token": ".", + "logProbability": -10.831056 + }, + { + "token": " spoken", + "logProbability": -10.991989 + }, + { + "token": " phone", + "logProbability": -11.387869 + } + ] + }, + { + "candidates": [ + { + "token": " is", + "logProbability": -0.00034848583 + }, + { + "token": " flows", + "logProbability": -8.324174 + }, + { + "token": " easy", + "logProbability": -9.673825 + }, + { + "token": " isn", + "logProbability": -10.512846 + }, + { + "token": " rolls", + "logProbability": -11.405576 + } + ] + }, + { + "candidates": [ + { + "token": " easy", + "logProbability": -0.00078369986 + }, + { + "token": " easily", + "logProbability": -7.1612425 + }, + { + "token": " pronounce", + "logProbability": -11.8154125 + }, + { + "token": " clear", + "logProbability": -18.229443 + }, + { + "token": " relatively", + "logProbability": -19.052013 + } + ] + }, + { + "candidates": [ + { + "token": " to", + "logProbability": -4.7689537e-7 + }, + { + "token": " pronounce", + "logProbability": -14.603202 + }, + { + "token": " for", + "logProbability": -17.481087 + }, + { + "token": " ", + "logProbability": -19.254423 + }, + { + "token": "-", + "logProbability": -19.937336 + } + ] + }, + { + "candidates": [ + { + "token": " pronounce", + "logProbability": -1.1922384e-7 + }, + { + "token": " understand", + "logProbability": -16.16397 + }, + { + "token": " say", + "logProbability": -17.933456 + }, + { + "token": " pron", + "logProbability": -18.326313 + }, + { + "token": " pronoun", + "logProbability": -18.5583 + } + ] + }, + { + "candidates": [ + { + "token": ".", + "logProbability": -5.48322e-6 + }, + { + "token": "\n\n\n", + "logProbability": -12.52941 + }, + { + "token": " and", + "logProbability": -14.039102 + }, + { + "token": "\n\n", + "logProbability": -14.899185 + }, + { + "token": ",", + "logProbability": -15.489959 + } + ] + }, + { + "candidates": [ + { + "token": "\n\n\n", + "logProbability": -0.0023364306 + }, + { + "token": "\n\n", + "logProbability": -6.1054497 + }, + { + "token": "\n\n\n\n", + "logProbability": -9.505711 + }, + { + "token": "\n", + "logProbability": -10.512449 + }, + { + "token": " ", + "logProbability": -13.752909 + } + ] + }, + { + "candidates": [ + { + "token": "Remember", + "logProbability": -0.020208009 + }, + { + "token": "Ultimately", + "logProbability": -4.471393 + }, + { + "token": "Before", + "logProbability": -5.303805 + }, + { + "token": "Consider", + "logProbability": -5.748533 + }, + { + "token": "I", + "logProbability": -7.9768586 + } + ] + }, + { + "candidates": [ + { + "token": " to", + "logProbability": -4.649037e-6 + }, + { + "token": " also", + "logProbability": -12.560579 + }, + { + "token": ",", + "logProbability": -14.968973 + }, + { + "token": " that", + "logProbability": -14.97873 + }, + { + "token": " ", + "logProbability": -15.027925 + } + ] + }, + { + "candidates": [ + { + "token": " also", + "logProbability": -0.13674507 + }, + { + "token": " check", + "logProbability": -2.4227872 + }, + { + "token": " brainstorm", + "logProbability": -3.466045 + }, + { + "token": " consider", + "logProbability": -4.9153953 + }, + { + "token": " do", + "logProbability": -8.036822 + } + ] + }, + { + "candidates": [ + { + "token": " consider", + "logProbability": -0.17403562 + }, + { + "token": " check", + "logProbability": -1.8488976 + }, + { + "token": " brainstorm", + "logProbability": -6.211247 + }, + { + "token": " think", + "logProbability": -8.755549 + }, + { + "token": " look", + "logProbability": -10.173596 + } + ] + }, + { + "candidates": [ + { + "token": " a", + "logProbability": -0.3233059 + }, + { + "token": " your", + "logProbability": -1.7092817 + }, + { + "token": " the", + "logProbability": -3.1628044 + }, + { + "token": " creating", + "logProbability": -3.6114728 + }, + { + "token": " getting", + "logProbability": -4.0824423 + } + ] + }, + { + "candidates": [ + { + "token": " logo", + "logProbability": -0.026322054 + }, + { + "token": " tagline", + "logProbability": -3.6912525 + }, + { + "token": " corresponding", + "logProbability": -7.9370575 + }, + { + "token": " relevant", + "logProbability": -8.60129 + }, + { + "token": " suitable", + "logProbability": -9.246625 + } + ] + }, + { + "candidates": [ + { + "token": " and", + "logProbability": -0.16324478 + }, + { + "token": " that", + "logProbability": -2.545733 + }, + { + "token": " design", + "logProbability": -2.6308045 + }, + { + "token": " to", + "logProbability": -8.812028 + }, + { + "token": " which", + "logProbability": -12.041878 + } + ] + }, + { + "candidates": [ + { + "token": " overall", + "logProbability": -0.009249918 + }, + { + "token": " brand", + "logProbability": -5.5470448 + }, + { + "token": " branding", + "logProbability": -5.8467045 + }, + { + "token": " visual", + "logProbability": -6.0526924 + }, + { + "token": " design", + "logProbability": -9.921844 + } + ] + }, + { + "candidates": [ + { + "token": " branding", + "logProbability": -0.61397666 + }, + { + "token": " brand", + "logProbability": -0.77973765 + }, + { + "token": " visual", + "logProbability": -8.306366 + }, + { + "token": " design", + "logProbability": -10.818804 + }, + { + "token": " aesthetic", + "logProbability": -13.222749 + } + ] + }, + { + "candidates": [ + { + "token": " that", + "logProbability": -0.64749813 + }, + { + "token": " to", + "logProbability": -0.7476969 + }, + { + "token": " strategy", + "logProbability": -5.9652433 + }, + { + "token": " when", + "logProbability": -7.9390545 + }, + { + "token": " ", + "logProbability": -9.192558 + } + ] + }, + { + "candidates": [ + { + "token": " complement", + "logProbability": -0.6421861 + }, + { + "token": " create", + "logProbability": -0.8978738 + }, + { + "token": " further", + "logProbability": -3.2898827 + }, + { + "token": " complete", + "logProbability": -4.48936 + }, + { + "token": " reinforce", + "logProbability": -5.0262423 + } + ] + }, + { + "candidates": [ + { + "token": " your", + "logProbability": -0.06859829 + }, + { + "token": " the", + "logProbability": -2.7136197 + }, + { + "token": " ", + "logProbability": -13.439778 + }, + { + "token": " whatever", + "logProbability": -15.219078 + }, + { + "token": " chosen", + "logProbability": -15.845016 + } + ] + }, + { + "candidates": [ + { + "token": " chosen", + "logProbability": -0.00049043854 + }, + { + "token": " company", + "logProbability": -7.6246696 + }, + { + "token": " name", + "logProbability": -13.451412 + }, + { + "token": " selected", + "logProbability": -14.873598 + }, + { + "token": " business", + "logProbability": -16.47087 + } + ] + }, + { + "candidates": [ + { + "token": " name", + "logProbability": -0.014796407 + }, + { + "token": " company", + "logProbability": -4.2209063 + }, + { + "token": " business", + "logProbability": -13.50813 + }, + { + "token": " ", + "logProbability": -14.963653 + }, + { + "token": " sock", + "logProbability": -16.158691 + } + ] + }, + { + "candidates": [ + { + "token": ".", + "logProbability": -0.0039997515 + }, + { + "token": "!", + "logProbability": -6.2081413 + }, + { + "token": " and", + "logProbability": -7.2271233 + }, + { + "token": " effectively", + "logProbability": -7.3391647 + }, + { + "token": " for", + "logProbability": -7.511223 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -0.42647466 + }, + { + "token": " ", + "logProbability": -1.6916763 + }, + { + "token": " Good", + "logProbability": -1.8141528 + }, + { + "token": " I", + "logProbability": -11.879971 + }, + { + "token": " ", + "logProbability": -12.5808325 + } + ] + }, + { + "candidates": [ + { + "token": "Good", + "logProbability": -3.802634e-5 + }, + { + "token": "I", + "logProbability": -11.183122 + }, + { + "token": "Consider", + "logProbability": -11.628873 + }, + { + "token": "A", + "logProbability": -11.969624 + }, + { + "token": "The", + "logProbability": -13.286122 + } + ] + }, + { + "candidates": [ + { + "token": " luck", + "logProbability": -3.815163e-6 + }, + { + "token": " Luck", + "logProbability": -12.492605 + }, + { + "token": " ", + "logProbability": -18.383577 + }, + { + "token": "luck", + "logProbability": -18.545004 + }, + { + "token": " branding", + "logProbability": -18.682407 + } + ] + }, + { + "candidates": [ + { + "token": "!", + "logProbability": -1.251619e-5 + }, + { + "token": " with", + "logProbability": -11.337689 + }, + { + "token": " finding", + "logProbability": -15.034267 + }, + { + "token": " choosing", + "logProbability": -15.338639 + }, + { + "token": " creating", + "logProbability": -17.96724 + } + ] + }, + { + "candidates": [ + { + "token": "\n", + "logProbability": -1.1922384e-7 + }, + { + "token": "\n\n", + "logProbability": -15.739279 + }, + { + "token": "\n\n\n", + "logProbability": -17.510612 + }, + { + "token": " ", + "logProbability": -17.767399 + }, + { + "token": " ", + "logProbability": -20.346842 + } + ] + } + ], + "chosenCandidates": [ + { + "token": "Here", + "logProbability": -0.25194553 + }, + { + "token": " are", + "logProbability": -1.1922384e-7 + }, + { + "token": " some", + "logProbability": -3.5760596e-7 + }, + { + "token": " name", + "logProbability": -0.020438675 + }, + { + "token": " ideas", + "logProbability": -3.802634e-5 + }, + { + "token": " for", + "logProbability": -0.00055940077 + }, + { + "token": " a", + "logProbability": -2.3844768e-7 + }, + { + "token": " company", + "logProbability": -0.06226602 + }, + { + "token": " that", + "logProbability": -0.00017984792 + }, + { + "token": " makes", + "logProbability": -0.00032727723 + }, + { + "token": " colorful", + "logProbability": -3.7668888e-5 + }, + { + "token": " socks", + "logProbability": 0 + }, + { + "token": ",", + "logProbability": -9.537907e-7 + }, + { + "token": " categorized", + "logProbability": -0.0021683632 + }, + { + "token": " by", + "logProbability": -0.82754296 + }, + { + "token": " approach", + "logProbability": -0.40137294 + }, + { + "token": ":", + "logProbability": -1.3112239e-6 + }, + { + "token": "\n\n", + "logProbability": -0.00023421005 + }, + { + "token": "**", + "logProbability": 0 + }, + { + "token": "Play", + "logProbability": -1.206775 + }, + { + "token": "ful", + "logProbability": 0 + }, + { + "token": " &", + "logProbability": 0 + }, + { + "token": " Fun", + "logProbability": -0.0060783206 + }, + { + "token": ":**", + "logProbability": -3.5760596e-7 + }, + { + "token": "\n\n", + "logProbability": 0 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Sock", + "logProbability": -3.1831478e-5 + }, + { + "token": "Hop", + "logProbability": -2.8257122 + }, + { + "token": "\n", + "logProbability": -7.987648e-6 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Toe", + "logProbability": -3.047093 + }, + { + "token": "-", + "logProbability": -0.012149351 + }, + { + "token": "tally", + "logProbability": -0.060209215 + }, + { + "token": " Rad", + "logProbability": -0.46893552 + }, + { + "token": " Socks", + "logProbability": -0.017792623 + }, + { + "token": "\n", + "logProbability": -5.9602587e-7 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Happy", + "logProbability": -0.35176113 + }, + { + "token": " Feet", + "logProbability": -0.002849315 + }, + { + "token": "\n", + "logProbability": -0.042537317 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Rainbow", + "logProbability": -0.86355895 + }, + { + "token": " Runners", + "logProbability": -0.09771462 + }, + { + "token": "\n", + "logProbability": -1.0729074e-6 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Colour", + "logProbability": -1.2459048 + }, + { + "token": " Cra", + "logProbability": -0.011012339 + }, + { + "token": "ze", + "logProbability": -0.0008561311 + }, + { + "token": " Socks", + "logProbability": -0.003197624 + }, + { + "token": "\n", + "logProbability": -8.344534e-7 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " The", + "logProbability": -1.1768675 + }, + { + "token": " Sock", + "logProbability": -1.8953595e-5 + }, + { + "token": " Drawer", + "logProbability": -0.0005870343 + }, + { + "token": "\n", + "logProbability": -0.0034885793 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Sock", + "logProbability": -0.54668313 + }, + { + "token": "t", + "logProbability": -2.5100746 + }, + { + "token": "astic", + "logProbability": -3.5760596e-7 + }, + { + "token": "\n", + "logProbability": -0.0030594482 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Foot", + "logProbability": -0.15131043 + }, + { + "token": "loose", + "logProbability": -0.0073479274 + }, + { + "token": " &", + "logProbability": -0.0020334618 + }, + { + "token": " Fancy", + "logProbability": -7.271795e-6 + }, + { + "token": " Free", + "logProbability": -1.4369822 + }, + { + "token": "\n", + "logProbability": -0.046983317 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Whi", + "logProbability": -0.16465758 + }, + { + "token": "ms", + "logProbability": -1.1922384e-7 + }, + { + "token": "ical", + "logProbability": -0.0016447491 + }, + { + "token": " Threads", + "logProbability": -0.45600042 + }, + { + "token": "\n", + "logProbability": -0.05170492 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Colour", + "logProbability": -2.4246674 + }, + { + "token": " Riot", + "logProbability": -1.9875677 + }, + { + "token": " Socks", + "logProbability": -0.072785005 + }, + { + "token": "\n\n", + "logProbability": -0.13055436 + }, + { + "token": "**", + "logProbability": 0 + }, + { + "token": "Soph", + "logProbability": -0.0070743416 + }, + { + "token": "isticated", + "logProbability": -8.344534e-7 + }, + { + "token": " &", + "logProbability": 0 + }, + { + "token": " Chic", + "logProbability": -0.022171007 + }, + { + "token": ":**", + "logProbability": -1.1922384e-7 + }, + { + "token": "\n\n", + "logProbability": 0 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Atelier", + "logProbability": -2.4749122 + }, + { + "token": " des", + "logProbability": -0.5460347 + }, + { + "token": " Cha", + "logProbability": -0.008240157 + }, + { + "token": "us", + "logProbability": -1.7881898e-6 + }, + { + "token": "settes", + "logProbability": -2.3844768e-7 + }, + { + "token": " (", + "logProbability": -0.00072914065 + }, + { + "token": "French", + "logProbability": -0.0010093687 + }, + { + "token": " for", + "logProbability": -0.0021644344 + }, + { + "token": " \"", + "logProbability": -0.00025568233 + }, + { + "token": "Sock", + "logProbability": -0.13492844 + }, + { + "token": " Atelier", + "logProbability": -0.22585036 + }, + { + "token": "\")", + "logProbability": -4.3627377e-5 + }, + { + "token": "\n", + "logProbability": -2.1458147e-6 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " The", + "logProbability": -0.4336172 + }, + { + "token": " Sock", + "logProbability": -0.0006779188 + }, + { + "token": " Studio", + "logProbability": -2.1193948 + }, + { + "token": "\n", + "logProbability": -1.4304238e-6 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Hue", + "logProbability": -0.0403958 + }, + { + "token": " &", + "logProbability": -0.00032251154 + }, + { + "token": " Cry", + "logProbability": -2.121776e-5 + }, + { + "token": "\n", + "logProbability": -0.4465648 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Ch", + "logProbability": -0.22707948 + }, + { + "token": "roma", + "logProbability": 0 + }, + { + "token": "Threads", + "logProbability": -2.319378 + }, + { + "token": "\n", + "logProbability": -4.1724998e-6 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " The", + "logProbability": -3.448003 + }, + { + "token": " Sock", + "logProbability": -0.03975758 + }, + { + "token": " Gallery", + "logProbability": -0.86014694 + }, + { + "token": "\n", + "logProbability": -1.9075815e-6 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Spectrum", + "logProbability": -0.76918274 + }, + { + "token": " Socks", + "logProbability": -0.86054623 + }, + { + "token": "\n", + "logProbability": -0.0006556438 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Colour", + "logProbability": -1.2110671 + }, + { + "token": " Collective", + "logProbability": -0.71306264 + }, + { + "token": "\n", + "logProbability": -0.031042011 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Thread", + "logProbability": -2.0178218 + }, + { + "token": "bare", + "logProbability": -0.01844945 + }, + { + "token": " &", + "logProbability": -0.04435469 + }, + { + "token": " Bold", + "logProbability": -0.0051981206 + }, + { + "token": "\n\n", + "logProbability": -0.2817244 + }, + { + "token": "**", + "logProbability": -4.7689537e-7 + }, + { + "token": "Unique", + "logProbability": -0.3719452 + }, + { + "token": " &", + "logProbability": 0 + }, + { + "token": " Mem", + "logProbability": -1.1436048 + }, + { + "token": "orable", + "logProbability": 0 + }, + { + "token": ":**", + "logProbability": -3.2185512e-6 + }, + { + "token": "\n\n", + "logProbability": -1.1922384e-7 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Sole", + "logProbability": -0.32002398 + }, + { + "token": "M", + "logProbability": -0.26338503 + }, + { + "token": "ates", + "logProbability": 0 + }, + { + "token": "\n", + "logProbability": -0.00020714411 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Foot", + "logProbability": -0.03555266 + }, + { + "token": "Prints", + "logProbability": -1.1619806 + }, + { + "token": "\n", + "logProbability": -0.00018187401 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Sock", + "logProbability": -0.05234257 + }, + { + "token": "fluence", + "logProbability": -1.6918598 + }, + { + "token": "\n", + "logProbability": -4.6607358e-5 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Thread", + "logProbability": -1.0182276 + }, + { + "token": "bare", + "logProbability": -0.22781493 + }, + { + "token": " Tales", + "logProbability": -0.0003030922 + }, + { + "token": "\n", + "logProbability": -0.002686422 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Knit", + "logProbability": -0.8322125 + }, + { + "token": " Wit", + "logProbability": -1.7551354 + }, + { + "token": "\n", + "logProbability": -0.00013981262 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " Leg", + "logProbability": -4.018093 + }, + { + "token": "acies", + "logProbability": -0.2952639 + }, + { + "token": "\n", + "logProbability": -0.7574003 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " The", + "logProbability": -0.16780898 + }, + { + "token": " Ho", + "logProbability": -2.0705957 + }, + { + "token": "siery", + "logProbability": -0.00021405888 + }, + { + "token": " House", + "logProbability": -0.107407786 + }, + { + "token": "\n\n", + "logProbability": -0.9995049 + }, + { + "token": "**", + "logProbability": -2.3844768e-7 + }, + { + "token": "Location", + "logProbability": -0.0125602735 + }, + { + "token": " Specific", + "logProbability": -0.01011511 + }, + { + "token": " (", + "logProbability": -3.4570896e-6 + }, + { + "token": "if", + "logProbability": -0.2524224 + }, + { + "token": " applicable", + "logProbability": -0.0002407691 + }, + { + "token": "):", + "logProbability": -0.00011717935 + }, + { + "token": "**", + "logProbability": -0.0001095468 + }, + { + "token": "\n\n", + "logProbability": -0.0018100317 + }, + { + "token": "*", + "logProbability": -4.5415305e-5 + }, + { + "token": " [", + "logProbability": -0.00010716193 + }, + { + "token": "City", + "logProbability": -0.7048428 + }, + { + "token": "/", + "logProbability": -0.22593477 + }, + { + "token": "Region", + "logProbability": -0.03399348 + }, + { + "token": "]", + "logProbability": -0.0011304824 + }, + { + "token": " Sock", + "logProbability": -0.006740053 + }, + { + "token": " Co", + "logProbability": -0.0152717335 + }, + { + "token": ".", + "logProbability": -1.4424305e-5 + }, + { + "token": "\n", + "logProbability": -0.0040531945 + }, + { + "token": "*", + "logProbability": -7.152119e-7 + }, + { + "token": " [", + "logProbability": -0.0024865945 + }, + { + "token": "Landmark", + "logProbability": -0.047960762 + }, + { + "token": "]", + "logProbability": -0.00017710685 + }, + { + "token": " Socks", + "logProbability": -0.092020914 + }, + { + "token": "\n\n", + "logProbability": -1.5681398 + }, + { + "token": "**", + "logProbability": -9.202131e-5 + }, + { + "token": "Tips", + "logProbability": -0.0032254215 + }, + { + "token": " for", + "logProbability": -1.7523887e-5 + }, + { + "token": " choosing", + "logProbability": -1.0499891 + }, + { + "token": " a", + "logProbability": -0.40812367 + }, + { + "token": " name", + "logProbability": -0.00013695363 + }, + { + "token": ":**", + "logProbability": 0 + }, + { + "token": "\n\n", + "logProbability": -2.3844768e-7 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " **", + "logProbability": 0 + }, + { + "token": "Check", + "logProbability": -0.032968074 + }, + { + "token": " for", + "logProbability": -8.2248516e-5 + }, + { + "token": " availability", + "logProbability": -0.03969529 + }, + { + "token": ":**", + "logProbability": 0 + }, + { + "token": " Make", + "logProbability": -0.050556663 + }, + { + "token": " sure", + "logProbability": 0 + }, + { + "token": " the", + "logProbability": -5.9600343e-6 + }, + { + "token": " name", + "logProbability": -1.2277732e-5 + }, + { + "token": " isn", + "logProbability": -0.00961137 + }, + { + "token": "'", + "logProbability": -3.2185512e-6 + }, + { + "token": "t", + "logProbability": -9.537907e-7 + }, + { + "token": " already", + "logProbability": -1.6689067e-6 + }, + { + "token": " in", + "logProbability": -1.104073 + }, + { + "token": " use", + "logProbability": 0 + }, + { + "token": " (", + "logProbability": -0.5516647 + }, + { + "token": "website", + "logProbability": -0.03536837 + }, + { + "token": " domain", + "logProbability": -7.140589e-5 + }, + { + "token": ",", + "logProbability": -4.7680274e-5 + }, + { + "token": " trademarks", + "logProbability": -1.2400084 + }, + { + "token": ").", + "logProbability": -0.016963713 + }, + { + "token": "\n", + "logProbability": -4.7689537e-7 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " **", + "logProbability": 0 + }, + { + "token": "Keep", + "logProbability": -0.0002531811 + }, + { + "token": " it", + "logProbability": 0 + }, + { + "token": " short", + "logProbability": -0.011662084 + }, + { + "token": " and", + "logProbability": -0.0001768685 + }, + { + "token": " memorable", + "logProbability": -1.8834444e-5 + }, + { + "token": ":**", + "logProbability": -1.6689067e-6 + }, + { + "token": " Easy", + "logProbability": -0.6181912 + }, + { + "token": " to", + "logProbability": -4.8873435e-6 + }, + { + "token": " recall", + "logProbability": -0.046240393 + }, + { + "token": " and", + "logProbability": -1.02513495e-5 + }, + { + "token": " share", + "logProbability": -0.06211961 + }, + { + "token": ".", + "logProbability": -2.861005e-5 + }, + { + "token": "\n", + "logProbability": 0 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " **", + "logProbability": -3.5760596e-7 + }, + { + "token": "Reflect", + "logProbability": -0.0026395652 + }, + { + "token": " your", + "logProbability": -7.712471e-5 + }, + { + "token": " brand", + "logProbability": -1.0729074e-6 + }, + { + "token": ":**", + "logProbability": -0.043970577 + }, + { + "token": " ", + "logProbability": -0.044675775 + }, + { + "token": "Choose", + "logProbability": -1.6609783 + }, + { + "token": " a", + "logProbability": -1.4662876e-5 + }, + { + "token": " name", + "logProbability": -4.923015e-5 + }, + { + "token": " that", + "logProbability": -0.00018306584 + }, + { + "token": " aligns", + "logProbability": -0.18756618 + }, + { + "token": " with", + "logProbability": -3.5760596e-7 + }, + { + "token": " your", + "logProbability": -0.0031875274 + }, + { + "token": " target", + "logProbability": -0.0050847274 + }, + { + "token": " audience", + "logProbability": -0.0013331324 + }, + { + "token": " and", + "logProbability": -0.0001196841 + }, + { + "token": " brand", + "logProbability": -0.6301888 + }, + { + "token": " aesthetic", + "logProbability": -0.4539902 + }, + { + "token": ".", + "logProbability": -0.12146552 + }, + { + "token": "\n", + "logProbability": -0.00025985116 + }, + { + "token": "*", + "logProbability": 0 + }, + { + "token": " **", + "logProbability": -1.0729074e-6 + }, + { + "token": "Say", + "logProbability": -0.43699056 + }, + { + "token": " it", + "logProbability": -2.2649522e-6 + }, + { + "token": " out", + "logProbability": -0.7559491 + }, + { + "token": " loud", + "logProbability": -1.1922384e-7 + }, + { + "token": ":**", + "logProbability": -2.3844768e-7 + }, + { + "token": " ", + "logProbability": -0.16322772 + }, + { + "token": "Ensure", + "logProbability": -2.9228675 + }, + { + "token": " it", + "logProbability": -0.00877871 + }, + { + "token": " sounds", + "logProbability": -0.1372306 + }, + { + "token": " good", + "logProbability": -7.355035e-5 + }, + { + "token": " and", + "logProbability": -0.0005582097 + }, + { + "token": " is", + "logProbability": -0.00034848583 + }, + { + "token": " easy", + "logProbability": -0.00078369986 + }, + { + "token": " to", + "logProbability": -4.7689537e-7 + }, + { + "token": " pronounce", + "logProbability": -1.1922384e-7 + }, + { + "token": ".", + "logProbability": -5.48322e-6 + }, + { + "token": "\n\n\n", + "logProbability": -0.0023364306 + }, + { + "token": "Remember", + "logProbability": -0.020208009 + }, + { + "token": " to", + "logProbability": -4.649037e-6 + }, + { + "token": " also", + "logProbability": -0.13674507 + }, + { + "token": " consider", + "logProbability": -0.17403562 + }, + { + "token": " a", + "logProbability": -0.3233059 + }, + { + "token": " logo", + "logProbability": -0.026322054 + }, + { + "token": " and", + "logProbability": -0.16324478 + }, + { + "token": " overall", + "logProbability": -0.009249918 + }, + { + "token": " branding", + "logProbability": -0.61397666 + }, + { + "token": " to", + "logProbability": -0.7476969 + }, + { + "token": " complement", + "logProbability": -0.6421861 + }, + { + "token": " your", + "logProbability": -0.06859829 + }, + { + "token": " chosen", + "logProbability": -0.00049043854 + }, + { + "token": " name", + "logProbability": -0.014796407 + }, + { + "token": ".", + "logProbability": -0.0039997515 + }, + { + "token": " ", + "logProbability": -1.6916763 + }, + { + "token": "Good", + "logProbability": -3.802634e-5 + }, + { + "token": " luck", + "logProbability": -3.815163e-6 + }, + { + "token": "!", + "logProbability": -1.251619e-5 + }, + { + "token": "\n", + "logProbability": -1.1922384e-7 + } + ] + } + } + ], + "usageMetadata": { + "promptTokenCount": 14, + "candidatesTokenCount": 303, + "totalTokenCount": 317 + }, + "modelVersion": "gemini-1.5-flash-002" +} diff --git a/libs/langchain-google-common/src/types.ts b/libs/langchain-google-common/src/types.ts index 3b702cda6f87..88a64734f7aa 100644 --- a/libs/langchain-google-common/src/types.ts +++ b/libs/langchain-google-common/src/types.ts @@ -162,6 +162,36 @@ export interface GoogleAIModelParams { */ topK?: number; + /** + * Presence penalty applied to the next token's logprobs + * if the token has already been seen in the response. + * This penalty is binary on/off and not dependant on the + * number of times the token is used (after the first). + * Use frequencyPenalty for a penalty that increases with each use. + * A positive penalty will discourage the use of tokens that have + * already been used in the response, increasing the vocabulary. + * A negative penalty will encourage the use of tokens that have + * already been used in the response, decreasing the vocabulary. + */ + presencePenalty?: number; + + /** + * Frequency penalty applied to the next token's logprobs, + * multiplied by the number of times each token has been seen + * in the respponse so far. + * A positive penalty will discourage the use of tokens that + * have already been used, proportional to the number of times + * the token has been used: + * The more a token is used, the more dificult it is for the model + * to use that token again increasing the vocabulary of responses. + * Caution: A _negative_ penalty will encourage the model to reuse + * tokens proportional to the number of times the token has been used. + * Small negative values will reduce the vocabulary of a response. + * Larger negative values will cause the model to start repeating + * a common token until it hits the maxOutputTokens limit. + */ + frequencyPenalty?: number; + stopSequences?: string[]; safetySettings?: GoogleAISafetySetting[]; @@ -184,6 +214,21 @@ export interface GoogleAIModelParams { * @default false */ streaming?: boolean; + + /** + * Whether to return log probabilities of the output tokens or not. + * If true, returns the log probabilities of each output token + * returned in the content of message. + */ + logprobs?: boolean; + + /** + * An integer between 0 and 5 specifying the number of + * most likely tokens to return at each token position, + * each with an associated log probability. + * logprobs must be set to true if this parameter is used. + */ + topLogprobs?: number; } export type GoogleAIToolType = BindToolsInput | GeminiTool; @@ -364,6 +409,21 @@ export interface GeminiRetrievalMetadata { googleSearchDynamicRetrievalScore: number; } +export interface GeminiLogprobsResult { + topCandidates: GeminiLogprobsTopCandidate[]; + chosenCandidates: GeminiLogprobsResultCandidate[]; +} + +export interface GeminiLogprobsTopCandidate { + candidates: GeminiLogprobsResultCandidate[]; +} + +export interface GeminiLogprobsResultCandidate { + token: string; + tokenId: number; + logProbability: number; +} + // The "system" content appears to only be valid in the systemInstruction export type GeminiRole = "system" | "user" | "model" | "function"; @@ -451,7 +511,11 @@ export interface GeminiGenerationConfig { temperature?: number; topP?: number; topK?: number; + presencePenalty?: number; + frequencyPenalty?: number; responseMimeType?: GoogleAIResponseMimeType; + responseLogprobs?: boolean; + logprobs?: number; } export interface GeminiRequest { @@ -468,7 +532,7 @@ export interface GeminiRequest { generationConfig?: GeminiGenerationConfig; } -interface GeminiResponseCandidate { +export interface GeminiResponseCandidate { content: { parts: GeminiPart[]; role: string; @@ -479,6 +543,8 @@ interface GeminiResponseCandidate { safetyRatings: GeminiSafetyRating[]; citationMetadata?: GeminiCitationMetadata; groundingMetadata?: GeminiGroundingMetadata; + avgLogprobs?: number; + logprobsResult: GeminiLogprobsResult; } interface GeminiResponsePromptFeedback { diff --git a/libs/langchain-google-common/src/utils/common.ts b/libs/langchain-google-common/src/utils/common.ts index 4194f9578b9e..8158cac3c919 100644 --- a/libs/langchain-google-common/src/utils/common.ts +++ b/libs/langchain-google-common/src/utils/common.ts @@ -136,10 +136,21 @@ export function copyAIModelParamsInto( target.maxOutputTokens; ret.topP = options?.topP ?? params?.topP ?? target.topP; ret.topK = options?.topK ?? params?.topK ?? target.topK; + ret.presencePenalty = + options?.presencePenalty ?? + params?.presencePenalty ?? + target.presencePenalty; + ret.frequencyPenalty = + options?.frequencyPenalty ?? + params?.frequencyPenalty ?? + target.frequencyPenalty; ret.stopSequences = options?.stopSequences ?? params?.stopSequences ?? target.stopSequences; ret.safetySettings = options?.safetySettings ?? params?.safetySettings ?? target.safetySettings; + ret.logprobs = options?.logprobs ?? params?.logprobs ?? target.logprobs; + ret.topLogprobs = + options?.topLogprobs ?? params?.topLogprobs ?? target.topLogprobs; ret.convertSystemMessageToHumanContent = options?.convertSystemMessageToHumanContent ?? params?.convertSystemMessageToHumanContent ?? diff --git a/libs/langchain-google-common/src/utils/gemini.ts b/libs/langchain-google-common/src/utils/gemini.ts index 7f532983d6a4..3408ab8e26b6 100644 --- a/libs/langchain-google-common/src/utils/gemini.ts +++ b/libs/langchain-google-common/src/utils/gemini.ts @@ -38,6 +38,10 @@ import type { GoogleAIAPI, GeminiAPIConfig, GeminiGroundingSupport, + GeminiResponseCandidate, + GeminiLogprobsResult, + GeminiLogprobsResultCandidate, + GeminiLogprobsTopCandidate, } from "../types.js"; import { GoogleAISafetyError } from "./safety.js"; import { MediaBlob } from "../experimental/utils/media_core.js"; @@ -674,6 +678,52 @@ export function getGeminiAPI(config?: GeminiAPIConfig): GoogleAIAPI { return safeResponseTo(response, responseToString); } + type Logprob = { + token: string; + logprob: number; + bytes: number[]; + top_logprobs?: Omit[]; + }; + + type LogprobContent = { + content: Logprob[]; + }; + + function logprobResultToLogprob( + result: GeminiLogprobsResultCandidate + ): Omit { + const token = result?.token; + const logprob = result?.logProbability; + const encoder = new TextEncoder(); + const bytes = Array.from(encoder.encode(token)); + return { + token, + logprob, + bytes, + }; + } + + function candidateToLogprobs( + candidate: GeminiResponseCandidate + ): LogprobContent | undefined { + const logprobs: GeminiLogprobsResult = candidate?.logprobsResult; + const chosenTokens: GeminiLogprobsResultCandidate[] = + logprobs?.chosenCandidates ?? []; + const topTokens: GeminiLogprobsTopCandidate[] = + logprobs?.topCandidates ?? []; + const content: Logprob[] = []; + for (let co = 0; co < chosenTokens.length; co += 1) { + const chosen = chosenTokens[co]; + const top = topTokens[co]?.candidates ?? []; + const logprob: Logprob = logprobResultToLogprob(chosen); + logprob.top_logprobs = top.map((l) => logprobResultToLogprob(l)); + content.push(logprob); + } + return { + content, + }; + } + function responseToGenerationInfo(response: GoogleLLMResponse) { if (!Array.isArray(response.data)) { return {}; @@ -695,6 +745,8 @@ export function getGeminiAPI(config?: GeminiAPIConfig): GoogleAIAPI { citation_metadata: data.candidates[0]?.citationMetadata, grounding_metadata: data.candidates[0]?.groundingMetadata, finish_reason: data.candidates[0]?.finishReason, + avgLogprobs: data.candidates[0]?.avgLogprobs, + logprobs: candidateToLogprobs(data.candidates[0]), }; } @@ -858,6 +910,20 @@ export function getGeminiAPI(config?: GeminiAPIConfig): GoogleAIAPI { }), ]; } + + // Add logprobs information to the message + const candidate = (response?.data as GenerateContentResponseData) + ?.candidates?.[0]; + const avgLogprobs = candidate?.avgLogprobs; + const logprobs = candidateToLogprobs(candidate); + if (logprobs) { + ret[0].message.response_metadata = { + ...ret[0].message.response_metadata, + logprobs, + avgLogprobs, + }; + } + return ret; } @@ -1018,9 +1084,13 @@ export function getGeminiAPI(config?: GeminiAPIConfig): GoogleAIAPI { temperature: parameters.temperature, topK: parameters.topK, topP: parameters.topP, + presencePenalty: parameters.presencePenalty, + frequencyPenalty: parameters.frequencyPenalty, maxOutputTokens: parameters.maxOutputTokens, stopSequences: parameters.stopSequences, responseMimeType: parameters.responseMimeType, + responseLogprobs: parameters.logprobs, + logprobs: parameters.topLogprobs, }; } From 39e1d98ab000e2eb10e9915f8a5ec6a2481d89b0 Mon Sep 17 00:00:00 2001 From: ucev Date: Sat, 11 Jan 2025 06:20:28 +0800 Subject: [PATCH 06/34] feat(community): add ByteDance Doubao Embeddings (#7450) Co-authored-by: Jacob Lee --- docs/core_docs/.gitignore | 82 ++--- .../text_embedding/bytedance_doubao.ipynb | 309 ++++++++++++++++++ examples/.env.example | 3 +- examples/src/embeddings/bytedance_doubao.ts | 9 + libs/langchain-community/.gitignore | 4 + libs/langchain-community/langchain.config.js | 1 + libs/langchain-community/package.json | 13 + .../src/embeddings/bytedance_doubao.ts | 176 ++++++++++ .../tests/bytedance_doubao.int.test.ts | 40 +++ .../src/load/import_map.ts | 1 + 10 files changed, 598 insertions(+), 40 deletions(-) create mode 100644 docs/core_docs/docs/integrations/text_embedding/bytedance_doubao.ipynb create mode 100644 examples/src/embeddings/bytedance_doubao.ts create mode 100644 libs/langchain-community/src/embeddings/bytedance_doubao.ts create mode 100644 libs/langchain-community/src/embeddings/tests/bytedance_doubao.int.test.ts diff --git a/docs/core_docs/.gitignore b/docs/core_docs/.gitignore index 01a0e487fd41..9353e462637e 100644 --- a/docs/core_docs/.gitignore +++ b/docs/core_docs/.gitignore @@ -34,16 +34,16 @@ yarn-error.log* /.quarto/ # AUTO_GENERATED_DOCS +docs/tutorials/summarization.md +docs/tutorials/summarization.mdx +docs/tutorials/sql_qa.md +docs/tutorials/sql_qa.mdx +docs/tutorials/retrievers.md +docs/tutorials/retrievers.mdx docs/tutorials/rag.md docs/tutorials/rag.mdx -docs/tutorials/query_analysis.md -docs/tutorials/query_analysis.mdx docs/tutorials/qa_chat_history.md docs/tutorials/qa_chat_history.mdx -docs/tutorials/pdf_qa.md -docs/tutorials/pdf_qa.mdx -docs/tutorials/local_rag.md -docs/tutorials/local_rag.mdx docs/tutorials/llm_chain.md docs/tutorials/llm_chain.mdx docs/tutorials/graph.md @@ -54,8 +54,6 @@ docs/tutorials/classification.md docs/tutorials/classification.mdx docs/tutorials/chatbot.md docs/tutorials/chatbot.mdx -docs/concepts/t.md -docs/concepts/t.mdx docs/how_to/trim_messages.md docs/how_to/trim_messages.mdx docs/how_to/tools_prompting.md @@ -218,6 +216,8 @@ docs/how_to/assign.md docs/how_to/assign.mdx docs/how_to/agent_executor.md docs/how_to/agent_executor.mdx +docs/concepts/t.md +docs/concepts/t.mdx docs/versions/migrating_memory/conversation_summary_memory.md docs/versions/migrating_memory/conversation_summary_memory.mdx docs/versions/migrating_memory/conversation_buffer_window_memory.md @@ -226,6 +226,12 @@ docs/versions/migrating_memory/chat_history.md docs/versions/migrating_memory/chat_history.mdx docs/troubleshooting/errors/INVALID_TOOL_RESULTS.md docs/troubleshooting/errors/INVALID_TOOL_RESULTS.mdx +docs/integrations/toolkits/vectorstore.md +docs/integrations/toolkits/vectorstore.mdx +docs/integrations/toolkits/sql.md +docs/integrations/toolkits/sql.mdx +docs/integrations/toolkits/openapi.md +docs/integrations/toolkits/openapi.mdx docs/integrations/vectorstores/weaviate.md docs/integrations/vectorstores/weaviate.mdx docs/integrations/vectorstores/upstash.md @@ -252,22 +258,10 @@ docs/integrations/vectorstores/elasticsearch.md docs/integrations/vectorstores/elasticsearch.mdx docs/integrations/vectorstores/chroma.md docs/integrations/vectorstores/chroma.mdx -docs/integrations/tools/tavily_search.md -docs/integrations/tools/tavily_search.mdx -docs/integrations/tools/serpapi.md -docs/integrations/tools/serpapi.mdx -docs/integrations/tools/google_scholar.md -docs/integrations/tools/google_scholar.mdx -docs/integrations/tools/exa_search.md -docs/integrations/tools/exa_search.mdx -docs/integrations/tools/duckduckgo_search.md -docs/integrations/tools/duckduckgo_search.mdx -docs/integrations/toolkits/vectorstore.md -docs/integrations/toolkits/vectorstore.mdx -docs/integrations/toolkits/sql.md -docs/integrations/toolkits/sql.mdx -docs/integrations/toolkits/openapi.md -docs/integrations/toolkits/openapi.mdx +docs/integrations/stores/in_memory.md +docs/integrations/stores/in_memory.mdx +docs/integrations/stores/file_system.md +docs/integrations/stores/file_system.mdx docs/integrations/text_embedding/togetherai.md docs/integrations/text_embedding/togetherai.mdx docs/integrations/text_embedding/pinecone.md @@ -290,14 +284,12 @@ docs/integrations/text_embedding/cohere.md docs/integrations/text_embedding/cohere.mdx docs/integrations/text_embedding/cloudflare_ai.md docs/integrations/text_embedding/cloudflare_ai.mdx +docs/integrations/text_embedding/bytedance_doubao.md +docs/integrations/text_embedding/bytedance_doubao.mdx docs/integrations/text_embedding/bedrock.md docs/integrations/text_embedding/bedrock.mdx docs/integrations/text_embedding/azure_openai.md docs/integrations/text_embedding/azure_openai.mdx -docs/integrations/stores/in_memory.md -docs/integrations/stores/in_memory.mdx -docs/integrations/stores/file_system.md -docs/integrations/stores/file_system.mdx docs/integrations/retrievers/tavily.md docs/integrations/retrievers/tavily.mdx docs/integrations/retrievers/kendra-retriever.md @@ -360,6 +352,8 @@ docs/integrations/chat/cohere.md docs/integrations/chat/cohere.mdx docs/integrations/chat/cloudflare_workersai.md docs/integrations/chat/cloudflare_workersai.mdx +docs/integrations/chat/cerebras.md +docs/integrations/chat/cerebras.mdx docs/integrations/chat/bedrock_converse.md docs/integrations/chat/bedrock_converse.mdx docs/integrations/chat/bedrock.md @@ -370,6 +364,16 @@ docs/integrations/chat/arcjet.md docs/integrations/chat/arcjet.mdx docs/integrations/chat/anthropic.md docs/integrations/chat/anthropic.mdx +docs/integrations/tools/tavily_search.md +docs/integrations/tools/tavily_search.mdx +docs/integrations/tools/serpapi.md +docs/integrations/tools/serpapi.mdx +docs/integrations/tools/google_scholar.md +docs/integrations/tools/google_scholar.mdx +docs/integrations/tools/exa_search.md +docs/integrations/tools/exa_search.mdx +docs/integrations/tools/duckduckgo_search.md +docs/integrations/tools/duckduckgo_search.mdx docs/integrations/retrievers/self_query/weaviate.md docs/integrations/retrievers/self_query/weaviate.mdx docs/integrations/retrievers/self_query/vectara.md @@ -386,6 +390,16 @@ docs/integrations/retrievers/self_query/hnswlib.md docs/integrations/retrievers/self_query/hnswlib.mdx docs/integrations/retrievers/self_query/chroma.md docs/integrations/retrievers/self_query/chroma.mdx +docs/integrations/document_loaders/file_loaders/unstructured.md +docs/integrations/document_loaders/file_loaders/unstructured.mdx +docs/integrations/document_loaders/file_loaders/text.md +docs/integrations/document_loaders/file_loaders/text.mdx +docs/integrations/document_loaders/file_loaders/pdf.md +docs/integrations/document_loaders/file_loaders/pdf.mdx +docs/integrations/document_loaders/file_loaders/directory.md +docs/integrations/document_loaders/file_loaders/directory.mdx +docs/integrations/document_loaders/file_loaders/csv.md +docs/integrations/document_loaders/file_loaders/csv.mdx docs/integrations/document_loaders/web_loaders/web_puppeteer.md docs/integrations/document_loaders/web_loaders/web_puppeteer.mdx docs/integrations/document_loaders/web_loaders/web_cheerio.md @@ -397,14 +411,4 @@ docs/integrations/document_loaders/web_loaders/pdf.mdx docs/integrations/document_loaders/web_loaders/langsmith.md docs/integrations/document_loaders/web_loaders/langsmith.mdx docs/integrations/document_loaders/web_loaders/firecrawl.md -docs/integrations/document_loaders/web_loaders/firecrawl.mdx -docs/integrations/document_loaders/file_loaders/unstructured.md -docs/integrations/document_loaders/file_loaders/unstructured.mdx -docs/integrations/document_loaders/file_loaders/text.md -docs/integrations/document_loaders/file_loaders/text.mdx -docs/integrations/document_loaders/file_loaders/pdf.md -docs/integrations/document_loaders/file_loaders/pdf.mdx -docs/integrations/document_loaders/file_loaders/directory.md -docs/integrations/document_loaders/file_loaders/directory.mdx -docs/integrations/document_loaders/file_loaders/csv.md -docs/integrations/document_loaders/file_loaders/csv.mdx \ No newline at end of file +docs/integrations/document_loaders/web_loaders/firecrawl.mdx \ No newline at end of file diff --git a/docs/core_docs/docs/integrations/text_embedding/bytedance_doubao.ipynb b/docs/core_docs/docs/integrations/text_embedding/bytedance_doubao.ipynb new file mode 100644 index 000000000000..f5f8fcaee35d --- /dev/null +++ b/docs/core_docs/docs/integrations/text_embedding/bytedance_doubao.ipynb @@ -0,0 +1,309 @@ +{ + "cells": [ + { + "cell_type": "raw", + "id": "afaf8039", + "metadata": { + "vscode": { + "languageId": "raw" + } + }, + "source": [ + "---\n", + "sidebar_label: ByteDance Doubao\n", + "---" + ] + }, + { + "cell_type": "markdown", + "id": "9a3d6f34", + "metadata": {}, + "source": [ + "# ByteDanceDoubaoEmbeddings\n", + "\n", + "This will help you get started with ByteDanceDoubao [embedding models](/docs/concepts/embedding_models) using LangChain. For detailed documentation on `ByteDanceDoubaoEmbeddings` features and configuration options, please refer to the [API reference](https://api.js.langchain.com/classes/_langchain_community.embeddings_bytedance_doubao.ByteDanceDoubaoEmbeddings.html).\n", + "\n", + "## Overview\n", + "### Integration details\n", + "\n", + "| Class | Package | Local | Py support | Package downloads | Package latest |\n", + "| :--- | :--- | :---: | :---: | :---: | :---: |\n", + "| [ByteDanceDoubaoEmbeddings](https://api.js.langchain.com/classes/_langchain_community.embeddings_bytedance_doubao.ByteDanceDoubaoEmbeddings.html) | [@langchain/community](https://api.js.langchain.com/modules/_langchain_community.html) | ❌ | ❌ | ![NPM - Downloads](https://img.shields.io/npm/dm/@langchain/community?style=flat-square&label=%20&) | ![NPM - Version](https://img.shields.io/npm/v/@langchain/community?style=flat-square&label=%20&) |\n", + "\n", + "## Setup\n", + "\n", + "You'll need to sign up for an [ARK API key](https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey) and set it as an environment variable named `ARK_API_KEY`. Then you should [create a entrypoint](https://console.volcengine.com/ark/region:ark+cn-beijing/endpoint) for embedding models, and use the entrypoint's name as `model`.\n", + "\n", + "Then, you'll need to install the [`@langchain/community`](https://www.npmjs.com/package/@langchain/community) package\n", + "\n", + "### Credentials\n", + "\n", + "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", + "\n", + "```bash\n", + "# export LANGCHAIN_TRACING_V2=\"true\"\n", + "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "```\n", + "\n", + "### Installation\n", + "\n", + "The LangChain ByteDanceDoubaoEmbeddings integration lives in the `@langchain/community` package:\n", + "\n", + "```{=mdx}\n", + "import IntegrationInstallTooltip from \"@mdx_components/integration_install_tooltip.mdx\";\n", + "import Npm2Yarn from \"@theme/Npm2Yarn\";\n", + "\n", + "\n", + "\n", + "\n", + " @langchain/community\n", + "\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "45dd1724", + "metadata": {}, + "source": [ + "## Instantiation\n", + "\n", + "Now we can instantiate our model object and embed text:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "9ea7a09b", + "metadata": {}, + "outputs": [], + "source": [ + "import { ByteDanceDoubaoEmbeddings } from \"@langchain/community/embeddings/bytedance_doubao\";\n", + "\n", + "const embeddings = new ByteDanceDoubaoEmbeddings({\n", + " model: 'ep-xxx-xxx' // your entrypoint's name\n", + "});" + ] + }, + { + "cell_type": "markdown", + "id": "77d271b6", + "metadata": {}, + "source": [ + "## Indexing and Retrieval\n", + "\n", + "Embedding models are often used in retrieval-augmented generation (RAG) flows, both as part of indexing data as well as later retrieving it. For more detailed instructions, please see our RAG tutorials under the [working with external knowledge tutorials](/docs/tutorials/#working-with-external-knowledge).\n", + "\n", + "Below, see how to index and retrieve data using the `embeddings` object we initialized above. In this example, we will index and retrieve a sample document using the demo [`MemoryVectorStore`](/docs/integrations/vectorstores/memory)." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "d817716b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "LangChain is the framework for building context-aware reasoning applications\n" + ] + } + ], + "source": [ + "// Create a vector store with a sample text\n", + "import { MemoryVectorStore } from \"langchain/vectorstores/memory\";\n", + "\n", + "const text = \"LangChain is the framework for building context-aware reasoning applications\";\n", + "\n", + "const vectorstore = await MemoryVectorStore.fromDocuments(\n", + " [{ pageContent: text, metadata: {} }],\n", + " embeddings,\n", + ");\n", + "\n", + "// Use the vector store as a retriever that returns a single document\n", + "const retriever = vectorstore.asRetriever(1);\n", + "\n", + "// Retrieve the most similar text\n", + "const retrievedDocuments = await retriever.invoke(\"What is LangChain?\");\n", + "\n", + "retrievedDocuments[0].pageContent;" + ] + }, + { + "cell_type": "markdown", + "id": "e02b9855", + "metadata": {}, + "source": [ + "## Direct Usage\n", + "\n", + "Under the hood, the vectorstore and retriever implementations are calling `embeddings.embedDocument(...)` and `embeddings.embedQuery(...)` to create embeddings for the text(s) used in `fromDocuments` and the retriever's `invoke` operations, respectively.\n", + "\n", + "You can directly call these methods to get embeddings for your own use cases.\n", + "\n", + "### Embed single texts\n", + "\n", + "You can embed queries for search with `embedQuery`. This generates a vector representation specific to the query:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "0d2befcd", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\n", + " 0.026051683, 0.029081265, -0.040726297, -0.015116953, -0.010691089,\n", + " 0.030181013, -0.0065084146, -0.02079503, 0.013575795, 0.03452527,\n", + " 0.009578291, 0.007026421, -0.030110886, 0.013489622, -0.04294787,\n", + " 0.011141899, -0.043768786, -0.00362867, -0.0081198225, -0.03426076,\n", + " 0.010075142, 0.027787417, -0.09052663, -0.06039698, -0.009462592,\n", + " 0.06232288, 0.051121354, 0.011977532, 0.089046724, 0.059000008,\n", + " 0.031860664, -0.034242127, 0.020339863, 0.011483523, -0.05429335,\n", + " -0.04963588, 0.03263794, -0.05581542, 0.013908403, -0.012356067,\n", + " -0.007802118, -0.010027855, 0.00281217, -0.101886116, -0.079341754,\n", + " 0.011269771, 0.0035983133, -0.027667878, 0.032092705, -0.052843474,\n", + " -0.045283325, 0.0382421, 0.0193055, 0.011050924, 0.021132186,\n", + " -0.037696265, 0.0006107435, 0.0043520257, -0.028798066, 0.049155913,\n", + " 0.03590549, -0.0040995986, 0.019772101, -0.076119535, 0.0031298609,\n", + " 0.03368174, 0.039398745, -0.011813277, -0.019313531, -0.013108803,\n", + " -0.044905286, -0.022326004, -0.01656178, -0.06658457, 0.016789088,\n", + " 0.049952697, 0.006615693, -0.01694402, -0.018105473, 0.0049101883,\n", + " -0.004966945, 0.049762275, -0.03556957, -0.015986584, -0.03190983,\n", + " -0.05336687, -0.0020468342, -0.0016106658, -0.035291273, -0.029783724,\n", + " -0.010153295, 0.052100364, 0.05528949, 0.01379487, -0.024542747,\n", + " 0.028773975, 0.010087022, 0.030448131, -0.042391222, 0.016596776\n", + "]\n" + ] + } + ], + "source": [ + "const singleVector = await embeddings.embedQuery(text);\n", + "\n", + "console.log(singleVector.slice(0, 100));" + ] + }, + { + "cell_type": "markdown", + "id": "1b5a7d03", + "metadata": {}, + "source": [ + "### Embed multiple texts\n", + "\n", + "You can embed multiple texts for indexing with `embedDocuments`. The internals used for this method may (but do not have to) differ from embedding queries:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "2f4d6e97", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\n", + " 0.026051683, 0.029081265, -0.040726297, -0.015116953, -0.010691089,\n", + " 0.030181013, -0.0065084146, -0.02079503, 0.013575795, 0.03452527,\n", + " 0.009578291, 0.007026421, -0.030110886, 0.013489622, -0.04294787,\n", + " 0.011141899, -0.043768786, -0.00362867, -0.0081198225, -0.03426076,\n", + " 0.010075142, 0.027787417, -0.09052663, -0.06039698, -0.009462592,\n", + " 0.06232288, 0.051121354, 0.011977532, 0.089046724, 0.059000008,\n", + " 0.031860664, -0.034242127, 0.020339863, 0.011483523, -0.05429335,\n", + " -0.04963588, 0.03263794, -0.05581542, 0.013908403, -0.012356067,\n", + " -0.007802118, -0.010027855, 0.00281217, -0.101886116, -0.079341754,\n", + " 0.011269771, 0.0035983133, -0.027667878, 0.032092705, -0.052843474,\n", + " -0.045283325, 0.0382421, 0.0193055, 0.011050924, 0.021132186,\n", + " -0.037696265, 0.0006107435, 0.0043520257, -0.028798066, 0.049155913,\n", + " 0.03590549, -0.0040995986, 0.019772101, -0.076119535, 0.0031298609,\n", + " 0.03368174, 0.039398745, -0.011813277, -0.019313531, -0.013108803,\n", + " -0.044905286, -0.022326004, -0.01656178, -0.06658457, 0.016789088,\n", + " 0.049952697, 0.006615693, -0.01694402, -0.018105473, 0.0049101883,\n", + " -0.004966945, 0.049762275, -0.03556957, -0.015986584, -0.03190983,\n", + " -0.05336687, -0.0020468342, -0.0016106658, -0.035291273, -0.029783724,\n", + " -0.010153295, 0.052100364, 0.05528949, 0.01379487, -0.024542747,\n", + " 0.028773975, 0.010087022, 0.030448131, -0.042391222, 0.016596776\n", + "]\n", + "[\n", + " 0.0558515, 0.028698817, -0.037476595, 0.0048659276, -0.019229038,\n", + " -0.04713716, -0.020947812, -0.017550547, 0.01205507, 0.027693441,\n", + " -0.011791304, 0.009862203, 0.019662278, -0.037511427, -0.022662448,\n", + " 0.036224432, -0.051760387, -0.030165697, -0.008899774, -0.024518963,\n", + " 0.010077767, 0.032209765, -0.0854303, -0.038666975, -0.036021013,\n", + " 0.060899545, 0.045867186, 0.003365381, 0.09387081, 0.038216405,\n", + " 0.011449426, -0.016495887, 0.020602569, -0.02368503, -0.014733645,\n", + " -0.065408126, -0.0065152845, -0.027103946, 0.00038956117, -0.08648814,\n", + " 0.029316466, -0.054449145, 0.034129277, -0.055225655, -0.043182302,\n", + " 0.0011148591, 0.044116337, -0.046552557, 0.032423045, -0.03269365,\n", + " -0.05062933, 0.021473562, -0.011019348, -0.019621233, -0.0003149565,\n", + " -0.0046085776, 0.0052610254, -0.0029293327, -0.035793293, 0.034469575,\n", + " 0.037724957, 0.009572597, 0.014198464, -0.0878237, 0.0056973165,\n", + " 0.023563445, 0.030928325, 0.025520306, 0.01836824, -0.016456697,\n", + " -0.061934732, 0.009764942, -0.035812028, -0.04429064, 0.031323086,\n", + " 0.056027107, -0.0019782048, -0.015204176, -0.008684945, -0.0010460864,\n", + " 0.054642987, 0.044149086, -0.032964867, -0.012044753, -0.019075096,\n", + " -0.027932597, 0.018542245, -0.02602878, -0.04645578, -0.020976603,\n", + " 0.018999187, 0.050663687, 0.016725155, 0.0076955976, 0.011448177,\n", + " 0.053931057, -0.03234989, 0.024429373, -0.023123834, 0.02197912\n", + "]\n" + ] + } + ], + "source": [ + "const text2 = \"LangGraph is a library for building stateful, multi-actor applications with LLMs\";\n", + "\n", + "const vectors = await embeddings.embedDocuments([text, text2]);\n", + "\n", + "console.log(vectors[0].slice(0, 100));\n", + "console.log(vectors[1].slice(0, 100));" + ] + }, + { + "cell_type": "markdown", + "id": "b48d41bb", + "metadata": {}, + "source": [ + "## Related\n", + "\n", + "- Embedding model [conceptual guide](/docs/concepts/embedding_models)\n", + "- Embedding model [how-to guides](/docs/how_to/#embedding-models)" + ] + }, + { + "cell_type": "markdown", + "id": "eacd89fe", + "metadata": {}, + "source": [ + "## API reference\n", + "\n", + "For detailed documentation of all ByteDanceDoubaoEmbeddings features and configurations head to the API reference: https://api.js.langchain.com/classes/_langchain_community.embeddings_bytedance_doubao.ByteDanceDoubaoEmbeddings.html" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "TypeScript", + "language": "typescript", + "name": "tslab" + }, + "language_info": { + "codemirror_mode": { + "mode": "typescript", + "name": "javascript", + "typescript": true + }, + "file_extension": ".ts", + "mimetype": "text/typescript", + "name": "typescript", + "version": "3.7.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples/.env.example b/examples/.env.example index 9aae33991e92..83a320555978 100644 --- a/examples/.env.example +++ b/examples/.env.example @@ -84,7 +84,8 @@ HANA_HOST=HANA_DB_ADDRESS HANA_PORT=HANA_DB_PORT HANA_UID=HANA_DB_USER HANA_PWD=HANA_DB_PASSWORD +ARK_API_KEY=ADD_YOURS_HERE # https://console.volcengine.com/ JIRA_HOST=ADD_YOURS_HERE JIRA_USERNAME=ADD_YOURS_HERE JIRA_ACCESS_TOKEN=ADD_YOURS_HERE -JIRA_PROJECT_KEY=ADD_YOURS_HERE \ No newline at end of file +JIRA_PROJECT_KEY=ADD_YOURS_HERE diff --git a/examples/src/embeddings/bytedance_doubao.ts b/examples/src/embeddings/bytedance_doubao.ts new file mode 100644 index 000000000000..a7a669decb6b --- /dev/null +++ b/examples/src/embeddings/bytedance_doubao.ts @@ -0,0 +1,9 @@ +import { ByteDanceDoubaoEmbeddings } from "@langchain/community/embeddings/bytedance_doubao"; + +const model = new ByteDanceDoubaoEmbeddings({ + model: "ep-xxx-xxx", +}); +const res = await model.embedQuery( + "What would be a good company name a company that makes colorful socks?" +); +console.log({ res }); diff --git a/libs/langchain-community/.gitignore b/libs/langchain-community/.gitignore index b1cef6d2c9fb..49f87dc328fb 100644 --- a/libs/langchain-community/.gitignore +++ b/libs/langchain-community/.gitignore @@ -146,6 +146,10 @@ embeddings/bedrock.cjs embeddings/bedrock.js embeddings/bedrock.d.ts embeddings/bedrock.d.cts +embeddings/bytedance_doubao.cjs +embeddings/bytedance_doubao.js +embeddings/bytedance_doubao.d.ts +embeddings/bytedance_doubao.d.cts embeddings/cloudflare_workersai.cjs embeddings/cloudflare_workersai.js embeddings/cloudflare_workersai.d.ts diff --git a/libs/langchain-community/langchain.config.js b/libs/langchain-community/langchain.config.js index 46853f88792b..dc58963eed75 100644 --- a/libs/langchain-community/langchain.config.js +++ b/libs/langchain-community/langchain.config.js @@ -72,6 +72,7 @@ export const config = { "embeddings/alibaba_tongyi": "embeddings/alibaba_tongyi", "embeddings/baidu_qianfan": "embeddings/baidu_qianfan", "embeddings/bedrock": "embeddings/bedrock", + "embeddings/bytedance_doubao": "embeddings/bytedance_doubao", "embeddings/cloudflare_workersai": "embeddings/cloudflare_workersai", "embeddings/cohere": "embeddings/cohere", "embeddings/deepinfra": "embeddings/deepinfra", diff --git a/libs/langchain-community/package.json b/libs/langchain-community/package.json index 7632c8e7bcbf..56af665d9fa9 100644 --- a/libs/langchain-community/package.json +++ b/libs/langchain-community/package.json @@ -1051,6 +1051,15 @@ "import": "./embeddings/bedrock.js", "require": "./embeddings/bedrock.cjs" }, + "./embeddings/bytedance_doubao": { + "types": { + "import": "./embeddings/bytedance_doubao.d.ts", + "require": "./embeddings/bytedance_doubao.d.cts", + "default": "./embeddings/bytedance_doubao.d.ts" + }, + "import": "./embeddings/bytedance_doubao.js", + "require": "./embeddings/bytedance_doubao.cjs" + }, "./embeddings/cloudflare_workersai": { "types": { "import": "./embeddings/cloudflare_workersai.d.ts", @@ -3336,6 +3345,10 @@ "embeddings/bedrock.js", "embeddings/bedrock.d.ts", "embeddings/bedrock.d.cts", + "embeddings/bytedance_doubao.cjs", + "embeddings/bytedance_doubao.js", + "embeddings/bytedance_doubao.d.ts", + "embeddings/bytedance_doubao.d.cts", "embeddings/cloudflare_workersai.cjs", "embeddings/cloudflare_workersai.js", "embeddings/cloudflare_workersai.d.ts", diff --git a/libs/langchain-community/src/embeddings/bytedance_doubao.ts b/libs/langchain-community/src/embeddings/bytedance_doubao.ts new file mode 100644 index 000000000000..d542bc14c989 --- /dev/null +++ b/libs/langchain-community/src/embeddings/bytedance_doubao.ts @@ -0,0 +1,176 @@ +import { getEnvironmentVariable } from "@langchain/core/utils/env"; +import { Embeddings, type EmbeddingsParams } from "@langchain/core/embeddings"; +import { chunkArray } from "@langchain/core/utils/chunk_array"; + +export interface ByteDanceDoubaoEmbeddingsParams extends EmbeddingsParams { + /** Model name to use */ + model: string; + + /** + * Timeout to use when making requests to ByteDanceDoubao. + */ + timeout?: number; + + /** + * The maximum number of documents to embed in a single request. This is + * limited by the ByteDanceDoubao API to a maximum of 2048. + */ + batchSize?: number; + + /** + * Whether to strip new lines from the input text. + */ + stripNewLines?: boolean; +} + +interface EmbeddingCreateParams { + model: ByteDanceDoubaoEmbeddingsParams["model"]; + input: string[]; + encoding_format?: "float"; +} + +interface EmbeddingResponse { + data: { + index: number; + embedding: number[]; + }[]; + + usage: { + prompt_tokens: number; + total_tokens: number; + }; + + id: string; +} + +interface EmbeddingErrorResponse { + type: string; + code: string; + param: string; + message: string; +} + +export class ByteDanceDoubaoEmbeddings + extends Embeddings + implements ByteDanceDoubaoEmbeddingsParams +{ + model: string; + + batchSize = 24; + + stripNewLines = true; + + apiKey: string; + + constructor( + fields?: Partial & { + verbose?: boolean; + apiKey?: string; + } + ) { + const fieldsWithDefaults = { maxConcurrency: 2, ...fields }; + super(fieldsWithDefaults); + + const apiKey = + fieldsWithDefaults?.apiKey ?? getEnvironmentVariable("ARK_API_KEY"); + + if (!apiKey) throw new Error("ByteDanceDoubao API key not found"); + + this.apiKey = apiKey; + + this.model = fieldsWithDefaults?.model ?? this.model; + this.batchSize = fieldsWithDefaults?.batchSize ?? this.batchSize; + this.stripNewLines = + fieldsWithDefaults?.stripNewLines ?? this.stripNewLines; + } + + /** + * Method to generate embeddings for an array of documents. Splits the + * documents into batches and makes requests to the ByteDanceDoubao API to generate + * embeddings. + * @param texts Array of documents to generate embeddings for. + * @returns Promise that resolves to a 2D array of embeddings for each document. + */ + async embedDocuments(texts: string[]): Promise { + const batches = chunkArray( + this.stripNewLines ? texts.map((t) => t.replace(/\n/g, " ")) : texts, + this.batchSize + ); + const batchRequests = batches.map((batch) => { + const params = this.getParams(batch); + + return this.embeddingWithRetry(params); + }); + + const batchResponses = await Promise.all(batchRequests); + const embeddings: number[][] = []; + + for (let i = 0; i < batchResponses.length; i += 1) { + const batch = batches[i]; + const batchResponse = batchResponses[i] || []; + for (let j = 0; j < batch.length; j += 1) { + embeddings.push(batchResponse[j]); + } + } + + return embeddings; + } + + /** + * Method to generate an embedding for a single document. Calls the + * embeddingWithRetry method with the document as the input. + * @param text Document to generate an embedding for. + * @returns Promise that resolves to an embedding for the document. + */ + async embedQuery(text: string): Promise { + const params = this.getParams([ + this.stripNewLines ? text.replace(/\n/g, " ") : text, + ]); + + const embeddings = (await this.embeddingWithRetry(params)) || [[]]; + return embeddings[0]; + } + + /** + * Method to generate an embedding params. + * @param texts Array of documents to generate embeddings for. + * @returns an embedding params. + */ + private getParams( + texts: EmbeddingCreateParams["input"] + ): EmbeddingCreateParams { + return { + model: this.model, + input: texts, + }; + } + + /** + * Private method to make a request to the OpenAI API to generate + * embeddings. Handles the retry logic and returns the response from the + * API. + * @param request Request to send to the OpenAI API. + * @returns Promise that resolves to the response from the API. + */ + private async embeddingWithRetry(body: EmbeddingCreateParams) { + return fetch("https://ark.cn-beijing.volces.com/api/v3/embeddings", { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.apiKey}`, + }, + body: JSON.stringify(body), + }).then(async (response) => { + const embeddingData: EmbeddingResponse | EmbeddingErrorResponse = + await response.json(); + + if ("code" in embeddingData && embeddingData.code) { + throw new Error(`${embeddingData.code}: ${embeddingData.message}`); + } + + return (embeddingData as EmbeddingResponse).data.map( + ({ embedding }) => embedding + ); + }); + } +} diff --git a/libs/langchain-community/src/embeddings/tests/bytedance_doubao.int.test.ts b/libs/langchain-community/src/embeddings/tests/bytedance_doubao.int.test.ts new file mode 100644 index 000000000000..f584e1dfbba2 --- /dev/null +++ b/libs/langchain-community/src/embeddings/tests/bytedance_doubao.int.test.ts @@ -0,0 +1,40 @@ +import { test, expect } from "@jest/globals"; +import { ByteDanceDoubaoEmbeddings } from "../bytedance_doubao.js"; + +const modelName = "ep-xxx-xxx"; +test.skip("Test ByteDanceDoubaoEmbeddings.embedQuery", async () => { + const embeddings = new ByteDanceDoubaoEmbeddings({ + model: modelName, + }); + const res = await embeddings.embedQuery("Hello world"); + expect(typeof res[0]).toBe("number"); +}); + +test.skip("Test ByteDanceDoubaoEmbeddings.embedDocuments", async () => { + const embeddings = new ByteDanceDoubaoEmbeddings({ + model: modelName, + }); + const res = await embeddings.embedDocuments(["Hello world", "Bye bye"]); + expect(res).toHaveLength(2); + expect(typeof res[0][0]).toBe("number"); + expect(typeof res[1][0]).toBe("number"); +}); + +test.skip("Test ByteDanceDoubaoEmbeddings concurrency", async () => { + const embeddings = new ByteDanceDoubaoEmbeddings({ + model: modelName, + batchSize: 1, + }); + const res = await embeddings.embedDocuments([ + "Hello world", + "Bye bye", + "Hello world", + "Bye bye", + "Hello world", + "Bye bye", + ]); + expect(res).toHaveLength(6); + expect(res.find((embedding) => typeof embedding[0] !== "number")).toBe( + undefined + ); +}); diff --git a/libs/langchain-community/src/load/import_map.ts b/libs/langchain-community/src/load/import_map.ts index daafa8c76bfa..2f6f5d86660a 100644 --- a/libs/langchain-community/src/load/import_map.ts +++ b/libs/langchain-community/src/load/import_map.ts @@ -27,6 +27,7 @@ export * as agents__toolkits__base from "../agents/toolkits/base.js"; export * as agents__toolkits__connery from "../agents/toolkits/connery/index.js"; export * as embeddings__alibaba_tongyi from "../embeddings/alibaba_tongyi.js"; export * as embeddings__baidu_qianfan from "../embeddings/baidu_qianfan.js"; +export * as embeddings__bytedance_doubao from "../embeddings/bytedance_doubao.js"; export * as embeddings__deepinfra from "../embeddings/deepinfra.js"; export * as embeddings__fireworks from "../embeddings/fireworks.js"; export * as embeddings__minimax from "../embeddings/minimax.js"; From 9121c8d7566015273d5ba01d3e16c598f91becf9 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 10 Jan 2025 14:27:07 -0800 Subject: [PATCH 07/34] release(community): 0.3.24 (#7499) --- libs/langchain-community/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain-community/package.json b/libs/langchain-community/package.json index 56af665d9fa9..aef582d27f8a 100644 --- a/libs/langchain-community/package.json +++ b/libs/langchain-community/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/community", - "version": "0.3.23", + "version": "0.3.24", "description": "Third-party integrations for LangChain.js", "type": "module", "engines": { From 14afbb20bb75156e912820ada6b9aa14a9fa5fe2 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 10 Jan 2025 14:31:42 -0800 Subject: [PATCH 08/34] release(google-vertexai): 0.1.7 (#7500) --- libs/langchain-google-common/package.json | 2 +- libs/langchain-google-gauth/package.json | 4 ++-- libs/langchain-google-vertexai-web/package.json | 4 ++-- libs/langchain-google-vertexai/package.json | 4 ++-- libs/langchain-google-webauth/package.json | 4 ++-- yarn.lock | 14 +++++++------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libs/langchain-google-common/package.json b/libs/langchain-google-common/package.json index 5f32db49fc6a..e4ab360e1969 100644 --- a/libs/langchain-google-common/package.json +++ b/libs/langchain-google-common/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-common", - "version": "0.1.6", + "version": "0.1.7", "description": "Core types and classes for Google services.", "type": "module", "engines": { diff --git a/libs/langchain-google-gauth/package.json b/libs/langchain-google-gauth/package.json index 405415bddab3..9994b543f74a 100644 --- a/libs/langchain-google-gauth/package.json +++ b/libs/langchain-google-gauth/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-gauth", - "version": "0.1.6", + "version": "0.1.7", "description": "Google auth based authentication support for Google services", "type": "module", "engines": { @@ -35,7 +35,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@langchain/google-common": "~0.1.6", + "@langchain/google-common": "~0.1.7", "google-auth-library": "^8.9.0" }, "peerDependencies": { diff --git a/libs/langchain-google-vertexai-web/package.json b/libs/langchain-google-vertexai-web/package.json index 80cbde8a1d85..fa6005348cd2 100644 --- a/libs/langchain-google-vertexai-web/package.json +++ b/libs/langchain-google-vertexai-web/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-vertexai-web", - "version": "0.1.6", + "version": "0.1.7", "description": "LangChain.js support for Google Vertex AI Web", "type": "module", "engines": { @@ -32,7 +32,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@langchain/google-webauth": "~0.1.6" + "@langchain/google-webauth": "~0.1.7" }, "peerDependencies": { "@langchain/core": ">=0.2.21 <0.4.0" diff --git a/libs/langchain-google-vertexai/package.json b/libs/langchain-google-vertexai/package.json index ce1819caefe8..745fabc38f08 100644 --- a/libs/langchain-google-vertexai/package.json +++ b/libs/langchain-google-vertexai/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-vertexai", - "version": "0.1.6", + "version": "0.1.7", "description": "LangChain.js support for Google Vertex AI", "type": "module", "engines": { @@ -32,7 +32,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@langchain/google-gauth": "~0.1.6" + "@langchain/google-gauth": "~0.1.7" }, "peerDependencies": { "@langchain/core": ">=0.2.21 <0.4.0" diff --git a/libs/langchain-google-webauth/package.json b/libs/langchain-google-webauth/package.json index c200748b3e81..e09903da0e96 100644 --- a/libs/langchain-google-webauth/package.json +++ b/libs/langchain-google-webauth/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-webauth", - "version": "0.1.6", + "version": "0.1.7", "description": "Web-based authentication support for Google services", "type": "module", "engines": { @@ -32,7 +32,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@langchain/google-common": "~0.1.6", + "@langchain/google-common": "~0.1.7", "web-auth-library": "^1.0.3" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index 3ea9be9a3510..6fffd3dac526 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12499,7 +12499,7 @@ __metadata: languageName: unknown linkType: soft -"@langchain/google-common@^0.1.0, @langchain/google-common@workspace:*, @langchain/google-common@workspace:libs/langchain-google-common, @langchain/google-common@~0.1.6": +"@langchain/google-common@^0.1.0, @langchain/google-common@workspace:*, @langchain/google-common@workspace:libs/langchain-google-common, @langchain/google-common@~0.1.7": version: 0.0.0-use.local resolution: "@langchain/google-common@workspace:libs/langchain-google-common" dependencies: @@ -12534,13 +12534,13 @@ __metadata: languageName: unknown linkType: soft -"@langchain/google-gauth@workspace:libs/langchain-google-gauth, @langchain/google-gauth@~0.1.6": +"@langchain/google-gauth@workspace:libs/langchain-google-gauth, @langchain/google-gauth@~0.1.7": version: 0.0.0-use.local resolution: "@langchain/google-gauth@workspace:libs/langchain-google-gauth" dependencies: "@jest/globals": ^29.5.0 "@langchain/core": "workspace:*" - "@langchain/google-common": ~0.1.6 + "@langchain/google-common": ~0.1.7 "@langchain/scripts": ">=0.1.0 <0.2.0" "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 @@ -12613,7 +12613,7 @@ __metadata: "@jest/globals": ^29.5.0 "@langchain/core": "workspace:*" "@langchain/google-common": ^0.1.0 - "@langchain/google-webauth": ~0.1.6 + "@langchain/google-webauth": ~0.1.7 "@langchain/scripts": ">=0.1.0 <0.2.0" "@langchain/standard-tests": 0.0.0 "@swc/core": ^1.3.90 @@ -12649,7 +12649,7 @@ __metadata: "@jest/globals": ^29.5.0 "@langchain/core": "workspace:*" "@langchain/google-common": ^0.1.0 - "@langchain/google-gauth": ~0.1.6 + "@langchain/google-gauth": ~0.1.7 "@langchain/scripts": ">=0.1.0 <0.2.0" "@langchain/standard-tests": 0.0.0 "@swc/core": ^1.3.90 @@ -12678,13 +12678,13 @@ __metadata: languageName: unknown linkType: soft -"@langchain/google-webauth@workspace:libs/langchain-google-webauth, @langchain/google-webauth@~0.1.6": +"@langchain/google-webauth@workspace:libs/langchain-google-webauth, @langchain/google-webauth@~0.1.7": version: 0.0.0-use.local resolution: "@langchain/google-webauth@workspace:libs/langchain-google-webauth" dependencies: "@jest/globals": ^29.5.0 "@langchain/core": "workspace:*" - "@langchain/google-common": ~0.1.6 + "@langchain/google-common": ~0.1.7 "@langchain/scripts": ">=0.1.0 <0.2.0" "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 From f73e33e2d0205d173b1229b0cb64fd130da3084c Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 10 Jan 2025 14:34:26 -0800 Subject: [PATCH 09/34] release(langchain): 0.3.11 (#7501) --- langchain/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/package.json b/langchain/package.json index 207c846b478f..04e65bbd2fb5 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -1,6 +1,6 @@ { "name": "langchain", - "version": "0.3.10", + "version": "0.3.11", "description": "Typescript bindings for langchain", "type": "module", "engines": { From 7b0dd1e8456effcd3f39f9a14e6110071d16bebc Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Sat, 11 Jan 2025 09:24:32 -0800 Subject: [PATCH 10/34] feat(core,openai): Add support for disable_streaming, set for o1 (#7503) --- .../src/language_models/chat_models.ts | 18 ++++++++++-- libs/langchain-openai/src/chat_models.ts | 4 +++ .../src/tests/chat_models.int.test.ts | 29 ++++++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/langchain-core/src/language_models/chat_models.ts b/langchain-core/src/language_models/chat_models.ts index e80e5cf90886..9ca563a38a04 100644 --- a/langchain-core/src/language_models/chat_models.ts +++ b/langchain-core/src/language_models/chat_models.ts @@ -74,7 +74,18 @@ export type SerializedLLM = { /** * Represents the parameters for a base chat model. */ -export type BaseChatModelParams = BaseLanguageModelParams; +export type BaseChatModelParams = BaseLanguageModelParams & { + /** + * Whether to disable streaming. + * + * If streaming is bypassed, then `stream()` will defer to + * `invoke()`. + * + * - If true, will always bypass streaming case. + * - If false (default), will always use streaming case if available. + */ + disableStreaming?: boolean; +}; /** * Represents the call options for a base chat model. @@ -152,6 +163,8 @@ export abstract class BaseChatModel< // Only ever instantiated in main LangChain lc_namespace = ["langchain", "chat_models", this._llmType()]; + disableStreaming = false; + constructor(fields: BaseChatModelParams) { super(fields); } @@ -220,7 +233,8 @@ export abstract class BaseChatModel< // Subclass check required to avoid double callbacks with default implementation if ( this._streamResponseChunks === - BaseChatModel.prototype._streamResponseChunks + BaseChatModel.prototype._streamResponseChunks || + this.disableStreaming ) { yield this.invoke(input, options); } else { diff --git a/libs/langchain-openai/src/chat_models.ts b/libs/langchain-openai/src/chat_models.ts index 3bd3a4e5ee57..2e04059c2fd4 100644 --- a/libs/langchain-openai/src/chat_models.ts +++ b/libs/langchain-openai/src/chat_models.ts @@ -1223,6 +1223,10 @@ export class ChatOpenAI< this.streamUsage = false; } + if (this.model === "o1") { + this.disableStreaming = true; + } + this.streaming = fields?.streaming ?? false; this.streamUsage = fields?.streamUsage ?? this.streamUsage; diff --git a/libs/langchain-openai/src/tests/chat_models.int.test.ts b/libs/langchain-openai/src/tests/chat_models.int.test.ts index c2588312895c..2fbc484789db 100644 --- a/libs/langchain-openai/src/tests/chat_models.int.test.ts +++ b/libs/langchain-openai/src/tests/chat_models.int.test.ts @@ -1165,7 +1165,7 @@ describe("Audio output", () => { }); }); -test("Can stream o1 requests", async () => { +test("Can stream o1-mini requests", async () => { const model = new ChatOpenAI({ model: "o1-mini", }); @@ -1192,6 +1192,33 @@ test("Can stream o1 requests", async () => { expect(numChunks).toBeGreaterThan(3); }); +test("Doesn't stream o1 requests", async () => { + const model = new ChatOpenAI({ + model: "o1", + }); + const stream = await model.stream( + "Write me a very simple hello world program in Python. Ensure it is wrapped in a function called 'hello_world' and has descriptive comments." + ); + let finalMsg: AIMessageChunk | undefined; + let numChunks = 0; + for await (const chunk of stream) { + finalMsg = finalMsg ? concat(finalMsg, chunk) : chunk; + numChunks += 1; + } + + expect(finalMsg).toBeTruthy(); + if (!finalMsg) { + throw new Error("No final message found"); + } + if (typeof finalMsg.content === "string") { + expect(finalMsg.content.length).toBeGreaterThan(10); + } else { + expect(finalMsg.content.length).toBeGreaterThanOrEqual(1); + } + + expect(numChunks).toBe(1); +}); + test("Allows developer messages with o1", async () => { const model = new ChatOpenAI({ model: "o1", From c90f2e33215b1c46bd0982d1d0c5a0358a4a2526 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Sat, 11 Jan 2025 09:34:29 -0800 Subject: [PATCH 11/34] release(core): 0.3.29 (#7507) --- langchain-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain-core/package.json b/langchain-core/package.json index 6e3ddfc22d88..551d06e6fde9 100644 --- a/langchain-core/package.json +++ b/langchain-core/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/core", - "version": "0.3.28", + "version": "0.3.29", "description": "Core LangChain.js abstractions and schemas", "type": "module", "engines": { From d4dd136e8eeace7d85b2595966e75a482b0daa6f Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Sat, 11 Jan 2025 09:38:20 -0800 Subject: [PATCH 12/34] release(openai): 0.3.17 (#7508) --- libs/langchain-openai/package.json | 4 ++-- .../src/tests/chat_models.int.test.ts | 15 --------------- yarn.lock | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/libs/langchain-openai/package.json b/libs/langchain-openai/package.json index 2d0766a6a4d0..79903f4ef25f 100644 --- a/libs/langchain-openai/package.json +++ b/libs/langchain-openai/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/openai", - "version": "0.3.16", + "version": "0.3.17", "description": "OpenAI integrations for LangChain.js", "type": "module", "engines": { @@ -41,7 +41,7 @@ "zod-to-json-schema": "^3.22.3" }, "peerDependencies": { - "@langchain/core": ">=0.2.26 <0.4.0" + "@langchain/core": ">=0.3.29 <0.4.0" }, "devDependencies": { "@azure/identity": "^4.2.1", diff --git a/libs/langchain-openai/src/tests/chat_models.int.test.ts b/libs/langchain-openai/src/tests/chat_models.int.test.ts index 2fbc484789db..a49c014d5d8a 100644 --- a/libs/langchain-openai/src/tests/chat_models.int.test.ts +++ b/libs/langchain-openai/src/tests/chat_models.int.test.ts @@ -977,17 +977,6 @@ test("populates ID field on AIMessage", async () => { expect(finalChunk?.id?.startsWith("chatcmpl-")).toBe(true); }); -test("Test ChatOpenAI stream method", async () => { - const model = new ChatOpenAI({ model: "o1-mini" }); - const stream = await model.stream("Print hello world."); - const chunks = []; - for await (const chunk of stream) { - console.log(chunk); - chunks.push(chunk); - } - expect(chunks.length).toEqual(1); -}); - describe("Audio output", () => { test("Audio output", async () => { const model = new ChatOpenAI({ @@ -1006,10 +995,6 @@ describe("Audio output", () => { if (!response.additional_kwargs.audio) { throw new Error("Not in additional kwargs"); } - // console.log( - // "response.additional_kwargs.audio", - // response.additional_kwargs.audio - // ); expect(Object.keys(response.additional_kwargs.audio).sort()).toEqual([ "data", "expires_at", diff --git a/yarn.lock b/yarn.lock index 6fffd3dac526..555b99d840c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12999,7 +12999,7 @@ __metadata: zod: ^3.22.4 zod-to-json-schema: ^3.22.3 peerDependencies: - "@langchain/core": ">=0.2.26 <0.4.0" + "@langchain/core": ">=0.3.29 <0.4.0" languageName: unknown linkType: soft From 9cd72c22d9c884e15980b4afbdb0f2770d18ad17 Mon Sep 17 00:00:00 2001 From: ucev Date: Sun, 12 Jan 2025 01:58:59 +0800 Subject: [PATCH 13/34] docs: Closes #7476 (#7506) Co-authored-by: Jacob Lee --- docs/core_docs/docs/integrations/llms/huggingface_inference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core_docs/docs/integrations/llms/huggingface_inference.mdx b/docs/core_docs/docs/integrations/llms/huggingface_inference.mdx index 0ac556b43f0e..020e4e9c8011 100644 --- a/docs/core_docs/docs/integrations/llms/huggingface_inference.mdx +++ b/docs/core_docs/docs/integrations/llms/huggingface_inference.mdx @@ -11,7 +11,7 @@ import UnifiedModelParamsTooltip from "@mdx_components/unified_model_params_tool ```typescript -import { HuggingFaceInference } from "langchain/llms/hf"; +import { HuggingFaceInference } from "@langchain/community/llms/hf"; const model = new HuggingFaceInference({ model: "gpt2", From 46486be51eb1eec50838136cc909099cf8245597 Mon Sep 17 00:00:00 2001 From: ucev Date: Sun, 12 Jan 2025 01:59:32 +0800 Subject: [PATCH 14/34] docs: Closes #7494 (#7504) Co-authored-by: jacoblee93 --- examples/src/document_loaders/notionapi.ts | 8 +++++--- .../src/document_loaders/web/notionapi.ts | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/src/document_loaders/notionapi.ts b/examples/src/document_loaders/notionapi.ts index 25161b1a5b20..cbc534960553 100644 --- a/examples/src/document_loaders/notionapi.ts +++ b/examples/src/document_loaders/notionapi.ts @@ -12,10 +12,12 @@ const pageLoader = new NotionAPILoader({ const splitter = new RecursiveCharacterTextSplitter(); -// A page contents is likely to be more than 1000 characters so it's split into multiple documents (important for vectorization) -const pageDocs = await pageLoader.loadAndSplit(splitter); +// Load the documents +const pageDocs = await pageLoader.load(); +// Split the documents using the text splitter +const splitDocs = await splitter.splitDocuments(pageDocs); -console.log({ pageDocs }); +console.log({ splitDocs }); // Loading a database (each row is a separate document with all properties as metadata) const dbLoader = new NotionAPILoader({ diff --git a/libs/langchain-community/src/document_loaders/web/notionapi.ts b/libs/langchain-community/src/document_loaders/web/notionapi.ts index c9019178b99f..a3529eef1b49 100644 --- a/libs/langchain-community/src/document_loaders/web/notionapi.ts +++ b/libs/langchain-community/src/document_loaders/web/notionapi.ts @@ -89,7 +89,9 @@ export type NotionAPILoaderOptions = { * id: "", * type: "page", * }); - * const pageDocs = await pageLoader.loadAndSplit(); + * const pageDocs = await pageLoader.load(); + * const splitDocs = await splitter.splitDocuments(pageDocs); + * * const dbLoader = new NotionAPILoader({ * clientOptions: { auth: "" }, * id: "", From 55215e4dc22efa2a57ca773deb48976ea6bf9b73 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Mon, 13 Jan 2025 09:30:52 -0800 Subject: [PATCH 15/34] fix(core): Make dispatchCustomEvent not throw if used with no callbacks (#7513) --- langchain-core/src/callbacks/dispatch/web.ts | 16 +++++++--------- .../tests/runnable_stream_events_v2.test.ts | 5 ++++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/langchain-core/src/callbacks/dispatch/web.ts b/langchain-core/src/callbacks/dispatch/web.ts index 35a4694e88e6..22bce061a01c 100644 --- a/langchain-core/src/callbacks/dispatch/web.ts +++ b/langchain-core/src/callbacks/dispatch/web.ts @@ -39,17 +39,11 @@ export async function dispatchCustomEvent( payload: any, config?: RunnableConfig ) { - const callbackManager = await getCallbackManagerForConfig(config); - const parentRunId = callbackManager?.getParentRunId(); - // We want to get the callback manager for the parent run. - // This is a work-around for now to be able to dispatch adhoc events from - // within a tool or a lambda and have the metadata events associated - // with the parent run rather than have a new run id generated for each. - if (callbackManager === undefined || parentRunId === undefined) { + if (config === undefined) { throw new Error( [ "Unable to dispatch a custom event without a parent run id.", - "This function can only be called from within an existing run (e.g.,", + `"dispatchCustomEvent" can only be called from within an existing run (e.g.,`, "inside a tool or a RunnableLambda).", `\n\nIf you continue to see this error, please import from "@langchain/core/callbacks/dispatch/web"`, "and explicitly pass in a config parameter.", @@ -60,7 +54,11 @@ export async function dispatchCustomEvent( ].join(" ") ); } + const callbackManager = await getCallbackManagerForConfig(config); + const parentRunId = callbackManager?.getParentRunId(); // We pass parent id as the current run id here intentionally since events dispatch // from within things like RunnableLambda - await callbackManager.handleCustomEvent?.(name, payload, parentRunId); + if (callbackManager !== undefined && parentRunId !== undefined) { + await callbackManager.handleCustomEvent?.(name, payload, parentRunId); + } } diff --git a/langchain-core/src/runnables/tests/runnable_stream_events_v2.test.ts b/langchain-core/src/runnables/tests/runnable_stream_events_v2.test.ts index e79f4765d20a..10c0e035c955 100644 --- a/langchain-core/src/runnables/tests/runnable_stream_events_v2.test.ts +++ b/langchain-core/src/runnables/tests/runnable_stream_events_v2.test.ts @@ -1950,7 +1950,7 @@ test("Runnable streamEvents method with simple tools", async () => { ]); }); -test("Runnable streamEvents method with a custom event", async () => { +test("Runnable methods with a custom event", async () => { const lambda = RunnableLambda.from( async (params: { x: number; y: string }, config) => { await dispatchCustomEvent("testEvent", { someval: "test" }, config); @@ -1958,6 +1958,9 @@ test("Runnable streamEvents method with a custom event", async () => { return JSON.stringify({ x: params.x, y: params.y }); } ); + // Invoke shouldn't fail + const res = await lambda.invoke({ x: 1, y: "2" }); + expect(res).toEqual(JSON.stringify({ x: 1, y: "2" })); const events = []; const eventStream = await lambda.streamEvents( { x: 1, y: "2" }, From dbda6d0d8a6f2bdc8d962ba6c23f65b7c034f93e Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Mon, 13 Jan 2025 09:54:57 -0800 Subject: [PATCH 16/34] release(core): 0.3.30 (#7514) --- langchain-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain-core/package.json b/langchain-core/package.json index 551d06e6fde9..d101b1fb9e23 100644 --- a/langchain-core/package.json +++ b/langchain-core/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/core", - "version": "0.3.29", + "version": "0.3.30", "description": "Core LangChain.js abstractions and schemas", "type": "module", "engines": { From de6362602c9ff9fd7710976ef65e372843d455b9 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Mon, 13 Jan 2025 14:14:07 -0800 Subject: [PATCH 17/34] fix(core): Add run name for trimMessages (#7517) --- langchain-core/src/messages/tests/message_utils.test.ts | 6 ++++-- langchain-core/src/messages/transformers.ts | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/langchain-core/src/messages/tests/message_utils.test.ts b/langchain-core/src/messages/tests/message_utils.test.ts index 222d9b42372a..9788cbafc4b9 100644 --- a/langchain-core/src/messages/tests/message_utils.test.ts +++ b/langchain-core/src/messages/tests/message_utils.test.ts @@ -431,10 +431,12 @@ describe("trimMessages can trim", () => { "langchain_core", "runnables", ]); - expect("func" in trimmedMessages).toBeTruthy(); + expect("bound" in trimmedMessages).toBeTruthy(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + expect("func" in (trimmedMessages as any).bound).toBeTruthy(); // `func` is protected, so we need to cast it to any to access it // eslint-disable-next-line @typescript-eslint/no-explicit-any - expect(typeof (trimmedMessages as any).func).toBe("function"); + expect(typeof (trimmedMessages as any).bound.func).toBe("function"); }); }); diff --git a/langchain-core/src/messages/transformers.ts b/langchain-core/src/messages/transformers.ts index 81d0d7df6738..15389655d59c 100644 --- a/langchain-core/src/messages/transformers.ts +++ b/langchain-core/src/messages/transformers.ts @@ -643,7 +643,9 @@ export function trimMessages( const trimmerOptions = messagesOrOptions; return RunnableLambda.from((input: BaseMessage[]) => _trimMessagesHelper(input, trimmerOptions) - ); + ).withConfig({ + runName: "trim_messages", + }); } } From 457c8f2ebbf33447b704fa6808843b3a40847994 Mon Sep 17 00:00:00 2001 From: Allen Firstenberg Date: Mon, 13 Jan 2025 17:23:05 -0500 Subject: [PATCH 18/34] fix(google-vertexai): fix bug when not using logprobs (#7515) --- .../src/chat_models.ts | 2 +- .../src/tests/chat_models.test.ts | 75 ++++++++++++++++++- .../src/utils/gemini.ts | 17 ++++- 3 files changed, 89 insertions(+), 5 deletions(-) diff --git a/libs/langchain-google-common/src/chat_models.ts b/libs/langchain-google-common/src/chat_models.ts index a345497c0d8f..75a83d50bf06 100644 --- a/libs/langchain-google-common/src/chat_models.ts +++ b/libs/langchain-google-common/src/chat_models.ts @@ -195,7 +195,7 @@ export abstract class ChatGoogleBase stopSequences: string[] = []; - logprobs: boolean = false; + logprobs: boolean; topLogprobs: number = 0; diff --git a/libs/langchain-google-common/src/tests/chat_models.test.ts b/libs/langchain-google-common/src/tests/chat_models.test.ts index 406e399c12b0..9494f55850eb 100644 --- a/libs/langchain-google-common/src/tests/chat_models.test.ts +++ b/libs/langchain-google-common/src/tests/chat_models.test.ts @@ -1251,7 +1251,80 @@ describe("Mock ChatGoogle - Gemini", () => { expect(record.opts.data.tools[0]).toHaveProperty("googleSearch"); }); - test("7. logprobs", async () => { + test("7. logprobs request true", async () => { + const record: Record = {}; + const projectId = mockId(); + const authOptions: MockClientAuthInfo = { + record, + projectId, + resultFile: "chat-7-mock.json", + }; + + const model = new ChatGoogle({ + authOptions, + modelName: "gemini-1.5-flash-002", + logprobs: true, + topLogprobs: 5, + }); + const result = await model.invoke( + "What are some names for a company that makes fancy socks?" + ); + expect(result).toBeDefined(); + const data = record?.opts?.data; + expect(data).toBeDefined(); + expect(data.generationConfig.responseLogprobs).toEqual(true); + expect(data.generationConfig.logprobs).toEqual(5); + }); + + test("7. logprobs request false", async () => { + const record: Record = {}; + const projectId = mockId(); + const authOptions: MockClientAuthInfo = { + record, + projectId, + resultFile: "chat-7-mock.json", + }; + + const model = new ChatGoogle({ + authOptions, + modelName: "gemini-1.5-flash-002", + logprobs: false, + topLogprobs: 5, + }); + const result = await model.invoke( + "What are some names for a company that makes fancy socks?" + ); + expect(result).toBeDefined(); + const data = record?.opts?.data; + expect(data).toBeDefined(); + expect(data.generationConfig.responseLogprobs).toEqual(false); + expect(data.generationConfig.logprobs).not.toBeDefined(); + }); + + test("7. logprobs request not defined", async () => { + const record: Record = {}; + const projectId = mockId(); + const authOptions: MockClientAuthInfo = { + record, + projectId, + resultFile: "chat-7-mock.json", + }; + + const model = new ChatGoogle({ + authOptions, + modelName: "gemini-1.5-flash-002", + }); + const result = await model.invoke( + "What are some names for a company that makes fancy socks?" + ); + expect(result).toBeDefined(); + const data = record?.opts?.data; + expect(data).toBeDefined(); + expect(data.generationConfig.responseLogprobs).not.toBeDefined(); + expect(data.generationConfig.logprobs).not.toBeDefined(); + }); + + test("7. logprobs response", async () => { const record: Record = {}; const projectId = mockId(); const authOptions: MockClientAuthInfo = { diff --git a/libs/langchain-google-common/src/utils/gemini.ts b/libs/langchain-google-common/src/utils/gemini.ts index 3408ab8e26b6..213160a43b10 100644 --- a/libs/langchain-google-common/src/utils/gemini.ts +++ b/libs/langchain-google-common/src/utils/gemini.ts @@ -1080,7 +1080,7 @@ export function getGeminiAPI(config?: GeminiAPIConfig): GoogleAIAPI { function formatGenerationConfig( parameters: GoogleAIModelRequestParams ): GeminiGenerationConfig { - return { + const ret: GeminiGenerationConfig = { temperature: parameters.temperature, topK: parameters.topK, topP: parameters.topP, @@ -1089,9 +1089,20 @@ export function getGeminiAPI(config?: GeminiAPIConfig): GoogleAIAPI { maxOutputTokens: parameters.maxOutputTokens, stopSequences: parameters.stopSequences, responseMimeType: parameters.responseMimeType, - responseLogprobs: parameters.logprobs, - logprobs: parameters.topLogprobs, }; + + // Add the logprobs if explicitly set + if (typeof parameters.logprobs !== "undefined") { + ret.responseLogprobs = parameters.logprobs; + if ( + parameters.logprobs && + typeof parameters.topLogprobs !== "undefined" + ) { + ret.logprobs = parameters.topLogprobs; + } + } + + return ret; } function formatSafetySettings( From 4daa67340523a335977d71c89a40275dc13ac354 Mon Sep 17 00:00:00 2001 From: Taylor Siviter Date: Mon, 13 Jan 2025 22:31:19 +0000 Subject: [PATCH 19/34] fix(google-common,google-*): fix retryable errors (#7516) --- .../src/tests/chat_models.test.ts | 43 ++++++++++++++++++- .../src/tests/llms.test.ts | 29 ++++++++++++- .../langchain-google-common/src/tests/mock.ts | 9 ++++ .../src/utils/failed_handler.ts | 3 +- 4 files changed, 79 insertions(+), 5 deletions(-) diff --git a/libs/langchain-google-common/src/tests/chat_models.test.ts b/libs/langchain-google-common/src/tests/chat_models.test.ts index 9494f55850eb..3a7a34adcf7d 100644 --- a/libs/langchain-google-common/src/tests/chat_models.test.ts +++ b/libs/langchain-google-common/src/tests/chat_models.test.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { expect, test } from "@jest/globals"; +import { expect, test, jest } from "@jest/globals"; import { AIMessage, BaseMessage, @@ -16,7 +16,13 @@ import { Serialized } from "@langchain/core/load/serializable"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; import { ChatGoogleBase, ChatGoogleBaseInput } from "../chat_models.js"; -import { authOptions, MockClient, MockClientAuthInfo, mockId } from "./mock.js"; +import { + authOptions, + MockClient, + MockClientAuthInfo, + MockClientError, + mockId, +} from "./mock.js"; import { GeminiTool, GoogleAIBaseLLMInput, @@ -169,6 +175,39 @@ describe("Mock ChatGoogle - Gemini", () => { expect(data.systemInstruction).not.toBeDefined(); }); + test("1. Basic request format - retryable request", async () => { + const record: Record = {}; + const projectId = mockId(); + const authOptions: MockClientAuthInfo = { + record, + projectId, + resultFile: "chat-1-mock.json", + }; + const model = new ChatGoogle({ + authOptions, + }); + const messages: BaseMessageLike[] = [ + new HumanMessage("Flip a coin and tell me H for heads and T for tails"), + new AIMessage("H"), + new HumanMessage("Flip it again"), + ]; + + const retryableError = new MockClientError(429); + const requestSpy = jest + .spyOn(MockClient.prototype, "request") + .mockRejectedValueOnce(retryableError); + + await model.invoke(messages); + + expect(record.opts).toBeDefined(); + expect(record.opts.data).toBeDefined(); + const { data } = record.opts; + expect(data.contents).toBeDefined(); + expect(data.contents.length).toEqual(3); + + expect(requestSpy).toHaveBeenCalledTimes(2); + }); + test("1. Invoke request format", async () => { const record: Record = {}; const projectId = mockId(); diff --git a/libs/langchain-google-common/src/tests/llms.test.ts b/libs/langchain-google-common/src/tests/llms.test.ts index ff68b776e844..97a24c8ff221 100644 --- a/libs/langchain-google-common/src/tests/llms.test.ts +++ b/libs/langchain-google-common/src/tests/llms.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from "@jest/globals"; +import { expect, test, jest } from "@jest/globals"; import { BaseMessage, HumanMessageChunk, @@ -10,6 +10,7 @@ import { authOptions, MockClient, MockClientAuthInfo, + MockClientError, mockFile, mockId, } from "./mock.js"; @@ -194,6 +195,32 @@ describe("Mock Google LLM", () => { // console.log("record", JSON.stringify(record, null, 2)); }); + test("1: generateContent - retryable request", async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const record: Record = {}; + const projectId = mockId(); + const authOptions: MockClientAuthInfo = { + record, + projectId, + resultFile: "llm-1-mock.json", + }; + const model = new GoogleLLM({ + authOptions, + }); + + const retryableError = new MockClientError(429); + const requestSpy = jest + .spyOn(MockClient.prototype, "request") + .mockRejectedValueOnce(retryableError); + + const response = await model.invoke("Hello world"); + + expect(response).toEqual( + "1. Sock it to Me!\n2. Heel Yeah Socks\n3. Sole Mates\n4. Happy Soles\n5. Toe-tally Awesome Socks\n6. Sock Appeal\n7. Footsie Wootsies\n8. Thread Heads\n9. Sock Squad\n10. Sock-a-licious\n11. Darn Good Socks\n12. Sockcessories\n13. Sole Searching\n14. Sockstar\n15. Socktopia\n16. Sockology\n17. Elevated Toes\n18. The Urban Sole\n19. The Hippie Sole\n20. Sole Fuel" + ); + expect(requestSpy).toHaveBeenCalledTimes(2); + }); + test("1: invoke", async () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const record: Record = {}; diff --git a/libs/langchain-google-common/src/tests/mock.ts b/libs/langchain-google-common/src/tests/mock.ts index ec400a7dcafa..402925be5eaa 100644 --- a/libs/langchain-google-common/src/tests/mock.ts +++ b/libs/langchain-google-common/src/tests/mock.ts @@ -117,3 +117,12 @@ export class MockClient implements GoogleAbstractedClient { } } } + +export class MockClientError extends Error { + public response: { status: number }; + + constructor(status: number) { + super(); + this.response = { status }; + } +} diff --git a/libs/langchain-google-common/src/utils/failed_handler.ts b/libs/langchain-google-common/src/utils/failed_handler.ts index c649d92bb2e7..9f32cebab7ad 100644 --- a/libs/langchain-google-common/src/utils/failed_handler.ts +++ b/libs/langchain-google-common/src/utils/failed_handler.ts @@ -20,14 +20,13 @@ export function failedAttemptHandler(error: any) { if (status === 0) { // What is this? console.error("failedAttemptHandler", error); + throw error; } // What errors shouldn't be retried? if (STATUS_NO_RETRY.includes(+status)) { throw error; } - - throw error; } export function ensureParams(params?: AsyncCallerParams): AsyncCallerParams { From ff0dc580a71268b098e5ac2ee68b7d98317727ed Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Mon, 13 Jan 2025 14:37:27 -0800 Subject: [PATCH 20/34] release(google-common): 0.1.8 (#7518) --- libs/langchain-google-common/package.json | 2 +- libs/langchain-google-gauth/package.json | 4 ++-- libs/langchain-google-vertexai-web/package.json | 4 ++-- libs/langchain-google-vertexai/package.json | 4 ++-- libs/langchain-google-webauth/package.json | 4 ++-- yarn.lock | 14 +++++++------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libs/langchain-google-common/package.json b/libs/langchain-google-common/package.json index e4ab360e1969..23b7c98f6987 100644 --- a/libs/langchain-google-common/package.json +++ b/libs/langchain-google-common/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-common", - "version": "0.1.7", + "version": "0.1.8", "description": "Core types and classes for Google services.", "type": "module", "engines": { diff --git a/libs/langchain-google-gauth/package.json b/libs/langchain-google-gauth/package.json index 9994b543f74a..c3a762599d74 100644 --- a/libs/langchain-google-gauth/package.json +++ b/libs/langchain-google-gauth/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-gauth", - "version": "0.1.7", + "version": "0.1.8", "description": "Google auth based authentication support for Google services", "type": "module", "engines": { @@ -35,7 +35,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@langchain/google-common": "~0.1.7", + "@langchain/google-common": "~0.1.8", "google-auth-library": "^8.9.0" }, "peerDependencies": { diff --git a/libs/langchain-google-vertexai-web/package.json b/libs/langchain-google-vertexai-web/package.json index fa6005348cd2..c6fdc6baffc9 100644 --- a/libs/langchain-google-vertexai-web/package.json +++ b/libs/langchain-google-vertexai-web/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-vertexai-web", - "version": "0.1.7", + "version": "0.1.8", "description": "LangChain.js support for Google Vertex AI Web", "type": "module", "engines": { @@ -32,7 +32,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@langchain/google-webauth": "~0.1.7" + "@langchain/google-webauth": "~0.1.8" }, "peerDependencies": { "@langchain/core": ">=0.2.21 <0.4.0" diff --git a/libs/langchain-google-vertexai/package.json b/libs/langchain-google-vertexai/package.json index 745fabc38f08..d7602962800c 100644 --- a/libs/langchain-google-vertexai/package.json +++ b/libs/langchain-google-vertexai/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-vertexai", - "version": "0.1.7", + "version": "0.1.8", "description": "LangChain.js support for Google Vertex AI", "type": "module", "engines": { @@ -32,7 +32,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@langchain/google-gauth": "~0.1.7" + "@langchain/google-gauth": "~0.1.8" }, "peerDependencies": { "@langchain/core": ">=0.2.21 <0.4.0" diff --git a/libs/langchain-google-webauth/package.json b/libs/langchain-google-webauth/package.json index e09903da0e96..24eefb9c0448 100644 --- a/libs/langchain-google-webauth/package.json +++ b/libs/langchain-google-webauth/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/google-webauth", - "version": "0.1.7", + "version": "0.1.8", "description": "Web-based authentication support for Google services", "type": "module", "engines": { @@ -32,7 +32,7 @@ "author": "LangChain", "license": "MIT", "dependencies": { - "@langchain/google-common": "~0.1.7", + "@langchain/google-common": "~0.1.8", "web-auth-library": "^1.0.3" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index 555b99d840c7..3f5039ba8eaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12499,7 +12499,7 @@ __metadata: languageName: unknown linkType: soft -"@langchain/google-common@^0.1.0, @langchain/google-common@workspace:*, @langchain/google-common@workspace:libs/langchain-google-common, @langchain/google-common@~0.1.7": +"@langchain/google-common@^0.1.0, @langchain/google-common@workspace:*, @langchain/google-common@workspace:libs/langchain-google-common, @langchain/google-common@~0.1.8": version: 0.0.0-use.local resolution: "@langchain/google-common@workspace:libs/langchain-google-common" dependencies: @@ -12534,13 +12534,13 @@ __metadata: languageName: unknown linkType: soft -"@langchain/google-gauth@workspace:libs/langchain-google-gauth, @langchain/google-gauth@~0.1.7": +"@langchain/google-gauth@workspace:libs/langchain-google-gauth, @langchain/google-gauth@~0.1.8": version: 0.0.0-use.local resolution: "@langchain/google-gauth@workspace:libs/langchain-google-gauth" dependencies: "@jest/globals": ^29.5.0 "@langchain/core": "workspace:*" - "@langchain/google-common": ~0.1.7 + "@langchain/google-common": ~0.1.8 "@langchain/scripts": ">=0.1.0 <0.2.0" "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 @@ -12613,7 +12613,7 @@ __metadata: "@jest/globals": ^29.5.0 "@langchain/core": "workspace:*" "@langchain/google-common": ^0.1.0 - "@langchain/google-webauth": ~0.1.7 + "@langchain/google-webauth": ~0.1.8 "@langchain/scripts": ">=0.1.0 <0.2.0" "@langchain/standard-tests": 0.0.0 "@swc/core": ^1.3.90 @@ -12649,7 +12649,7 @@ __metadata: "@jest/globals": ^29.5.0 "@langchain/core": "workspace:*" "@langchain/google-common": ^0.1.0 - "@langchain/google-gauth": ~0.1.7 + "@langchain/google-gauth": ~0.1.8 "@langchain/scripts": ">=0.1.0 <0.2.0" "@langchain/standard-tests": 0.0.0 "@swc/core": ^1.3.90 @@ -12678,13 +12678,13 @@ __metadata: languageName: unknown linkType: soft -"@langchain/google-webauth@workspace:libs/langchain-google-webauth, @langchain/google-webauth@~0.1.7": +"@langchain/google-webauth@workspace:libs/langchain-google-webauth, @langchain/google-webauth@~0.1.8": version: 0.0.0-use.local resolution: "@langchain/google-webauth@workspace:libs/langchain-google-webauth" dependencies: "@jest/globals": ^29.5.0 "@langchain/core": "workspace:*" - "@langchain/google-common": ~0.1.7 + "@langchain/google-common": ~0.1.8 "@langchain/scripts": ">=0.1.0 <0.2.0" "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 From 7e395cb00a132236d1ad4dcde51371c84dc345e5 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 17 Jan 2025 20:04:09 -0800 Subject: [PATCH 21/34] fix(core): Fix trim messages mutation bug (#7547) --- .../src/messages/tests/message_utils.test.ts | 83 ++++++++++++++++++- langchain-core/src/messages/transformers.ts | 18 ++-- 2 files changed, 93 insertions(+), 8 deletions(-) diff --git a/langchain-core/src/messages/tests/message_utils.test.ts b/langchain-core/src/messages/tests/message_utils.test.ts index 9788cbafc4b9..a570ee478f60 100644 --- a/langchain-core/src/messages/tests/message_utils.test.ts +++ b/langchain-core/src/messages/tests/message_utils.test.ts @@ -4,10 +4,11 @@ import { mergeMessageRuns, trimMessages, } from "../transformers.js"; -import { AIMessage } from "../ai.js"; +import { AIMessage, AIMessageChunk } from "../ai.js"; import { ChatMessage } from "../chat.js"; import { HumanMessage } from "../human.js"; import { SystemMessage } from "../system.js"; +import { ToolMessage } from "../tool.js"; import { BaseMessage } from "../base.js"; import { getBufferString, @@ -187,6 +188,7 @@ describe("trimMessages can trim", () => { defaultMsgSuffixLen; } } + console.log(count); return count; }; @@ -196,6 +198,84 @@ describe("trimMessages can trim", () => { }; }; + it("should not mutate messages if no trimming occurs with strategy last", async () => { + const trimmer = trimMessages({ + maxTokens: 128000, + strategy: "last", + startOn: [HumanMessage], + endOn: [AIMessage, ToolMessage], + tokenCounter: () => 1, + }); + const messages = [ + new HumanMessage({ + content: "Fetch the last 5 emails from Flora Testington's inbox.", + additional_kwargs: {}, + response_metadata: {}, + }), + new AIMessageChunk({ + id: "chatcmpl-abcdefg", + content: "", + additional_kwargs: { + tool_calls: [ + { + function: { + name: "getEmails", + arguments: JSON.stringify({ + inboxName: "flora@foo.org", + amount: 5, + folder: "Inbox", + searchString: null, + from: null, + subject: null, + }), + }, + id: "foobarbaz", + index: 0, + type: "function", + }, + ], + }, + response_metadata: { + usage: {}, + }, + tool_calls: [ + { + name: "getEmails", + args: { + inboxName: "flora@foo.org", + amount: 5, + folder: "Inbox", + searchString: null, + from: null, + subject: null, + }, + id: "foobarbaz", + type: "tool_call", + }, + ], + tool_call_chunks: [ + { + name: "getEmails", + args: '{"inboxName":"flora@foo.org","amount":5,"folder":"Inbox","searchString":null,"from":null,"subject":null,"cc":[],"bcc":[]}', + id: "foobarbaz", + index: 0, + type: "tool_call_chunk", + }, + ], + invalid_tool_calls: [], + }), + new ToolMessage({ + content: "a whole bunch of emails!", + name: "getEmails", + additional_kwargs: {}, + response_metadata: {}, + tool_call_id: "foobarbaz", + }), + ]; + const trimmedMessages = await trimmer.invoke(messages); + expect(trimmedMessages).toEqual(messages); + }); + it("First 30 tokens, not allowing partial messages", async () => { const { messages, dummyTokenCounter } = messagesAndTokenCounterFactory(); const trimmedMessages = await trimMessages(messages, { @@ -319,6 +399,7 @@ describe("trimMessages can trim", () => { it("Last 30 tokens, including system message, allowing partial messages, end on HumanMessage", async () => { const { messages, dummyTokenCounter } = messagesAndTokenCounterFactory(); + console.log(messages); const trimmedMessages = await trimMessages(messages, { maxTokens: 30, tokenCounter: dummyTokenCounter, diff --git a/langchain-core/src/messages/transformers.ts b/langchain-core/src/messages/transformers.ts index 15389655d59c..c96ecd69ce48 100644 --- a/langchain-core/src/messages/transformers.ts +++ b/langchain-core/src/messages/transformers.ts @@ -274,7 +274,7 @@ function _mergeMessageRuns(messages: BaseMessage[]): BaseMessage[] { } const merged: BaseMessage[] = []; for (const msg of messages) { - const curr = msg; // Create a shallow copy of the message + const curr = msg; const last = merged.pop(); if (!last) { merged.push(curr); @@ -861,20 +861,24 @@ async function _lastMaxTokens( ...rest } = options; + // Create a copy of messages to avoid mutation + let messagesCopy = [...messages]; + if (endOn) { const endOnArr = Array.isArray(endOn) ? endOn : [endOn]; while ( - messages && - !_isMessageType(messages[messages.length - 1], endOnArr) + messagesCopy.length > 0 && + !_isMessageType(messagesCopy[messagesCopy.length - 1], endOnArr) ) { - messages.pop(); + messagesCopy = messagesCopy.slice(0, -1); } } - const swappedSystem = includeSystem && messages[0]._getType() === "system"; + const swappedSystem = + includeSystem && messagesCopy[0]?._getType() === "system"; let reversed_ = swappedSystem - ? messages.slice(0, 1).concat(messages.slice(1).reverse()) - : messages.reverse(); + ? messagesCopy.slice(0, 1).concat(messagesCopy.slice(1).reverse()) + : messagesCopy.reverse(); reversed_ = await _firstMaxTokens(reversed_, { ...rest, From a52fde3abea80d7c23b62eff7c4ec4f47423d402 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Fri, 17 Jan 2025 20:12:07 -0800 Subject: [PATCH 22/34] release(core): 0.3.31 (#7548) --- langchain-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain-core/package.json b/langchain-core/package.json index d101b1fb9e23..dc4cfd06d7f4 100644 --- a/langchain-core/package.json +++ b/langchain-core/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/core", - "version": "0.3.30", + "version": "0.3.31", "description": "Core LangChain.js abstractions and schemas", "type": "module", "engines": { From 74c06a5c6a4ed2fd3f6274df2b8b27932db3d36b Mon Sep 17 00:00:00 2001 From: Jacky Chen Date: Sat, 18 Jan 2025 00:02:56 -0500 Subject: [PATCH 23/34] fix(community): Updated Embeddings URL (#7545) --- libs/langchain-community/src/embeddings/togetherai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain-community/src/embeddings/togetherai.ts b/libs/langchain-community/src/embeddings/togetherai.ts index 27b3546873cb..bf06495368c6 100644 --- a/libs/langchain-community/src/embeddings/togetherai.ts +++ b/libs/langchain-community/src/embeddings/togetherai.ts @@ -87,7 +87,7 @@ export class TogetherAIEmbeddings timeout?: number; - private embeddingsAPIUrl = "https://api.together.xyz/api/v1/embeddings"; + private embeddingsAPIUrl = "https://api.together.xyz/v1/embeddings"; constructor(fields?: Partial) { super(fields ?? {}); From 9804d8f41c3938c82c3b8b68622c52cca8945390 Mon Sep 17 00:00:00 2001 From: Mohamed Belhadj Date: Sat, 18 Jan 2025 00:30:25 -0500 Subject: [PATCH 24/34] fix(community): make sure guardrailConfig can be added even with anthropic models (#7542) --- libs/langchain-community/src/utils/bedrock/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/langchain-community/src/utils/bedrock/index.ts b/libs/langchain-community/src/utils/bedrock/index.ts index 9b3203e8ce76..c59692943049 100644 --- a/libs/langchain-community/src/utils/bedrock/index.ts +++ b/libs/langchain-community/src/utils/bedrock/index.ts @@ -284,7 +284,6 @@ export class BedrockLLMInputOutputAdapter { if (tools.length > 0) { inputBody.tools = tools; } - return { ...inputBody, ...modelKwargs }; } else if (provider === "cohere") { const { system, From 904dcadf483083dfb07989c4b9999d23e16b23eb Mon Sep 17 00:00:00 2001 From: Brian Ploetz Date: Sat, 18 Jan 2025 00:31:00 -0500 Subject: [PATCH 25/34] docs: Fix PGVectorStore import in install dependencies (TypeScript) example (#7533) --- docs/core_docs/src/theme/VectorStoreTabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core_docs/src/theme/VectorStoreTabs.js b/docs/core_docs/src/theme/VectorStoreTabs.js index a8ff549e70db..53af6a8a08ef 100644 --- a/docs/core_docs/src/theme/VectorStoreTabs.js +++ b/docs/core_docs/src/theme/VectorStoreTabs.js @@ -54,7 +54,7 @@ const ${vectorStoreVarName} = new MongoDBAtlasVectorSearch(embeddings, { { value: "PGVector", label: "PGVector", - text: `import PGVectorStore from "@langchain/community/vectorstores/pgvector"; + text: `import { PGVectorStore } from "@langchain/community/vectorstores/pgvector"; const ${vectorStoreVarName} = await PGVectorStore.initialize(embeddings, {})`, dependencies: "@langchain/community", From e0e2fc97f9686b3217813d69acdbba44b5668ef7 Mon Sep 17 00:00:00 2001 From: Eduard-Constantin Ibinceanu Date: Sat, 18 Jan 2025 07:31:19 +0200 Subject: [PATCH 26/34] fix(community): Airtable url (#7532) --- libs/langchain-community/src/document_loaders/web/airtable.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain-community/src/document_loaders/web/airtable.ts b/libs/langchain-community/src/document_loaders/web/airtable.ts index be570e7a2759..a4c2367dde64 100644 --- a/libs/langchain-community/src/document_loaders/web/airtable.ts +++ b/libs/langchain-community/src/document_loaders/web/airtable.ts @@ -139,7 +139,7 @@ export class AirtableLoader extends BaseDocumentLoader { private async fetchRecords( body: Record ): Promise { - const url = `${AirtableLoader.BASE_URL}/${this.baseId}/${this.tableId}`; + const url = `${AirtableLoader.BASE_URL}/${this.baseId}/${this.tableId}/listRecords`; try { const response = await fetch(url, { method: "POST", From 9314ef166b23b7f555aa38aeea2fac4de7544b15 Mon Sep 17 00:00:00 2001 From: Jonathan V Date: Sat, 18 Jan 2025 06:31:35 +0100 Subject: [PATCH 27/34] docs: Fix typo in OpenAIModerationChain example (#7528) --- langchain/src/chains/openai_moderation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/src/chains/openai_moderation.ts b/langchain/src/chains/openai_moderation.ts index c1be1dbe911f..1823576f1c78 100644 --- a/langchain/src/chains/openai_moderation.ts +++ b/langchain/src/chains/openai_moderation.ts @@ -27,7 +27,7 @@ export interface OpenAIModerationChainInput * OpenAIModerationChainInput interface. * @example * ```typescript - * const moderation = new ChatOpenAIModerationChain({ throwError: true }); + * const moderation = new OpenAIModerationChain({ throwError: true }); * * const badString = "Bad naughty words from user"; * From e1c82127ad3ff381e4b68f867cf0dc2caad73ee5 Mon Sep 17 00:00:00 2001 From: ucev Date: Sat, 18 Jan 2025 15:52:52 +0800 Subject: [PATCH 28/34] docs: Resolves #7483, resolves #7274 (#7505) Co-authored-by: jacoblee93 --- .../integrations/tools/google_calendar.mdx | 2 +- examples/src/tools/google_calendar.ts | 21 ++++++++++++------- .../src/tools/google_calendar/base.ts | 6 +++--- .../commands/run-create-events.ts | 4 ++-- .../commands/run-view-events.ts | 4 ++-- .../src/tools/tests/google_calendar.test.ts | 8 +++---- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/docs/core_docs/docs/integrations/tools/google_calendar.mdx b/docs/core_docs/docs/integrations/tools/google_calendar.mdx index 14cfa036c75f..c1ba5b19bc12 100644 --- a/docs/core_docs/docs/integrations/tools/google_calendar.mdx +++ b/docs/core_docs/docs/integrations/tools/google_calendar.mdx @@ -25,7 +25,7 @@ import IntegrationInstallTooltip from "@mdx_components/integration_install_toolt ```bash npm2yarn -npm install @langchain/openai @langchain/core +npm install @langchain/openai @langchain/core @langchain/community @langchain/langgraph ``` {ToolExample} diff --git a/examples/src/tools/google_calendar.ts b/examples/src/tools/google_calendar.ts index 6dee71adca24..948af910c161 100644 --- a/examples/src/tools/google_calendar.ts +++ b/examples/src/tools/google_calendar.ts @@ -1,5 +1,5 @@ -import { initializeAgentExecutorWithOptions } from "langchain/agents"; -import { OpenAI } from "@langchain/openai"; +import { createReactAgent } from "@langchain/langgraph/prebuilt"; +import { ChatOpenAI } from "@langchain/openai"; import { Calculator } from "@langchain/community/tools/calculator"; import { GoogleCalendarCreateTool, @@ -7,9 +7,10 @@ import { } from "@langchain/community/tools/google_calendar"; export async function run() { - const model = new OpenAI({ + const model = new ChatOpenAI({ temperature: 0, apiKey: process.env.OPENAI_API_KEY, + model: "gpt-4o-mini", }); const googleCalendarParams = { @@ -31,14 +32,16 @@ export async function run() { new GoogleCalendarViewTool(googleCalendarParams), ]; - const calendarAgent = await initializeAgentExecutorWithOptions(tools, model, { - agentType: "zero-shot-react-description", - verbose: true, + const calendarAgent = createReactAgent({ + llm: model, + tools, }); const createInput = `Create a meeting with John Doe next Friday at 4pm - adding to the agenda of it the result of 99 + 99`; - const createResult = await calendarAgent.invoke({ input: createInput }); + const createResult = await calendarAgent.invoke({ + messages: [{ role: "user", content: createInput }], + }); // Create Result { // output: 'A meeting with John Doe on 29th September at 4pm has been created and the result of 99 + 99 has been added to the agenda.' // } @@ -46,7 +49,9 @@ export async function run() { const viewInput = `What meetings do I have this week?`; - const viewResult = await calendarAgent.invoke({ input: viewInput }); + const viewResult = await calendarAgent.invoke({ + messages: [{ role: "user", content: viewInput }], + }); // View Result { // output: "You have no meetings this week between 8am and 8pm." // } diff --git a/libs/langchain-community/src/tools/google_calendar/base.ts b/libs/langchain-community/src/tools/google_calendar/base.ts index 1f8916e4c2ab..f1962091acf9 100644 --- a/libs/langchain-community/src/tools/google_calendar/base.ts +++ b/libs/langchain-community/src/tools/google_calendar/base.ts @@ -1,7 +1,7 @@ import { google } from "googleapis"; import { Tool } from "@langchain/core/tools"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; -import { BaseLLM } from "@langchain/core/language_models/llms"; +import { BaseLanguageModel } from "@langchain/core/language_models/base"; export interface GoogleCalendarAgentParams { credentials?: { @@ -10,7 +10,7 @@ export interface GoogleCalendarAgentParams { calendarId?: string; }; scopes?: string[]; - model?: BaseLLM; + model?: BaseLanguageModel; } export class GoogleCalendarBase extends Tool { @@ -27,7 +27,7 @@ export class GoogleCalendarBase extends Tool { protected scopes: string[]; - protected llm: BaseLLM; + protected llm: BaseLanguageModel; constructor( fields: GoogleCalendarAgentParams = { diff --git a/libs/langchain-community/src/tools/google_calendar/commands/run-create-events.ts b/libs/langchain-community/src/tools/google_calendar/commands/run-create-events.ts index 8ec8e46bdc08..2eea293ab68c 100644 --- a/libs/langchain-community/src/tools/google_calendar/commands/run-create-events.ts +++ b/libs/langchain-community/src/tools/google_calendar/commands/run-create-events.ts @@ -2,7 +2,7 @@ import { google, calendar_v3 } from "googleapis"; import type { JWT, GaxiosResponse } from "googleapis-common"; import { PromptTemplate } from "@langchain/core/prompts"; import { CallbackManagerForToolRun } from "@langchain/core/callbacks/manager"; -import { BaseLLM } from "@langchain/core/language_models/llms"; +import { BaseLanguageModel } from "@langchain/core/language_models/base"; import { StringOutputParser } from "@langchain/core/output_parsers"; import { CREATE_EVENT_PROMPT } from "../prompts/index.js"; import { getTimezoneOffsetInHours } from "../utils/get-timezone-offset-in-hours.js"; @@ -61,7 +61,7 @@ const createEvent = async ( type RunCreateEventParams = { calendarId: string; auth: JWT; - model: BaseLLM; + model: BaseLanguageModel; }; const runCreateEvent = async ( diff --git a/libs/langchain-community/src/tools/google_calendar/commands/run-view-events.ts b/libs/langchain-community/src/tools/google_calendar/commands/run-view-events.ts index 1cc721535916..52767d80bff9 100644 --- a/libs/langchain-community/src/tools/google_calendar/commands/run-view-events.ts +++ b/libs/langchain-community/src/tools/google_calendar/commands/run-view-events.ts @@ -1,7 +1,7 @@ import { calendar_v3 } from "googleapis"; import type { JWT } from "googleapis-common"; import { PromptTemplate } from "@langchain/core/prompts"; -import { BaseLLM } from "@langchain/core/language_models/llms"; +import { BaseLanguageModel } from "@langchain/core/language_models/base"; import { CallbackManagerForToolRun } from "@langchain/core/callbacks/manager"; import { StringOutputParser } from "@langchain/core/output_parsers"; @@ -11,7 +11,7 @@ import { getTimezoneOffsetInHours } from "../utils/get-timezone-offset-in-hours. type RunViewEventParams = { calendarId: string; auth: JWT; - model: BaseLLM; + model: BaseLanguageModel; }; const runViewEvents = async ( diff --git a/libs/langchain-community/src/tools/tests/google_calendar.test.ts b/libs/langchain-community/src/tools/tests/google_calendar.test.ts index f777ae8999a2..10531cc72991 100644 --- a/libs/langchain-community/src/tools/tests/google_calendar.test.ts +++ b/libs/langchain-community/src/tools/tests/google_calendar.test.ts @@ -1,5 +1,5 @@ import { jest, expect, describe } from "@jest/globals"; -import { LLM } from "@langchain/core/language_models/llms"; +import { BaseChatModel } from "@langchain/core/language_models/chat_models"; import { GoogleCalendarCreateTool, GoogleCalendarViewTool, @@ -25,13 +25,13 @@ jest.mock("@langchain/core/utils/env", () => ({ // runViewEvents: jest.fn(), // })); -class FakeLLM extends LLM { +class FakeLLM extends BaseChatModel { _llmType() { return "fake"; } - async _call(prompt: string): Promise { - return prompt; + async _generate() { + return {} as any; } } From 08f1a466920aa39bdaa3d9b2ccd9e87453b21e57 Mon Sep 17 00:00:00 2001 From: FilipZmijewski Date: Sat, 18 Jan 2025 08:54:37 +0100 Subject: [PATCH 29/34] docs: Rename auth method in IBM docs (#7524) --- docs/core_docs/docs/integrations/chat/ibm.ipynb | 5 ++--- .../docs/integrations/document_compressors/ibm.ipynb | 4 ++-- docs/core_docs/docs/integrations/llms/ibm.ipynb | 4 ++-- docs/core_docs/docs/integrations/text_embedding/ibm.ipynb | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/core_docs/docs/integrations/chat/ibm.ipynb b/docs/core_docs/docs/integrations/chat/ibm.ipynb index 345203410506..bff577f57d1d 100644 --- a/docs/core_docs/docs/integrations/chat/ibm.ipynb +++ b/docs/core_docs/docs/integrations/chat/ibm.ipynb @@ -29,7 +29,6 @@ "| Class | Package | Local | Serializable | [PY support](https://python.langchain.com/docs/integrations/chat/ibm_watsonx/) | Package downloads | Package latest |\n", "| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n", "| [`ChatWatsonx`](https://api.js.langchain.com/classes/_langchain_community.chat_models_ibm.ChatWatsonx.html) | [@langchain/community](https://www.npmjs.com/package/@langchain/community) | ❌ | ✅ | ✅ | ![NPM - Downloads](https://img.shields.io/npm/dm/@langchain/community?style=flat-square&label=%20&) | ![NPM - Version](https://img.shields.io/npm/v/@langchain/community?style=flat-square&label=%20&) |\n", - "\n", "### Model features\n", "\n", @@ -61,7 +60,7 @@ "export WATSONX_AI_BEARER_TOKEN=\n", "```\n", "\n", - "#### CP4D authentication\n", + "#### IBM watsonx.ai software authentication\n", "\n", "```bash\n", "export WATSONX_AI_AUTH_TYPE=cp4d\n", @@ -104,7 +103,7 @@ "const instance = new WatsonxLLM(props);\n", "```\n", "\n", - "### CP4D authentication\n", + "### IBM watsonx.ai software authentication\n", "\n", "```typescript\n", "import { WatsonxLLM } from \"@langchain/community/llms/ibm\";\n", diff --git a/docs/core_docs/docs/integrations/document_compressors/ibm.ipynb b/docs/core_docs/docs/integrations/document_compressors/ibm.ipynb index 4bf4e42ac475..bb6badcb644f 100644 --- a/docs/core_docs/docs/integrations/document_compressors/ibm.ipynb +++ b/docs/core_docs/docs/integrations/document_compressors/ibm.ipynb @@ -53,7 +53,7 @@ "export WATSONX_AI_BEARER_TOKEN=\n", "```\n", "\n", - "#### CP4D authentication\n", + "#### IBM watsonx.ai software authentication\n", "\n", "```bash\n", "export WATSONX_AI_AUTH_TYPE=cp4d\n", @@ -96,7 +96,7 @@ "const instance = new WatsonxLLM(props);\n", "```\n", "\n", - "### CP4D authentication\n", + "### IBM watsonx.ai software authentication\n", "\n", "```typescript\n", "import { WatsonxLLM } from \"@langchain/community/llms/ibm\";\n", diff --git a/docs/core_docs/docs/integrations/llms/ibm.ipynb b/docs/core_docs/docs/integrations/llms/ibm.ipynb index 4abbfa25b192..7a063f466097 100644 --- a/docs/core_docs/docs/integrations/llms/ibm.ipynb +++ b/docs/core_docs/docs/integrations/llms/ibm.ipynb @@ -56,7 +56,7 @@ "export WATSONX_AI_BEARER_TOKEN=\n", "```\n", "\n", - "#### CP4D authentication\n", + "#### IBM watsonx.ai software authentication\n", "\n", "```bash\n", "export WATSONX_AI_AUTH_TYPE=cp4d\n", @@ -99,7 +99,7 @@ "const instance = new WatsonxLLM(props);\n", "```\n", "\n", - "### CP4D authentication\n", + "### IBM watsonx.ai software authentication\n", "\n", "```typescript\n", "import { WatsonxLLM } from \"@langchain/community/llms/ibm\";\n", diff --git a/docs/core_docs/docs/integrations/text_embedding/ibm.ipynb b/docs/core_docs/docs/integrations/text_embedding/ibm.ipynb index e9c58968de6b..a62635e65d12 100644 --- a/docs/core_docs/docs/integrations/text_embedding/ibm.ipynb +++ b/docs/core_docs/docs/integrations/text_embedding/ibm.ipynb @@ -55,7 +55,7 @@ "export WATSONX_AI_BEARER_TOKEN=\n", "```\n", "\n", - "#### CP4D authentication\n", + "#### IBM watsonx.ai software authentication\n", "\n", "```bash\n", "export WATSONX_AI_AUTH_TYPE=cp4d\n", @@ -98,7 +98,7 @@ "const instance = new WatsonxEmbeddings(props);\n", "```\n", "\n", - "### CP4D authentication\n", + "### IBM watsonx.ai software authentication\n", "\n", "```typescript\n", "import { WatsonxEmbeddings } from \"@langchain/community/embeddings/ibm\";\n", From 900381ad5ee06555f3e7e9adddcc5a4469bc2a2b Mon Sep 17 00:00:00 2001 From: ucev Date: Sat, 18 Jan 2025 16:00:14 +0800 Subject: [PATCH 30/34] docs: correct misspelling (#7522) Co-authored-by: jacoblee93 --- docs/core_docs/docs/how_to/tool_calling_parallel.ipynb | 4 ++-- docs/core_docs/docs/how_to/tool_results_pass_to_model.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/core_docs/docs/how_to/tool_calling_parallel.ipynb b/docs/core_docs/docs/how_to/tool_calling_parallel.ipynb index 97f188d00549..f9800c95c6f5 100644 --- a/docs/core_docs/docs/how_to/tool_calling_parallel.ipynb +++ b/docs/core_docs/docs/how_to/tool_calling_parallel.ipynb @@ -56,7 +56,7 @@ "});\n", "\n", "const multiplyTool = tool(async ({ a, b }) => {\n", - " return a + b;\n", + " return a * b;\n", "}, {\n", " name: \"multiply\",\n", " description: \"Multiplies a and b\",\n", @@ -220,4 +220,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/docs/core_docs/docs/how_to/tool_results_pass_to_model.ipynb b/docs/core_docs/docs/how_to/tool_results_pass_to_model.ipynb index 5f9720f11474..81e40b0fd14e 100644 --- a/docs/core_docs/docs/how_to/tool_results_pass_to_model.ipynb +++ b/docs/core_docs/docs/how_to/tool_results_pass_to_model.ipynb @@ -18,7 +18,7 @@ ":::\n", "```\n", "\n", - "Some models are capable of [**tool calling**](/docs/concepts/tool_calling) - generating arguments that conform to a specific user-provided schema. This guide will demonstrate how to use those tool cals to actually call a function and properly pass the results back to the model.\n", + "Some models are capable of [**tool calling**](/docs/concepts/tool_calling) - generating arguments that conform to a specific user-provided schema. This guide will demonstrate how to use those tool calls to actually call a function and properly pass the results back to the model.\n", "\n", "![](../../static/img/tool_invocation.png)\n", "\n", @@ -367,4 +367,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} From f1dbe286d03a94c7fbe94be94361d4244a2f5396 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Sat, 18 Jan 2025 00:14:25 -0800 Subject: [PATCH 31/34] release(community): 0.3.25 (#7549) --- libs/langchain-community/package.json | 2 +- libs/langchain-openai/src/chat_models.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/langchain-community/package.json b/libs/langchain-community/package.json index aef582d27f8a..22104200da1d 100644 --- a/libs/langchain-community/package.json +++ b/libs/langchain-community/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/community", - "version": "0.3.24", + "version": "0.3.25", "description": "Third-party integrations for LangChain.js", "type": "module", "engines": { diff --git a/libs/langchain-openai/src/chat_models.ts b/libs/langchain-openai/src/chat_models.ts index 2e04059c2fd4..0292420c9341 100644 --- a/libs/langchain-openai/src/chat_models.ts +++ b/libs/langchain-openai/src/chat_models.ts @@ -1124,6 +1124,8 @@ export class ChatOpenAI< reasoningEffort?: OpenAIClient.Chat.ChatCompletionReasoningEffort; + disableStreaming?: boolean; + constructor( fields?: ChatOpenAIFields, /** @deprecated */ From 3a1131a156c11d699653b114cf6ccb4155ea54e3 Mon Sep 17 00:00:00 2001 From: crisjy Date: Sat, 18 Jan 2025 16:14:39 +0800 Subject: [PATCH 32/34] feat(azure-cosmosdb): add session context for a user mongodb (#7436) Co-authored-by: jacoblee93 --- .../src/chat_histories/mongodb.ts | 81 ++++++++++++++++++- .../tests/chat_histories/mongodb.int.test.ts | 55 ++++++++++++- 2 files changed, 131 insertions(+), 5 deletions(-) diff --git a/libs/langchain-azure-cosmosdb/src/chat_histories/mongodb.ts b/libs/langchain-azure-cosmosdb/src/chat_histories/mongodb.ts index 53104c198d71..8a0ba0264160 100644 --- a/libs/langchain-azure-cosmosdb/src/chat_histories/mongodb.ts +++ b/libs/langchain-azure-cosmosdb/src/chat_histories/mongodb.ts @@ -20,7 +20,13 @@ export interface AzureCosmosDBMongoChatHistoryDBConfig { readonly collectionName?: string; } +export type ChatSessionMongo = { + id: string; + context: Record; +}; + const ID_KEY = "sessionId"; +const ID_USER = "userId"; export class AzureCosmosDBMongoChatMessageHistory extends BaseListChatMessageHistory { lc_namespace = ["langchain", "stores", "message", "azurecosmosdb"]; @@ -33,6 +39,8 @@ export class AzureCosmosDBMongoChatMessageHistory extends BaseListChatMessageHis private initPromise?: Promise; + private context: Record = {}; + private readonly client: MongoClient | undefined; private database: Db; @@ -41,11 +49,14 @@ export class AzureCosmosDBMongoChatMessageHistory extends BaseListChatMessageHis private sessionId: string; + private userId: string; + initialize: () => Promise; constructor( dbConfig: AzureCosmosDBMongoChatHistoryDBConfig, - sessionId: string + sessionId: string, + userId: string ) { super(); @@ -70,6 +81,7 @@ export class AzureCosmosDBMongoChatMessageHistory extends BaseListChatMessageHis const collectionName = dbConfig.collectionName ?? "chatHistory"; this.sessionId = sessionId; + this.userId = userId ?? "anonymous"; // Deferring initialization to the first call to `initialize` this.initialize = () => { @@ -120,6 +132,7 @@ export class AzureCosmosDBMongoChatMessageHistory extends BaseListChatMessageHis const document = await this.collection.findOne({ [ID_KEY]: this.sessionId, + [ID_USER]: this.userId, }); const messages = document?.messages || []; return mapStoredMessagesToChatMessages(messages); @@ -134,10 +147,12 @@ export class AzureCosmosDBMongoChatMessageHistory extends BaseListChatMessageHis await this.initialize(); const messages = mapChatMessagesToStoredMessages([message]); + const context = await this.getContext(); await this.collection.updateOne( - { [ID_KEY]: this.sessionId }, + { [ID_KEY]: this.sessionId, [ID_USER]: this.userId }, { $push: { messages: { $each: messages } } as PushOperator, + $set: { context }, }, { upsert: true } ); @@ -150,6 +165,66 @@ export class AzureCosmosDBMongoChatMessageHistory extends BaseListChatMessageHis async clear(): Promise { await this.initialize(); - await this.collection.deleteOne({ [ID_KEY]: this.sessionId }); + await this.collection.deleteOne({ + [ID_KEY]: this.sessionId, + [ID_USER]: this.userId, + }); + } + + async getAllSessions(): Promise { + await this.initialize(); + const documents = await this.collection + .find({ + [ID_USER]: this.userId, + }) + .toArray(); + + const chatSessions: ChatSessionMongo[] = documents.map((doc) => ({ + id: doc[ID_KEY], + user_id: doc[ID_USER], + context: doc.context || {}, + })); + + return chatSessions; + } + + async clearAllSessions() { + await this.initialize(); + try { + await this.collection.deleteMany({ + [ID_USER]: this.userId, + }); + } catch (error) { + console.error("Error clearing chat history sessions:", error); + throw error; + } + } + + async getContext(): Promise> { + await this.initialize(); + + const document = await this.collection.findOne({ + [ID_KEY]: this.sessionId, + [ID_USER]: this.userId, + }); + this.context = document?.context || this.context; + return this.context; + } + + async setContext(context: Record): Promise { + await this.initialize(); + + try { + await this.collection.updateOne( + { [ID_KEY]: this.sessionId }, + { + $set: { context }, + }, + { upsert: true } + ); + } catch (error) { + console.error("Error setting chat history context", error); + throw error; + } } } diff --git a/libs/langchain-azure-cosmosdb/src/tests/chat_histories/mongodb.int.test.ts b/libs/langchain-azure-cosmosdb/src/tests/chat_histories/mongodb.int.test.ts index 35c4a2cf0311..2825b2cafab4 100644 --- a/libs/langchain-azure-cosmosdb/src/tests/chat_histories/mongodb.int.test.ts +++ b/libs/langchain-azure-cosmosdb/src/tests/chat_histories/mongodb.int.test.ts @@ -32,9 +32,11 @@ test("Test Azure Cosmos MongoDB history store", async () => { }; const sessionId = new ObjectId().toString(); + const userId = new ObjectId().toString(); const chatHistory = new AzureCosmosDBMongoChatMessageHistory( dbcfg, - sessionId + sessionId, + userId ); const blankResult = await chatHistory.getMessages(); @@ -70,9 +72,11 @@ test("Test clear Azure Cosmos MongoDB history store", async () => { }; const sessionId = new ObjectId().toString(); + const userId = new ObjectId().toString(); const chatHistory = new AzureCosmosDBMongoChatMessageHistory( dbcfg, - sessionId + sessionId, + userId ); await chatHistory.addUserMessage("Who is the best vocalist?"); @@ -93,3 +97,50 @@ test("Test clear Azure Cosmos MongoDB history store", async () => { await mongoClient.close(); }); + +test("Test getAllSessions and clearAllSessions", async () => { + expect(process.env.AZURE_COSMOSDB_MONGODB_CONNECTION_STRING).toBeDefined(); + + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const mongoClient = new MongoClient( + process.env.AZURE_COSMOSDB_MONGODB_CONNECTION_STRING! + ); + const dbcfg: AzureCosmosDBMongoChatHistoryDBConfig = { + client: mongoClient, + connectionString: process.env.AZURE_COSMOSDB_MONGODB_CONNECTION_STRING, + databaseName: "langchain", + collectionName: "chathistory", + }; + + const sessionId1 = new ObjectId().toString(); + const userId1 = new ObjectId().toString(); + const sessionId2 = new ObjectId().toString(); + const userId2 = new ObjectId().toString(); + + const chatHistory1 = new AzureCosmosDBMongoChatMessageHistory( + dbcfg, + sessionId1, + userId1 + ); + const chatHistory2 = new AzureCosmosDBMongoChatMessageHistory( + dbcfg, + sessionId2, + userId2 + ); + + await chatHistory1.addUserMessage("What is AI?"); + await chatHistory1.addAIChatMessage("AI stands for Artificial Intelligence."); + await chatHistory2.addUserMessage("What is the best programming language?"); + await chatHistory2.addAIChatMessage("It depends on the use case."); + + const allSessions = await chatHistory1.getAllSessions(); + expect(allSessions.length).toBe(2); + expect(allSessions[0].id).toBe(sessionId1); + expect(allSessions[1].id).toBe(sessionId2); + + await chatHistory1.clearAllSessions(); + const clearedSessions = await chatHistory1.getAllSessions(); + expect(clearedSessions.length).toBe(0); + + await mongoClient.close(); +}); From 9518c506d4f140f7f441fabc32e6cc9a3d96fdff Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Sat, 18 Jan 2025 00:19:52 -0800 Subject: [PATCH 33/34] release(azure-cosmosdb): 0.2.7 (#7550) --- libs/langchain-azure-cosmosdb/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain-azure-cosmosdb/package.json b/libs/langchain-azure-cosmosdb/package.json index d958472cf933..72ca6fb70e2a 100644 --- a/libs/langchain-azure-cosmosdb/package.json +++ b/libs/langchain-azure-cosmosdb/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/azure-cosmosdb", - "version": "0.2.6", + "version": "0.2.7", "description": "Azure CosmosDB integration for LangChain.js", "type": "module", "engines": { From 1546a2e3d4b026f24644d3f987f9034d9783de39 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Sat, 18 Jan 2025 00:34:31 -0800 Subject: [PATCH 34/34] fix(ci): Fix build (#7551) --- libs/langchain-openai/src/chat_models.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/langchain-openai/src/chat_models.ts b/libs/langchain-openai/src/chat_models.ts index 0292420c9341..2e04059c2fd4 100644 --- a/libs/langchain-openai/src/chat_models.ts +++ b/libs/langchain-openai/src/chat_models.ts @@ -1124,8 +1124,6 @@ export class ChatOpenAI< reasoningEffort?: OpenAIClient.Chat.ChatCompletionReasoningEffort; - disableStreaming?: boolean; - constructor( fields?: ChatOpenAIFields, /** @deprecated */