import os
from openai import AzureOpenAI
parameters = {}
parameters['azure'] = {}
parameters['azure']['api_version'] = '2023-07-01-preview'
####### GPT-4o instance
parameters['azure']['api_key'] = '156dfg651df651gfdg'
parameters['azure']['azure_endpoint'] = 'https://example-instance.openai.azure.com/'
parameters['azure']['model'] = 'my-gpt-4o-model'
client = AzureOpenAI(
api_key=parameters['azure']['api_key'],
azure_endpoint = parameters['azure']['azure_endpoint'],
api_version = parameters['azure']['api_version'],
)
llm_system_prompt = 'hey'
llm_user_prompt = 'I need to get rid of white magins of a pdf doc, and I am unable to figure out how. Is this possible to do it in Acrobat'
messages = [{"role": "system", "content": llm_system_prompt},
{"role": "user", "content": llm_user_prompt}]
chat_completion = client.chat.completions.create(messages=messages, model=parameters['azure']['model'],
temperature=0, seed=47)
print(chat_completion)
print('\n\n\nanswer', chat_completion.choices[0].message.content)
answer = chat_completion.choices[0].message.content
经批准后,可以修改 Azure OpenAI 中的内容过滤器。来自https://learn.microsoft.com/en-us/legal/cognitive-services/openai/limited-access:
预计需要大约 10 个工作日:
就我而言,申请在 15 小时内获得批准。请参阅此处了解如何为资源设置自定义内容过滤配置,或查看以下屏幕截图:
在 python 中测试: