Skip to content

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

Neon 4 min read How-to mediumAdept

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

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.

Related posts

  • Hugging Face x LangChain : A new partner package

    Hugging Face mediumAdept

    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.

  • 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).

  • Deploy LLMs with Hugging Face Inference Endpoints

    Hugging Face mediumAdept

    Falcon 40B Instruct can be deployed to Hugging Face Inference Endpoints through the web UI by choosing a repository, cloud, region and instance. For best performance the suggested 4x T4 instance should be switched to a single A100. Once the endpoint is live it can be called with cURL, and generation is controlled through parameters such as temperature, max_new_tokens (max 512), top_k/top_p, repetition_penalty and stop sequences. Tokens can be streamed to clients using huggingface_hub's InferenceClient in Python or HfInferenceEndpoint from @huggingface/inference in JavaScript, with code that skips special tokens and stops on stop sequences.

  • 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.

  • Mistral 7B and BAAI on Workers AI vs. OpenAI Models for RAG

    Neon mediumAdept

    Swapping gpt-3.5-turbo for mistral-7b-instruct-v0.1 and text-embedding-ada-002 for BAAI's bge-base-en-v1.5 (both on Cloudflare Workers AI) in Neon's docs chatbot shows embeddings are close to interchangeable but text generation is not. Across eight Postgres questions, the two embedding models returned the same retrieved chunks 46% of the time at k=3 (42% at k=10), with Jaccard and TF-IDF cosine scores indicating substantial context overlap. Expert raters scored GPT-3.5 answers 3.8/5 versus 2.5/5 for Mistral 7B. Migrating embeddings to BGE looks viable and can cut vector storage, while replacing the generation model would noticeably hurt answer quality.

The quest for software engineering knowledge.

Look:
Layout: