mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-15 16:19:45 +00:00
* remove unused imports * fix AmazonConverseConfig * fix test * fix import * ruff check fixes * test fixes * fix testing * fix imports
4.2 KiB
Vendored
4.2 KiB
Vendored
In [ ]:
pip install nemoguardrails langchainIn [ ]:
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(model_name="anthropic.claude-v2", openai_api_base="http://0.0.0.0:8000", openai_api_key="my-fake-key")
from nemoguardrails import LLMRails, RailsConfig
config = RailsConfig.from_path("./config.yml")
app = LLMRails(config, llm=llm)
new_message = app.generate(messages=[{
"role": "user",
"content": "Hello! What can you do for me?"
}])In [ ]:
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(model_name="together_ai/togethercomputer/CodeLlama-13b-Instruct", openai_api_base="http://0.0.0.0:8000", openai_api_key="my-together-ai-api-key")
from nemoguardrails import LLMRails, RailsConfig
config = RailsConfig.from_path("./config.yml")
app = LLMRails(config, llm=llm)
new_message = app.generate(messages=[{
"role": "user",
"content": "Hello! What can you do for me?"
}])In [ ]:
# instructions:
# - type: general
# content: |
# Below is a conversation between a bot and a user about the recent job reports.
# The bot is factual and concise. If the bot does not know the answer to a
# question, it truthfully says it does not know.
# sample_conversation: |
# user "Hello there!"
# express greeting
# bot express greeting
# "Hello! How can I assist you today?"
# user "What can you do for me?"
# ask about capabilities
# bot respond about capabilities
# "I am an AI assistant that helps answer mathematical questions. My core mathematical skills are powered by wolfram alpha."
# user "What's 2+2?"
# ask math question
# bot responds to math question
# "2+2 is equal to 4."
# models:
# - type: main
# engine: openai
# model: claude-instant-1