fabric icon indicating copy to clipboard operation
fabric copied to clipboard

Initial test of config for routes

Open zmackie opened this issue 1 year ago • 2 comments

As per issue #4 This is a working implementation. I'm happy to organize it differently or integrate it in some way. I'd love to collaborate on what you think the best way to integrate this is. The client application could be improved to support configurability in this form too, I think. That might look something like fabric extract_wisdom with a local .fabric file containing configuration including auth information and endpoint.

At the moment, this only works for routes that are in the simple form of a user+system prompt. I could likely improve this for additional functionality. I could also likely make the particulars of the model parameters configurable, etc.

PoCs:

curl -X POST -H "Content-Type: application/json" -d '{"input": "hayek"}' http://localhost:8080/philocapsulate
{
  "response": "BACKGROUND:\n\n- Friedrich August von Hayek was born on May 8, 1899, in Vienna, Austria.\n- He was a prominent economist and political philosopher of the 20th century.\n- Hayek served in Worl
d War I and said that his experience shaped his intellectual life.\n- He earned a doctorate in law and political science at the University of Vienna in 1921 and 1923.\n- Hayek held academic positions in Austria, Great Britain, the United States, and Germany.\n\nONE-LINE ENCAPSULATION:\n\nHayek championed free-market capitalism and criticized socialist economic policies.\n\nSCHOOL:\n\nClassical Liberalism / Austrian School of Economics; these schools emphasize the importance of free markets, individual liberties, and limited government intervention.\n\nTEACHINGS:\n\n- Advocated for the price mechanism as a means of disseminating information necessary for economic coordination.\n- Criticized central planning and socialism as inefficient and a threat to freedom.\n- Emphasized the role of spontaneous order in markets and society, rather than top-down organization.\n- Argued for the necessity of a strong legal framework to ensure personal liberty and maintain a free market.\n- Warned against the 'fatal conceit' that humans can design complex economic systems.\n\nWORKS:\n\n- \"The Road to Serfdom\" (1944): Warns of the dangers of government control leading to tyranny.\n- \"The Constitution of Liberty\" (1960): Outlines his vision of a free society and its legal structure.\n- \"Law, Legislation and Liberty\" (1973-1979): A three-volume work on the principles of a liberal social order.\n- \"Prices and Production\" (1931): Discusses monetary theory and capital structure.\n- \"The Use of Knowledge in Society\" (1945): An essay on information distribution via price signals.\n\nQUOTES:\n\n1. \"The curious task of economics is to demonstrate to men how little they really know about what they imagine they can design.\"\n2. \"To be controlled in our economic pursuits means to be controlled in everything.\"\n3. \"Liberty not only means that the individual has both the opportunity and the burden of choice; it also means that he must bear the consequences of his actions.\"\n4. \"The more the state 'plans' the more difficult planning becomes for the individual.\"\n5. \"Freedom granted only when it is known beforehand that its effects will be beneficial is not freedom.\"\n\nAPPLICATION:\n\nSomething is Hayekian if it emphasizes the virtues of free-market capitalism, individual liberty, and skepticism towards centralized planning.\n\nADVICE:\n\n- Trust in the decentralized process of free markets rather than government intervention for economic prosperity.\n- Defend individual liberties as a fundamental component of a thriving society.\n- Be wary of the concentration of power and the potential for abuse it entails.\n- Appreciate the role of tradition and established norms in guiding societal development.\n- Recognize the limits of human knowledge and the dangers of designing complex economic systems."                                                     }

curl -X POST -H "Content-Type: application/json" -d '{"input": "test"}' http://localhost:8080/extract_wisdom
{
  "response": "SUMMARY:\n\n- The content provided is a test input with no substantive information to summarize or analyze.\n\nIDEAS:\n\n- No ideas to extract from the provided content.\n\nQUOTES:\n\n- No qu
otes to extract from the provided content.\n\nHABITS:\n\n- No personal habits mentioned in the provided content.\n\nFACTS:\n\n- No factual information provided in the content.\n\nREFERENCES:\n\n- No references mentioned in the provided content.\n\nRECOMMENDATIONS:\n\n- No recommendations to extract from the provided content."                                                                                     }

zmackie avatar Jan 24 '24 19:01 zmackie

Server-side logging to show the receiving end:

(default) zmack@LAPTOP-GTNAG6UM:~/workspace/fabric/infrastructure/server$ python fabric_api_server_config.py 
 * Serving Flask app 'fabric_api_server_config'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://localhost:8080
Press CTRL+C to quit
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 132-529-418

zmackie avatar Jan 24 '24 19:01 zmackie

@zmackie I had a similar approach (https://github.com/danielmiessler/fabric/pull/15) submitted in another PR (My apologies i didn't check your PR before working on mine). Maybe we can combine a bit, since mine also adds a client implementation (and a slightly different Server side implementation on a general API endpoint).

sbehrens avatar Jan 31 '24 18:01 sbehrens

Let's sync this up and resubmit, yes. Sounds great.

danielmiessler avatar Feb 02 '24 03:02 danielmiessler