Skip to content

Commit eaa3093

Browse files
fix openai option. (#469)
Signed-off-by: my-vegetable-has-exploded <wy1109468038@gmail.com>
1 parent 06137e1 commit eaa3093

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/gucs/embedding.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use pgrx::{GucContext, GucFlags, GucRegistry, GucSetting};
44
use std::ffi::CStr;
55

66
pub fn openai_options() -> OpenAIOptions {
7-
let base_url = guc_string_parse(&OPENAI_BASE_URL, "vectors.openai_base");
7+
let base_url = guc_string_parse(&OPENAI_BASE_URL, "vectors.openai_base_url");
88
let api_key = guc_string_parse(&OPENAI_API_KEY, "vectors.openai_api_key");
99
OpenAIOptions { base_url, api_key }
1010
}
@@ -13,7 +13,7 @@ static OPENAI_API_KEY: GucSetting<Option<&'static CStr>> =
1313
GucSetting::<Option<&'static CStr>>::new(None);
1414

1515
static OPENAI_BASE_URL: GucSetting<Option<&'static CStr>> =
16-
GucSetting::<Option<&'static CStr>>::new(Some(c"https://api.openai.com/v1/"));
16+
GucSetting::<Option<&'static CStr>>::new(Some(c"https://api.openai.com/v1"));
1717

1818
pub unsafe fn init() {
1919
GucRegistry::define_string_guc(

tests/sqllogictest/openai_options.slt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
statement ok
2+
SET search_path TO pg_temp, vectors;
3+
4+
statement ok
5+
SET vectors.openai_base_url TO 'https://api.moonshot.cn/v1';
6+
7+
statement ok
8+
SET vectors.openai_api_key TO 'fake_key';
9+
10+
query ?
11+
SHOW vectors.openai_base_url;
12+
----
13+
https://api.moonshot.cn/v1
14+
15+
query ?
16+
SHOW vectors.openai_api_key;
17+
----
18+
fake_key

0 commit comments

Comments
 (0)