diff --git a/docs/my-website/docs/proxy_server.md b/docs/my-website/docs/proxy_server.md index 0e64903a708..51d44e47869 100644 --- a/docs/my-website/docs/proxy_server.md +++ b/docs/my-website/docs/proxy_server.md @@ -137,7 +137,7 @@ $ litellm --model command-nightly [**Jump to Code**](https://github.com/BerriAI/litellm/blob/fef4146396d5d87006259e00095a62e3900d6bb4/litellm/proxy.py#L36) -## [Tutorial]: Use with Aider/AutoGen/Continue-Dev +## [Tutorial]: Use with Aider/AutoGen/Continue-Dev/Langroid Here's how to use the proxy to test codellama/mistral/etc. models for different github repos @@ -217,26 +217,19 @@ pip install langroid ```python from langroid.language_models.openai_gpt import OpenAIGPTConfig, OpenAIGPT -# create the (Pydantic-derived) config class: Allows setting params via MYLLM_XXX env vars -MyLLMConfig = OpenAIGPTConfig.create(prefix="myllm") - -# instantiate the class, with the model name and context length -my_llm_config = MyLLMConfig( - chat_model="local/localhost:8000", # "local/[URL where LiteLLM proxy is listening] +# configure the LLM +my_llm_config = OpenAIGPTConfig( + #format: "local/[URL where LiteLLM proxy is listening] + chat_model="local/localhost:8000", chat_context_length=2048, # adjust based on model ) -# create llm and interact with it -from langroid.language_models.base import LLMMessage, Role - +# create llm, one-off interaction llm = OpenAIGPT(my_llm_config) -messages = [ - LLMMessage(content="You are a helpful assistant", role=Role.SYSTEM), - LLMMessage(content="What is the capital of Ontario?", role=Role.USER), -], -response = mdl.chat(messages, max_tokens=50) +response = mdl.chat("What is the capital of China?", max_tokens=50) -# Create an Agent with this LLM, wrap it in a Task, and run it as an interactive chat app: +# Create an Agent with this LLM, wrap it in a Task, and +# run it as an interactive chat app: from langroid.agent.base import ChatAgent, ChatAgentConfig from langroid.agent.task import Task