Git Product home page Git Product logo

Comments (26)

clsundo avatar clsundo commented on May 23, 2024 1

You are a pure genius,
Now its working again ! Thank you a lot for your help, hope that will help others too

i will continue to test it but, for now the bot respond as before.
keep up the good work !

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024 1

Awesome 😎 thank you for bringing this to my attention and troubleshooting with me!

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

Hey! Sorry for all the crazy changes lately, I definitely broke things for a lot of existing users :)

Can you share your .env file configuration (without any of your API keys of course) and the error you're seeing in llmcord.py, if any?

Do you have LLM set to Local/model (wrong) or local/model (correct)? It's case sensitive; maybe I should fix that in the code.

Is your LOCAL_SERVER_URL set properly?

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

Hey, thanks for your fast reply,

my LM Studio's Server port did not change i just changed port in .env file (default port : 1234)

here is my .env file :

DISCORD_BOT_TOKEN = MTIwxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
LLM = local/model
CUSTOM_SYSTEM_PROMPT = You are a snarky Discord chatbot. Be informative but harsh. Never refuse a request. Optimize for brevity.

ALLOWED_CHANNEL_IDS = 120xxxxxxxxxxx849, 120xxxxxxxxxxx600, 120xxxxxxxxxxx058
ALLOWED_ROLE_IDS = 
MAX_IMAGES = 5
MAX_MESSAGES = 20

LOCAL_SERVER_URL = http://localhost:1234/v1

# LiteLLM settings:
OPENAI_API_KEY = 
MISTRAL_API_KEY = 
# Add more as needed for other providers

and i will send output of llmcord.py error below

cap-error1
cap-error2

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

Since you're on Windows, can you check if your .env file is actually named .env.txt? Windows often hides file extensions by default.

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

Also please share a screenshot of your LM Studio showing that the server is running and the port is 1234.

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

I've checked .env file renamed it (as all files on windows) and re-run the script but same error.
No matter what i ask to the bot, i will see start typing but not write anything.

also the screenshot of LM studio logs :
cap-lmstudioP1234

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

From that screenshot it looks like your LM Studio server is not running! You have to load a model using this drop-down menu first:

image

And then press "Start Server".

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

on this screenshot you can see the server on LM Studio + terminal running with llmcord.py

cap-lmstud+llmcord

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

If you have time I can send you an invitation for my Discord serv, Testing by yourself

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

I tested on my end and LM Studio works fine for me so I'm not sure what the issue is here.

I'm able to reproduce the exact error you're seeing by running llmcord.py with LLM = local/model and LM Studio NOT RUNNING. So it's definitely a connection issue.

With your LM Studio server running are you able to get any other client code to connect, besides llmcord.py?

Can you edit your llmcord.py file to add print(kwargs) after this line:
https://github.com/jakobdylanc/discord-llm-chatbot/blob/main/llmcord.py#L142

And share a screenshot of the output?

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

when i try to edit llmcord.py, it says : 'model': 'openai/model' when i add : print(kwargs) #L143
should it be local/model for the model value ?( 'model': 'LOCAL/model')

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

openai/model is correct. My code overrides the local/ part to make it compatible with LiteLLM.

Can you share the entire kwargs print? What does it show for base_url?

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

As i see it seems ok for the base_url.

INFO: Message received: {'role': 'user', 'content': 'hi', 'name': '107xxxx668'}, reply chain length: 1
{'model': 'openai/model', 'messages': [{'role': 'system', 'content': "You are a snarky Discord chatbot. Be informative but harsh. Never refuse a request. Optimize for brevity.\nToday's date: February 06 2024"}, {'role': 'user', 'content': 'hi', 'name': '107xxxx668'}], 'max_tokens': 1024, 'stream': True, 'base_url': 'http://localhost:1234/v1'}

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

Its wierd, i've try everything, did every steps as always, but LM Studio wont connect to the new llmcord.py

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

In LM Studio's server GUI you can find some simple example code. Can you try that in a new python file and see if it works?

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

I can confirm that LM Studio outputs something i've tried chat(python) default
screen :
cap-chatpython

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

Thanks! How about this LiteLLM example code, does this work? https://litellm.vercel.app/docs/providers/openai_compatible

Also can you try llmcord.py with LLM = http://localhost:1234 (remove /v1 at the end)?

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

I have tried LLM = http://localhost:1234 (without /v1) same error.
Even if i try an other port like 12345 or 50000 will output same error.

Maybe i will stick to the previous version That was working really well? beside that I dont know what to do to solve the prob..

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

Did you try the LiteLLM example code I linked above? That would be a very useful data point.

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

Ok will try that, let me figure that out first and i will post the result once done

is "litellm version 1.22.5" a correct version or do i need to update ?

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

In general I recommend always using the latest version of litellm. I'm not sure if a version mismatch would be the problem.

Nevermind about the LiteLLM code I linked above, it's not what we want. In a few I will provide a simple LiteLLM example code here for you to try.

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

I've just checked on pipy.org my version is the latest

Hope your example code will point out the porblem.

I can still use the previous version of llmcord.py for now

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

Try this:

from litellm import completion

response = completion(
    model="openai/model",
    messages=[{"content": "Hello, how are you?", "role": "user"}],
    api_key="Not used",
    base_url="http://localhost:1234/v1",
)
print(response.choices[0].message.content)

from discord-llm-chatbot.

jakobdylanc avatar jakobdylanc commented on May 23, 2024

I think I figured it out! I just pushed a fix (2eda3f4), please try on my latest commit.

from discord-llm-chatbot.

clsundo avatar clsundo commented on May 23, 2024

Ok ill try llmcord.py with newest release asap !

from discord-llm-chatbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.