From e279b351ed3e91ebd26080f4c8d9f28cbd3777de Mon Sep 17 00:00:00 2001 From: knielsen404 Date: Wed, 16 Jul 2025 14:26:30 +0200 Subject: [PATCH] remove superfluous changes --- README.md | 5 +- chatbot_testing_bundler.py | 111 ------------------------------------- gateway/.env | 10 ++-- 3 files changed, 7 insertions(+), 119 deletions(-) delete mode 100644 chatbot_testing_bundler.py diff --git a/README.md b/README.md index bba5166..f50bf8a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ -# Note: -This branch is only for testing. Use the chatbot in `chatbot_testing_bundler.py` to test out the setup quickly. - # Invariant Gateway **LLM proxy to observe and debug what your AI agents are doing.** @@ -398,4 +395,4 @@ To run a subset of the integration tests, execute: ```bash bash run.sh integration-tests open_ai/test_chat_with_tool_call.py -``` +``` \ No newline at end of file diff --git a/chatbot_testing_bundler.py b/chatbot_testing_bundler.py deleted file mode 100644 index bc6f3b8..0000000 --- a/chatbot_testing_bundler.py +++ /dev/null @@ -1,111 +0,0 @@ -from httpx import Client -from openai import OpenAI -import os - -class SimpleChatbot: - def __init__(self): - - self.invariant_authorization_token = os.getenv('INVARIANT_API_KEY') - if not self.invariant_authorization_token: - raise ValueError("INVARIANT_API_KEY is not set") - - self.client = OpenAI( - http_client=Client( - headers={ - "Invariant-Authorization": f"Bearer {self.invariant_authorization_token}" - }, - ), - base_url="http://localhost:8005/api/v1/gateway/temp_dataset/openai", - ) - self.conversation_history = [] - - def add_message(self, role, content): - """Add a message to the conversation history""" - self.conversation_history.append({"role": role, "content": content}) - - def get_response(self, user_input): - """Get response from the AI model""" - try: - # Add user message to history - self.add_message("user", user_input) - - # Get response from API - response = self.client.chat.completions.create( - model="gpt-4o-mini", - messages=self.conversation_history, - ) - - # Extract the AI's response - ai_response = response.choices[0].message.content - - # Add AI response to history - self.add_message("assistant", ai_response) - - return ai_response - - except Exception as e: - return f"Error: {str(e)}" - - def clear_history(self): - """Clear the conversation history""" - self.conversation_history = [] - print("Conversation history cleared!") - - def show_history(self): - """Display the conversation history""" - if not self.conversation_history: - print("No conversation history yet.") - return - - print("\n--- Conversation History ---") - for i, message in enumerate(self.conversation_history, 1): - role = message["role"].capitalize() - content = message["content"] - print(f"{i}. {role}: {content}") - print("--- End History ---\n") - - def run(self): - """Main chatbot loop""" - print("šŸ¤– Simple Chatbot Started!") - print("Commands:") - print(" - Type 'quit' or 'exit' to end the conversation") - print(" - Type 'clear' to clear conversation history") - print(" - Type 'history' to show conversation history") - print(" - Type anything else to chat with the AI") - print("-" * 50) - - while True: - try: - user_input = input("\nYou: ").strip() - - if not user_input: - continue - - # Handle special commands - if user_input.lower() in ['quit', 'exit']: - print("šŸ‘‹ Goodbye!") - break - elif user_input.lower() == 'clear': - self.clear_history() - continue - elif user_input.lower() == 'history': - self.show_history() - continue - - # Get AI response - print("AI: ", end="", flush=True) - response = self.get_response(user_input) - print(response) - - except KeyboardInterrupt: - print("\nšŸ‘‹ Goodbye!") - break - except Exception as e: - print(f"Unexpected error: {e}") - -def main(): - chatbot = SimpleChatbot() - chatbot.run() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/gateway/.env b/gateway/.env index 4fd8fcf..093ad91 100644 --- a/gateway/.env +++ b/gateway/.env @@ -3,7 +3,9 @@ POSTGRES_PASSWORD=postgres POSTGRES_DB=invariantmonitor POSTGRES_HOST=database -# This now points to the bundler instead of the explorer. Change -# `bundler-session-bundler-1` to the name of the bundler container, if it is different. -INVARIANT_API_URL=http://bundler-session-bundler-1:8210 -GUARDRAILS_API_URL=http://bundler-session-bundler-1:8210 \ No newline at end of file +# This specifies the Invariant Explorer instance where the gateway will push the traces +# Set this to https://preview-explorer.invariantlabs.ai if you want to push to Preview. +# If you want to push to a local instance of explorer, then specify the app-api docker container name like: +# http://:8000 to push to the local explorer instance. +INVARIANT_API_URL=https://explorer.invariantlabs.ai +GUARDRAILS_API_URL=https://explorer.invariantlabs.ai \ No newline at end of file