Forum in maintenance, we will back soon 🙂
Implementing OpenAI Python SDK on simplerLLM
Sir, I want to implement OpenAI Python SDK to simplerLLM. Its a open source model which provides API. They provides OpenAI Python SDK which I shared below & its working fine to other project but now want to use it with simplesLLM. I added it in the main Python file & got "errorMessage": "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable",
"errorType": "OpenAIError",
import openai client = openai.OpenAI( base_url = "https://api.endpoints.com/v1", api_key = "esecret_YOUR_API_KEY" ) chat_completion = client.chat.completions.create( model="model-name-chat", messages=[{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Say 'Test'."}], temperature=0.7 )
Posted by: @sahuclient = openai.OpenAI( base_url = "https://api.endpoints.com/v1", api_key = "esecret_YOUR_API_KEY" )
did you set your api_key value and the "esecret_YOUR_API_KEY" value is just for display here?
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@sahu Are you sure this same code works in other projects? I tried to run in it and it gave me a ton of OpenAI-related errors
@sahu Im sorry, I didn quite understand what you're exactly trying to do.
Please explain more what's the project you're trying to implement and the error you're encountering.