mshumer / gpt-investor

MIT License
2.24k stars 284 forks source link

Include Support for Azureopenai and openai #6

Open RohitX0X opened 6 months ago

RohitX0X commented 6 months ago

To not limit oneself with claude, extending support to Open AI too raised PR for it

RohitX0X commented 6 months ago

https://github.com/mshumer/gpt-investor/pull/5

solved here^

magiccub04 commented 6 months ago

I use OpenAI model gpt-3.5-turbo-0613 to run this code but i get Error code: 404 - {'error': {'message': 'The model API_MODEL does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}

from openai import AzureOpenAI, OpenAI
load_dotenv()
API_KEY = "OpenAI_key"  # Replace with your OpenAI API or AzureOpenAI key
client = OpenAI(api_key = API_KEY)

HOSTED_IN_AZURE_PLATFORM = False  # Make it to True/False if your service is Azure Open AI or OpenAI respectively.
if(HOSTED_IN_AZURE_PLATFORM):
    API_ENDPOINT= "<Your_Azure_API_endpoint>"
    API_MODEL="<gpt-3.5-turbo-0613>"
    API_VERSION="<Your_Azure_API_version>"

    client = AzureOpenAI(api_key = API_KEY,api_version=API_VERSION,azure_endpoint=API_ENDPOINT)
RohitX0X commented 6 months ago

The issue is with client.chat completions… if you are using open ai then remove model in the create() call….

Edit: sorry, i read the error mssg wrongly ,

firstly, put API_MODEL="gpt-3.5-turbo-0613" just below the API_KEY line Also , You need to name it as , API_MODEL="gpt-3.5-turbo-0613" instead of API_MODEL=""

RohitX0X commented 6 months ago

Updated my PR , you can check the corrections

arsaboo commented 6 months ago

May be out of scope for this PR, but can we include support for local llms (e.g., Ollama).