no support for OpenAI compatible model, with params of base_url, model_id, api_key
I want to use AliCloud Modelscope models which is OpenAI compatible model, with params of base_url, model_id, api_key
see #53, implemented in #51
Hi @YunfanGoForIt,
Good news - PR #51 was just merged, adding base_url support for OpenAI-compatible endpoints. This should enable AliCloud Modelscope and other OpenAI-compatible services.
You can now configure the base_url parameter when using OpenAILanguageModel. Please let us know if you encounter any issues.
Thanks for your patience.
How to use it in conjunction with langextrect? Can you give a demo?
Is this live in v1.0.4?
Receiving an error:
InferenceOutputError: Parallel inference error: OpenAI API error: Error code: 401 - {'error': {'message': 'Incorrect API key provided: gsk_SjDf****************************************CC. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Trying to use the generic OpenAi client not directly from openai, but for example groq:
result = lx.extract( text_or_documents=input_text, prompt_description=prompt, examples=examples, language_model_type=lx.inference.OpenAILanguageModel, model_id="openai/gpt-oss-120b", language_model_params= {'base_url': 'https://api.groq.com/openai/v1', 'api_key':"gx_xxxC", 'model_id':"openai/gpt-oss-120b"} )
I noticed extract takes in model_url but the language_model_type only receives base_url as a keyword arg, so I am using the language_model_params dict?
If i use the same parameters for a separate client connects fine, so seems like an issue in langextract:
client = OpenAI(api_key='gx_xxxC', base_url='https://api.groq.com/openai/v1')
Thanks!