docs/docs/integrations/embedding-models/github-models.md
This module is deprecated, please use the OpenAI Official SDK module instead.
:::note
This is the documentation for the GitHub Models integration, that uses the Azure AI Inference API to access GitHub Models.
LangChain4j provides 4 different integrations with OpenAI for using embedding models, and this is #4 :
:::
If you want to develop a generative AI application, you can use GitHub Models to find and experiment with AI models for free. Once you are ready to bring your application to production, you can switch to a token from a paid Azure account.
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-github-models</artifactId>
<version>1.11.7-beta19</version>
</dependency>
To use GitHub Models, you need to use a GitHub token for authentication.
Token are created and managed in GitHub Developer Settings > Personal access tokens.
Once you have a token, you can set it as an environment variable and use it in your code:
export GITHUB_TOKEN="<your-github-token-goes-here>"
GitHubModelsEmbeddingModel with a GitHub tokenGitHubModelsEmbeddingModel model = GitHubModelsEmbeddingModel.builder()
.gitHubToken(System.getenv("GITHUB_TOKEN"))
.modelName(TEXT_EMBEDDING_3_SMALL)
.logRequestsAndResponses(true)
.build();
This will create an instance of GitHubModelsEmbeddingModel.
Response<Embedding> response = model.embed("Please embed this sentence.");