Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 4 min read Announcement mediumAdept

Hugging Face x LangChain : A new partner package

langchain-huggingface is a new Python partner package jointly maintained by Hugging Face and LangChain, replacing community-written integrations that had drifted out of date. It provides HuggingFacePipeline for running transformers models locally, HuggingFaceEndpoint for the serverless Inference API or deployed TGI endpoints via InferenceClient, and ChatHuggingFace, which turns message lists into model-specific prompts with tokenizer.apply_chat_template. For embeddings it offers HuggingFaceEmbeddings (local sentence-transformers) and HuggingFaceEndpointEmbeddings (Hub or TEI instances), each shown with short code examples.

Assumes: LangChain basicsHugging Face transformers

Related posts

  • From OpenAI to Open LLMs with Messages API on Hugging Face

    Hugging Face mediumAdept

    Text Generation Inference 1.4.0 adds a Messages API compatible with OpenAI's Chat Completion API, so open LLMs on Inference Endpoints can be called from existing OpenAI client code by changing the base URL and token. The guide deploys Nous-Hermes-2-Mixtral-8x7B-DPO via huggingface_hub with TGI token-limit settings and then calls it from the OpenAI Python and JavaScript clients. It also plugs the endpoint into LangChain (ChatOpenAI) and LlamaIndex (OpenAILike) RAG pipelines. Limitations: no function calling, only models with a chat_template, and a subset of parameters (stream, max_tokens, temperature, top_p, seed, logprobs, frequency_penalty).

  • Generate embeddings with Neon AI Gateway

    Neon mediumAdept

    Neon AI Gateway now serves embedding models on its OpenAI-compatible /v1/embeddings endpoint using the same branch-scoped credential as chat, accepting up to 150 inputs per request. Two models launch: qwen3-embedding-0-6b (1024 configurable dimensions, normalized, $0.02 per 1M tokens) and gte-large-en (1024 dimensions, unnormalized, $0.13 per 1M tokens), with qwen recommended unless matching existing vectors. Combined with Object Storage triggers, Functions, Lakebase Postgres and the lakebase_vector/lakebase_text search extensions, a full RAG pipeline (ingest, embed, store, hybrid retrieve, generate) runs inside one Neon branch, letting teams re-embed and evaluate model or chunking changes against production data without duplicating storage.

  • Tool Use, Unified

    Hugging Face mediumAdept

    Hugging Face Transformers extends Jinja chat templates to cover tool use, giving a single portable API for passing tools to Mistral, Cohere, NousResearch and Llama models. Tools are defined as JSON schema, or as Python functions whose type hints and docstrings are converted automatically via get_json_schema. Tool calls go into the chat as a tool_calls field on assistant messages, and results are added as separate tool-role messages. A full walkthrough with Hermes-2-Pro-Llama-3-8B shows the loop end to end. Parsing the model's emitted tool-call text is still model-specific and needs a little json.loads or regex work.

  • Deploy Mistral Large to Azure and create a conversation with Python and LangChain

    Neon mediumAdept

    Mistral Large, Mistral AI's flagship model with a 32k-token context window and leading MBPP and GSM8K scores, can be deployed through Azure AI Studio as a Pay-As-You-Go project in the France Central region. The deployment yields an inference endpoint and API key that plug directly into LangChain's ChatMistralAI class. A short Python example builds a conversational LLMChain with a system prompt, ConversationBufferMemory and a chat-history placeholder, and shows the expected output.

  • Total noob’s intro to Hugging Face Transformers

    Hugging Face easyNovice

    A beginner-oriented walkthrough of running Microsoft's Phi-2 language model with the Hugging Face Transformers library inside a JupyterLab notebook hosted on a Hugging Face Space with an NVIDIA A10G GPU. It explains foundational concepts along the way (libraries, the Hub, Spaces, classes, methods, tokenizers, instruction-tuned vs base models) and shows the minimal code: install torch and transformers, load the model and tokenizer with from_pretrained, tokenize a prompt, call generate with max_new_tokens, and decode the output. Because Phi-2 is a base model, its output reads like autocomplete rather than a chat reply.

The quest for software engineering knowledge.

Look:
Layout: