Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持一下sdk的实例化 #672

Open
jmaxzh opened this issue Jul 16, 2024 · 4 comments
Open

支持一下sdk的实例化 #672

jmaxzh opened this issue Jul 16, 2024 · 4 comments

Comments

@jmaxzh
Copy link

jmaxzh commented Jul 16, 2024

Feature request

现在sdk是都使用全局配置,不能初始化成多个实例使用。

contribution or solutions

No response

@danielhjz
Copy link
Collaborator

感谢反馈,可以进一步描述下根据实例区分的最主要的配置是哪些吗(比如ACCESS_KEY、SECRET_KEY?),我们会重点看一下

Feature request

现在sdk是都使用全局配置,不能初始化成多个实例使用。

contribution or solutions

No response

@jmaxzh
Copy link
Author

jmaxzh commented Jul 17, 2024

感谢反馈,可以进一步描述下根据实例区分的最主要的配置是哪些吗(比如ACCESS_KEY、SECRET_KEY?),我们会重点看一下

Feature request

现在sdk是都使用全局配置,不能初始化成多个实例使用。

contribution or solutions

No response

嗯,最好能加上 BaseURL ,方便 mock。🙏🏻

@danielhjz
Copy link
Collaborator

danielhjz commented Jul 18, 2024

嗯,最好能加上 BaseURL ,方便 mock。🙏🏻

是指的希望创建多个ChatCompletion,每个指定一个BaseURL?
例如:

from qianfan import ChatCompletion

conf1 = Config(
    access_key=''.
    secret_key='',
    base_url='xxx'
)
# run in custom base_url:
chat_custom = ChatCompletion(conf)
chat_custom.do()
# run in baidubce.com:
chat1 = ChatCompletion(conf)
chat1.do()

@jmaxzh
Copy link
Author

jmaxzh commented Jul 24, 2024

嗯,最好能加上 BaseURL ,方便 mock。🙏🏻

是指的希望创建多个ChatCompletion,每个指定一个BaseURL? 例如:

from qianfan import ChatCompletion

conf1 = Config(
    access_key=''.
    secret_key='',
    base_url='xxx'
)
# run in custom base_url:
chat_custom = ChatCompletion(conf)
chat_custom.do()
# run in baidubce.com:
chat1 = ChatCompletion(conf)
chat1.do()

多个 instance 吧。

	instance := NewInstance(Config{})

	chat := instance.NewChatCompletion(
		qianfan.WithModel("ERNIE-Bot-4"),
	)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants