Skip to content

Commit

Permalink
feat(gateway): anthropic
Browse files Browse the repository at this point in the history
 - fix Anthropic BASE_URL with protocol
  • Loading branch information
hanrw committed Aug 25, 2024
1 parent 80318eb commit 66da2b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Anthropic : Messages {
* Companion object containing a constant variable for the base URL of the API.
*/
companion object {
const val BASE_URL = "api.anthropic.com"
const val BASE_URL = "https://api.anthropic.com"
const val ANTHROPIC_VERSION = "2023-06-01"

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class AnthropicITest : AutoCloseKoinTest() {
fun setUp() {
anthropic = iniAnthropic(
config = AnthropicConfig(
baseUrl = { System.getenv("ANTHROPIC_BASE_URL") ?: "api.anthropic.com" },
baseUrl = {
System.getenv("ANTHROPIC_BASE_URL") ?: "https://api.anthropic.com"
},
apiKey = { System.getenv("ANTHROPIC_API_KEY") ?: "CONFIGURE_ME" },
anthropicVersion = { "2023-06-01" }
)
Expand All @@ -31,7 +33,7 @@ class AnthropicITest : AutoCloseKoinTest() {

@Test
fun `should return correct base url`() {
assertEquals("api.anthropic.com", Anthropic.BASE_URL)
assertEquals("https://api.anthropic.com", Anthropic.BASE_URL)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ class AnthropicTest {

@Test
fun `should return default settings`() {
assertEquals("api.anthropic.com", anthropic.baseUrl())
assertEquals("https://api.anthropic.com", anthropic.baseUrl())

assertEquals("CONFIG_API_KEY", anthropic.apiKey())

assertEquals("api.anthropic.com", anthropic.baseUrl())

assertEquals("2023-06-01", anthropic.anthropicVersion())
}

Expand Down

0 comments on commit 66da2b3

Please sign in to comment.