Skip to content

Commit

Permalink
Small refactor: improve ChatModelInfo computing and reporting short_d…
Browse files Browse the repository at this point in the history
…oc as a property, in langchain_integration
  • Loading branch information
vitaly-ps committed Apr 14, 2024
1 parent c69fd2c commit 089d38e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions ps_fuzz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ def main():
if args.list_providers:
print("Available providers:")
for provider_name, provider_info in get_langchain_chat_models_info().items():
doc = provider_info.doc
short_doc = doc[:doc.find('\n')]
print(f" {BRIGHT}{provider_name}{RESET}: {short_doc}")
print(f" {BRIGHT}{provider_name}{RESET}: {provider_info.short_doc}")
sys.exit(0)

if args.system_prompt_file is None:
Expand Down
4 changes: 4 additions & 0 deletions ps_fuzz/langchain_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def __str__(self):
s += f" {param_name}: {param}\n"
return s

@property
def short_doc(self):
return self.doc[:self.doc.find('\n')]

def get_langchain_chat_models_info() -> Dict[str, Dict[str, Any]]:
"""
Introspects a langchain library, extracting information about supported chat models and required/optional parameters
Expand Down

0 comments on commit 089d38e

Please sign in to comment.