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

Hope to support more models #84

Open
franky519 opened this issue Dec 13, 2024 · 1 comment
Open

Hope to support more models #84

franky519 opened this issue Dec 13, 2024 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@franky519
Copy link

Due to its integration of llama-index, it can no longer utilize the official API support for the OpenAI library, yet models not affiliated with OpenAI, like deepseek, are still usable.

Otherwise, the following error will occur

AI: Error occurred: Unknown model 'deepseek-chat'. Please provide a valid OpenAI model name in: o1-preview, o1-preview-2024-09-12, o1-mini, o1-mini-2024-09-12, gpt-4, gpt-4-32k, gpt-4-1106-preview, gpt-4-0125-preview, gpt-4-turbo-preview, gpt-4-vision-preview, gpt-4-1106-vision-preview, gpt-4-turbo-2024-04-09, gpt-4-turbo, gpt-4o, gpt-4o-2024-05-13, gpt-4o-2024-08-06, gpt-4o-2024-11-20, chatgpt-4o-latest, gpt-4o-mini, gpt-4o-mini-2024-07-18, gpt-4-0613, gpt-4-32k-0613, gpt-4-0314, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-16k, gpt-3.5-turbo-0125, gpt-3.5-turbo-1106, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k-0613, gpt-3.5-turbo-0301, text-davinci-003, text-davinci-002, gpt-3.5-turbo-instruct, text-ada-001, text-babbage-001, text-curie-001, ada, babbage, curie, davinci, gpt-35-turbo-16k, gpt-35-turbo, gpt-35-turbo-0125, gpt-35-turbo-1106, gpt-35-turbo-0613, gpt-35-turbo-16k-0613

@Umpire2018 Umpire2018 self-assigned this Dec 14, 2024
@Umpire2018 Umpire2018 added the help wanted Extra attention is needed label Dec 14, 2024
@Umpire2018
Copy link
Collaborator

Umpire2018 commented Dec 14, 2024

Thank you for raising this issue!

This was an oversight on my part during development. To address this, you can try the following steps and provide feedback on whether this resolves the issue:

  1. Add the required package:
pdm add llama-index-llms-openai-like
  1. Modify the import statement in repo_agent/chat_engine.py:
from llama_index.llms.openai import OpenAI

Change it to:

from llama_index.llms.openai_like import OpenAILike
  1. Update the LLM initialization code in the same file. Replace this:
self.llm = OpenAI(
    api_key=setting.chat_completion.openai_api_key.get_secret_value(),
    api_base=setting.chat_completion.openai_base_url,
    timeout=setting.chat_completion.request_timeout,
    model=setting.chat_completion.model,
    temperature=setting.chat_completion.temperature,
    max_retries=1,
    is_chat_model=True,
)

With this:

self.llm = OpenAILike(
    api_key=setting.chat_completion.openai_api_key.get_secret_value(),
    api_base=setting.chat_completion.openai_base_url,
    timeout=setting.chat_completion.request_timeout,
    model=setting.chat_completion.model,
    temperature=setting.chat_completion.temperature,
    max_retries=1,
    is_chat_model=True,
)
  1. Reinstall the dependencies:
pdm install --prod
  1. Continue using the original approach as before.

Let me know if this works for you, or feel free to provide further feedback! Thanks again for contributing to improving the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants