CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-dev-langchain4j--langchain4j-github-models

This package provides a deprecated integration module that enables Java applications to interact with GitHub Models through the LangChain4j framework. It offers chat models (both synchronous and streaming), embedding models, and support for AI services with tool integration, JSON schema responses, and responsible AI features. The module wraps Azure AI Inference SDK to provide a unified API for accessing various language models hosted on GitHub Models, including chat completion capabilities, embeddings generation, and content filtering management. As of version 1.10.0, this module has been marked for deprecation and future removal, with users recommended to migrate to the langchain4j-openai-official module for enhanced functionality and better integration. The library is designed for reusability as a foundational component in LLM-powered Java applications that need to leverage GitHub-hosted AI models, offering builder patterns for configuration, support for proxy options, custom timeouts, and comprehensive model service versioning capabilities.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

model-catalog.mddocs/reference/

Model Catalog

Complete reference of available chat and embedding models with selection guidance.

Chat Models

OpenAI GPT Models

GPT-4o

GitHubModelsChatModelName.GPT_4_O  // "gpt-4o"

Capabilities:

  • Latest GPT-4 model
  • Multimodal (text + vision)
  • Tool calling
  • JSON schema responses
  • 128K context window

Best For:

  • Complex reasoning tasks
  • Multi-step problem solving
  • Vision/image understanding
  • High-quality content generation
  • Tasks requiring latest capabilities

Performance: High quality, moderate speed

GPT-4o Mini

GitHubModelsChatModelName.GPT_4_O_MINI  // "gpt-4o-mini"

Capabilities:

  • Efficient smaller model
  • Tool calling
  • JSON responses
  • 128K context window

Best For:

  • Fast responses
  • Simple tasks
  • High-volume processing
  • Cost-sensitive applications

Performance: Good quality, fast speed

Microsoft Phi Models

Phi-3.5 Mini Instruct

GitHubModelsChatModelName.PHI_3_5_MINI_INSTRUCT  // "Phi-3.5-mini-instruct"

Best For: Resource-constrained scenarios, edge deployment, simple tasks

Phi-3.5 Vision Instruct

GitHubModelsChatModelName.PHI_3_5_VISION_INSTRUCT  // "Phi-3.5-vision-instruct"

Capabilities: Vision understanding

Best For: Image analysis, vision tasks, multimodal applications

Phi-3 Medium/Small/Mini Variants

GitHubModelsChatModelName.PHI_3_MEDIUM_INSTRUCT_128K  // 128K context
GitHubModelsChatModelName.PHI_3_MEDIUM_INSTRUCT_4K    // 4K context
GitHubModelsChatModelName.PHI_3_SMALL_INSTRUCT_128K   // 128K context
GitHubModelsChatModelName.PHI_3_SMALL_INSTRUCT_8K     // 8K context
GitHubModelsChatModelName.PHI_3_MINI_INSTRUCT_128K    // 128K context
GitHubModelsChatModelName.PHI_3_MINI_INSTRUCT_4K      // 4K context

Choose By:

  • Long context: 128K variants
  • Short interactions: 4K/8K variants
  • Size: Mini < Small < Medium (speed vs. capability tradeoff)

AI21 Jamba Models

GitHubModelsChatModelName.AI21_JAMBA_1_5_LARGE  // "ai21-jamba-1.5-large"
GitHubModelsChatModelName.AI21_JAMBA_1_5_MINI   // "ai21-jamba-1.5-mini"
GitHubModelsChatModelName.AI21_JAMBA_INSTRUCT   // "ai21-jamba-instruct"

Best For: Instruction following, structured tasks

Choose:

  • Large: Maximum capability
  • Mini: Faster, efficient

Cohere Command Models

GitHubModelsChatModelName.COHERE_COMMAND_R        // "cohere-command-r"
GitHubModelsChatModelName.COHERE_COMMAND_R_PLUS   // "cohere-command-r-plus"

Best For: Strong instruction following, command-style interactions, RAG applications

Choose:

  • R Plus: Enhanced capabilities
  • R: Standard performance

Meta Llama Models

Llama 3.1 (Latest)

GitHubModelsChatModelName.META_LLAMA_3_1_405B_INSTRUCT  // "meta-llama-3.1-405b-instruct"
GitHubModelsChatModelName.META_LLAMA_3_1_70B_INSTRUCT   // "meta-llama-3.1-70b-instruct"
GitHubModelsChatModelName.META_LLAMA_3_1_8B_INSTRUCT    // "meta-llama-3.1-8b-instruct"

Latest Llama generation with improved capabilities

Llama 3

GitHubModelsChatModelName.META_LLAMA_3_70B_INSTRUCT  // "meta-llama-3-70b-instruct"
GitHubModelsChatModelName.META_LLAMA_3_8B_INSTRUCT   // "meta-llama-3-8b-instruct"

Choose By Size:

  • 405B: Maximum capability, complex reasoning
  • 70B: Balanced capability and speed
  • 8B: Fast, efficient, simple tasks

Best For: Open-source deployment, customization, various task complexities

Mistral Models

GitHubModelsChatModelName.MISTRAL_NEMO         // "Mistral-nemo"
GitHubModelsChatModelName.MISTRAL_LARGE        // "Mistral-large"
GitHubModelsChatModelName.MISTRAL_LARGE_2407   // "Mistral-large-2407"
GitHubModelsChatModelName.MISTRAL_SMALL        // "Mistral-small"

Best For: European languages, multilingual tasks

Choose:

  • Large (2407): Latest large model
  • Large: Standard large model
  • Nemo: Efficient, balanced
  • Small: Fast, simple tasks

Embedding Models

OpenAI Text Embedding Models

Text-Embedding-3-Small

GitHubModelsEmbeddingModelName.TEXT_EMBEDDING_3_SMALL  // "text-embedding-3-small"

Dimensions: 1536 (default), customizable Custom Dimensions: Yes (down to any size)

Best For:

  • General-purpose semantic search
  • Most applications
  • Good balance of quality and performance
  • Cost-effective

Performance: High quality, fast

Text-Embedding-3-Large

GitHubModelsEmbeddingModelName.TEXT_EMBEDDING_3_LARGE  // "text-embedding-3-large"

Dimensions: 3072 (default), customizable Custom Dimensions: Yes (down to any size)

Best For:

  • Maximum embedding quality
  • High-precision semantic search
  • Complex similarity tasks
  • Research applications

Performance: Highest quality, moderate speed

Dimension Tradeoff:

// Default: Maximum quality
.modelName(TEXT_EMBEDDING_3_LARGE)  // 3072 dimensions

// Reduced: Better performance, slight quality reduction
.modelName(TEXT_EMBEDDING_3_LARGE).dimensions(512)  // 512 dimensions

Cohere Embedding Models

Cohere-Embed-V3-English

GitHubModelsEmbeddingModelName.COHERE_EMBED_V3_ENGLISH  // "cohere-embed-v3-english"

Dimensions: 1024 (fixed) Custom Dimensions: No

Best For:

  • English-only applications
  • Optimized English understanding
  • Fixed-dimension requirements

Cohere-Embed-V3-Multilingual

GitHubModelsEmbeddingModelName.COHERE_EMBED_V3_MULTILINGUAL  // "cohere-embed-v3-multilingual"

Dimensions: 1024 (fixed) Custom Dimensions: No Languages: 100+ languages

Best For:

  • Multilingual applications
  • Cross-language semantic search
  • International applications

Model Selection Guide

By Task Complexity

Simple Tasks

  • GPT-4o Mini
  • Phi-3.5 Mini Instruct
  • Meta Llama 3.1 8B
  • Mistral Small

Moderate Tasks

  • GPT-4o
  • Meta Llama 3.1 70B
  • Cohere Command R
  • Mistral Large

Complex Tasks

  • GPT-4o (latest features)
  • Meta Llama 3.1 405B
  • Mistral Large 2407

By Speed Requirements

Fast Response

  • GPT-4o Mini
  • Phi-3.5 Mini
  • Meta Llama 3.1 8B

Balanced

  • GPT-4o
  • Meta Llama 3.1 70B
  • Cohere Command R

By Context Length

Short Context (< 4K)

  • Phi-3 Mini/Small/Medium 4K variants

Standard Context (8K-32K)

  • Phi-3 8K variants
  • Most models (default)

Long Context (128K+)

  • GPT-4o (128K)
  • GPT-4o Mini (128K)
  • Phi-3 128K variants

By Special Capabilities

Vision Tasks

  • GPT-4o (multimodal)
  • Phi-3.5 Vision Instruct

Tool Calling

  • GPT-4o
  • GPT-4o Mini
  • Most chat models

JSON Schema

  • GPT-4o
  • GPT-4o Mini
  • Models with structured output support

Embedding Model Selection

General Use

TEXT_EMBEDDING_3_SMALL  // Best balance

Maximum Quality

TEXT_EMBEDDING_3_LARGE  // Highest quality

Multilingual

COHERE_EMBED_V3_MULTILINGUAL  // 100+ languages

Storage Optimization

TEXT_EMBEDDING_3_SMALL.dimensions(512)  // Reduced dimensions
COHERE_EMBED_V3_ENGLISH  // Fixed 1024 dimensions

Cost Considerations

Generally:

  • Smaller models = Lower cost
  • Shorter context = Lower cost
  • Fewer tokens = Lower cost

Balance:

  • GPT-4o Mini for volume
  • GPT-4o for quality
  • Llama models for cost-effective open source

Embeddings:

  • TEXT_EMBEDDING_3_SMALL for balance
  • Custom dimensions to reduce storage costs

Example Model Configurations

High-Quality Content Generation

GitHubModelsChatModel model = GitHubModelsChatModel.builder()
    .gitHubToken(token)
    .modelName(GitHubModelsChatModelName.GPT_4_O)
    .temperature(0.8)
    .maxTokens(2000)
    .build();

Fast Customer Support

GitHubModelsChatModel model = GitHubModelsChatModel.builder()
    .gitHubToken(token)
    .modelName(GitHubModelsChatModelName.GPT_4_O_MINI)
    .temperature(0.3)
    .maxTokens(500)
    .timeout(Duration.ofSeconds(30))
    .build();

Complex Reasoning

GitHubModelsChatModel model = GitHubModelsChatModel.builder()
    .gitHubToken(token)
    .modelName(GitHubModelsChatModelName.META_LLAMA_3_1_405B_INSTRUCT)
    .temperature(0.2)
    .maxTokens(3000)
    .build();

Multilingual Search

GitHubModelsEmbeddingModel model = GitHubModelsEmbeddingModel.builder()
    .gitHubToken(token)
    .modelName(GitHubModelsEmbeddingModelName.COHERE_EMBED_V3_MULTILINGUAL)
    .build();

Vision Tasks

GitHubModelsChatModel model = GitHubModelsChatModel.builder()
    .gitHubToken(token)
    .modelName(GitHubModelsChatModelName.PHI_3_5_VISION_INSTRUCT)
    .build();

Model Comparison Table

Chat Models

ModelSizeSpeedQualityContextVisionCost
GPT-4oLargeMediumExcellent128KYesHigh
GPT-4o MiniSmallFastGood128KNoLow
Llama 3.1 405BXLargeSlowExcellent128KNoHigh
Llama 3.1 8BSmallFastGood128KNoLow
Phi-3.5 MiniXSmallFastFairVariesNoLow

Embedding Models

ModelDimensionsCustom DimsLanguagesQualityCost
TEXT_EMBEDDING_3_SMALL1536YesEnglish+GoodLow
TEXT_EMBEDDING_3_LARGE3072YesEnglish+ExcellentMedium
COHERE_EMBED_V3_ENGLISH1024NoEnglishGoodLow
COHERE_EMBED_V3_MULTILINGUAL1024No100+GoodLow

See Also

  • Chat Model API
  • Embedding Model API
  • Model Names API
  • Best Practices

Install with Tessl CLI

npx tessl i tessl/maven-dev-langchain4j--langchain4j-github-models@1.11.0

docs

index.md

quick-reference.md

tile.json