Skip to content

Commit

Permalink
Started DSPy CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchatmangpt committed Feb 24, 2024
1 parent ed9752c commit 3999460
Show file tree
Hide file tree
Showing 11 changed files with 335 additions and 113 deletions.
9 changes: 9 additions & 0 deletions hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from pydantic import BaseModel, Field, validator, root_validator, EmailStr, UrlStr
from typing import List, Optional
from datetime import datetime


class HelloWorld(BaseModel):
"""A simple Pydantic model for displaying a message."""
message: str = Field(default="Hello, World!", title="", description="A simple message to be displayed.")

183 changes: 183 additions & 0 deletions openai_usage.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,185 @@
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Retrying request to /completions in 0.759643 seconds
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Retrying request to /completions in 1.952363 seconds
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Retrying request to /completions in 0.767330 seconds
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Retrying request to /completions in 1.751419 seconds
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Retrying request to /completions in 0.847209 seconds
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Retrying request to /completions in 1.803567 seconds
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Backing off request(...) for 0.2s (openai.InternalServerError: Error code: 500 - {'error': {'message': 'The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. (Please include the request ID req_ab8d232d6bb8f337c7d61e4d04506240 in your email.)', 'type': 'server_error', 'param': None, 'code': None}})
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Retrying request to /completions in 0.785643 seconds
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 500 Internal Server Error"
Retrying request to /completions in 0.957306 seconds
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
NumExpr defaulting to 8 threads.
HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
2 changes: 1 addition & 1 deletion src/experiments/actor/event/add_to_cart_button_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

class AddToCartButtonClick(Event):
"""Generated class for AddToCartButtonClick, inheriting from Event."""

book -> cart (add command)
pass
4 changes: 2 additions & 2 deletions src/experiments/actor/event/checkout_form_submitted.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from rdddy.event import Event
from rdddy.messages import AbstractEvent


class CheckoutFormSubmitted(Event):
class CheckoutFormSubmitted(AbstractEvent):
"""Generated class for CheckoutFormSubmitted, inheriting from Event."""

pass
2 changes: 1 addition & 1 deletion src/experiments/chatgpt_conversation_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def process_conversations_chunk(chunk):
data = Data(**conversation.mapping[key])
if data.message and data.message.author.role == "assistant":
for part in data.message.content.parts:
if "ECCN" in part:
if "AutoSpider" in part:
print(part)
# encoding = tiktoken.encoding_for_model("text-embedding-ada-002")
# print(len(encoding.encode(part)))
Expand Down
8 changes: 4 additions & 4 deletions src/experiments/event_storm_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class {{ event }}(Event):
"""
Event triggered by {{ event }}.
"""
pass
{{ business_logic }}
{% endfor %}
Expand Down Expand Up @@ -324,8 +324,8 @@ def main():
EventStormingDomainSpecificationModel,
)

lm = dspy.OpenAI(max_tokens=3000)
# lm = dspy.OpenAI(max_tokens=4500, model="gpt-4")
# lm = dspy.OpenAI(max_tokens=3000)
lm = dspy.OpenAI(max_tokens=4500, model="gpt-4")
dspy.settings.configure(lm=lm)
# Create a Jinja environment and render the template
env = Environment()
Expand All @@ -334,7 +334,7 @@ def main():

event_storm_model = GenPydanticInstance(
root_model=EventStormingDomainSpecificationModel
)(prompt=prompt)
)(prompt="online contract signing full stack site")

print(f"Event Storm Model {event_storm_model}")

Expand Down
Loading

0 comments on commit 3999460

Please sign in to comment.