Skip to content

Commit

Permalink
take out gcp logging from default
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEdmondson1234 committed May 7, 2024
1 parent ba00523 commit 2e460f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
19 changes: 18 additions & 1 deletion docs/docs/index.md
Expand Up @@ -37,7 +37,7 @@ All dependencies:
pip install sunholo[all]
```

Data base functions:
Database functions:

```sh
pip install sunholo[database]
Expand Down Expand Up @@ -66,3 +66,20 @@ APIs
```sh
pip install sunholo[apis]
```

Sunholo is derived from the Edmonbrain project, the original blog post you can read here: https://code.markedmondson.me/running-llms-on-gcp/ and owes a lot to Langchain ( https://github.com/langchain-ai/langchain )

The package includes:

* `agents/` - functions for working with agents, including easy flask apps, parsing chat history and dispatching requests to different agent endpoints
* `archive/` - functions to record all Q&A activity to BigQuery via PubSub
* `bots/` - functions for special cases regarding frontend bots such as GChat, Web Apps, Discord and Slack
* `chunker/` - functions to slice up documents for sending into vector stores
* `components/` - functions to help configure which LLM, prompt, vectorstore or document retriever you will use based on a yaml config file
* `database/` - database setup functions and SQL to run on those sources such as Supabase or PostgreSQL
* `embedder/` - functions to send chunks into embedding vector stores
* `pubsub/` - use of PubSub for a message queue between components
* `qna/` - utilities for running agents such as retry strats and parsing of output/input
* `streaming/` - creation of streaming responses from LLM bots
* `summarise/` - creation of summaries of large documents
* `utils/` - reading configuration files, Google Cloud Platform metadata
3 changes: 1 addition & 2 deletions setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

# Define your base version
version = '0.50.12'
version = '0.50.13'

setup(
name='sunholo',
Expand All @@ -25,7 +25,6 @@
"langchain",
"langchain_experimental",
"langchain-community",
"google-cloud-logging", #logging init
# Add the minimal dependencies that your package requires here
],
extras_require={
Expand Down
12 changes: 8 additions & 4 deletions sunholo/logging.py
Expand Up @@ -37,7 +37,7 @@ def __new__(cls, project_id=None, log_level=logging.INFO, logger_name=None):
def __init__(self, project_id=None, log_level=logging.INFO, logger_name=None):
if not hasattr(self, 'initialized'): # Avoid re-initialization
self.project_id = project_id or get_gcp_project()
self.client = Client(project=self.project_id) if is_running_on_gcp() else None
self.client = Client(project=self.project_id)
self.logger_name = logger_name
self.log_level = log_level
self.initialized = True # Mark as initialized
Expand Down Expand Up @@ -220,9 +220,13 @@ def setup_logging(logger_name=None, log_level=logging.INFO, project_id=None):
if logger_name is None:
logger_name = "sunholo"

# Instantiate the GoogleCloudLogging class
gc_logger = GoogleCloudLogging(project_id, log_level=log_level, logger_name=logger_name)

if Client:
# Instantiate the GoogleCloudLogging class
gc_logger = GoogleCloudLogging(project_id, log_level=log_level, logger_name=logger_name)
else:
print("Could not find GoogleCloudLogging Client, install via `pip install google-cloud-logging`")
return logger

# Setup logging and return the logger instance
return gc_logger.setup_logging()

Expand Down

0 comments on commit 2e460f4

Please sign in to comment.