Skip to main content
Ctrl+K
πŸ¦œπŸ”— LangChain  documentation - Home

Site Navigation

  • Core
  • Langchain
  • Text Splitters
  • AI21
  • Airbyte
    • Anthropic
    • AstraDB
    • AWS
    • Azure Dynamic Sessions
    • Chroma
    • Cohere
    • Couchbase
    • Elasticsearch
    • Exa
    • Fireworks
    • Google Community
    • Google GenAI
    • Google VertexAI
    • Groq
    • Huggingface
    • Milvus
    • MistralAI
    • MongoDB
    • Nomic
    • Nvidia Ai Endpoints
    • Ollama
    • OpenAI
    • Pinecone
    • Postgres
    • Prompty
    • Qdrant
    • Robocorp
    • Together
    • Unstructured
    • VoyageAI
    • Weaviate
  • LangChain docs
  • GitHub
  • X / Twitter

Site Navigation

  • Core
  • Langchain
  • Text Splitters
  • AI21
  • Airbyte
    • Anthropic
    • AstraDB
    • AWS
    • Azure Dynamic Sessions
    • Chroma
    • Cohere
    • Couchbase
    • Elasticsearch
    • Exa
    • Fireworks
    • Google Community
    • Google GenAI
    • Google VertexAI
    • Groq
    • Huggingface
    • Milvus
    • MistralAI
    • MongoDB
    • Nomic
    • Nvidia Ai Endpoints
    • Ollama
    • OpenAI
    • Pinecone
    • Postgres
    • Prompty
    • Qdrant
    • Robocorp
    • Together
    • Unstructured
    • VoyageAI
    • Weaviate
  • LangChain docs
  • GitHub
  • X / Twitter

Section Navigation

  • chat_models
  • embeddings
  • function_calling
  • graphs
  • llms
  • retrievers
  • utilities
  • utils
    • enforce_stop_tokens
    • get_num_tokens_anthropic
    • get_token_ids_anthropic
  • vectorstores
  • langchain_aws 0.1.16

utils#

Functions

utils.enforce_stop_tokens(text,Β stop)

Cut off the text as soon as any stop words occur.

utils.get_num_tokens_anthropic(text)

Get the number of tokens in a string of text.

utils.get_token_ids_anthropic(text)

Get the token ids for a string of text.

previous

maximal_marginal_relevance

next

enforce_stop_tokens

Β© Copyright 2023, LangChain Inc.