Skip to content

Commit

Permalink
Merge pull request #564 from tdstark/tdstark/fix-anthropic-chat-class
Browse files Browse the repository at this point in the history
Fix anthropic_chat.py - self.temperature doesn't exist if an Anthropic client is passed into VannaBase
  • Loading branch information
zainhoda authored Jul 25, 2024
2 parents 8b17f39 + bcf8d5f commit 4699d14
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/vanna/anthropic/anthropic_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@
class Anthropic_Chat(VannaBase):
def __init__(self, client=None, config=None):
VannaBase.__init__(self, config=config)

if client is not None:
self.client = client
return

if config is None and client is None:
self.client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
return


# default parameters - can be overrided using config
self.temperature = 0.7
self.max_tokens = 500
Expand All @@ -27,6 +19,14 @@ def __init__(self, client=None, config=None):
if "max_tokens" in config:
self.max_tokens = config["max_tokens"]

if client is not None:
self.client = client
return

if config is None and client is None:
self.client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
return

if "api_key" in config:
self.client = anthropic.Anthropic(api_key=config["api_key"])

Expand Down

0 comments on commit 4699d14

Please sign in to comment.