Skip to content

Commit

Permalink
Merge pull request #22 from jeddict/dev2
Browse files Browse the repository at this point in the history
CUSTOM OPEN_AI support
  • Loading branch information
jShiwaniGupta authored Oct 17, 2024
2 parents a480aa4 + 9148ab9 commit 6659061
Show file tree
Hide file tree
Showing 6 changed files with 353 additions and 210 deletions.
8 changes: 7 additions & 1 deletion src/main/java/io/github/jeddict/ai/JeddictChatModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import static io.github.jeddict.ai.settings.GenAIProvider.ANTHROPIC;
import static io.github.jeddict.ai.settings.GenAIProvider.OLLAMA;
import io.github.jeddict.ai.models.LMStudioChatModel;
import static io.github.jeddict.ai.settings.GenAIProvider.DEEPINFRA;
import static io.github.jeddict.ai.settings.GenAIProvider.LM_STUDIO;
import static io.github.jeddict.ai.settings.GenAIProvider.OPEN_AI;
import io.github.jeddict.ai.settings.PreferencesManager;
Expand Down Expand Up @@ -70,7 +71,12 @@ public JeddictChatModel() {
.modelName(preferencesManager.getModelName())
.build();
case DEEPINFRA -> model = OpenAiChatModel.builder()
.baseUrl("https://api.deepinfra.com/v1/openai")
.baseUrl(preferencesManager.getProviderLocation())
.apiKey(preferencesManager.getApiKey())
.modelName(preferencesManager.getModelName())
.build();
case CUSTOM_OPEN_AI -> model = OpenAiChatModel.builder()
.baseUrl(preferencesManager.getProviderLocation())
.apiKey(preferencesManager.getApiKey())
.modelName(preferencesManager.getModelName())
.build();
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/io/github/jeddict/ai/models/Constant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.github.jeddict.ai.models;

/**
*
* @author Shiwani Gupta
*/
public interface Constant {

String DEEPINFRA_URL = "https://api.deepinfra.com/v1/openai";
}
Loading

0 comments on commit 6659061

Please sign in to comment.