#πŸ”’ need help in refactoring prompts in LLM (langchain model)

5 messages Β· Page 1 of 1 (latest)

snow robin
#

okay the following is the code structure: init.py, chain.py, prompts.py and utils.py
In prompts.py we have:

from kor.nodes import Object, Text, Number
from langchain_core.prompts.prompt import PromptTemplate

prompt_securities= Object(
id="securities",
descriptions="security query from clients for pricing quote",
attributes=[
Text(id="AMOUNT",description=".."),
Text(id="TRANSACTION_TYPE",description=".."),
Text(id="CURRENCY",description=".."),
Text(id="VALUE_DATE",description=".."),
Text(id="END_DATE",description=".."),
Text(id="ISSUER",description=".."),
Text(id="COUPON",description=".."),
Text(id="MATURITY",description=".."),
Text(id="TENOR",description=".."),
Text(id="ISIN_CODE",description=".."),
Text(id="TICKER",description="consists of issuer, coupon and maturity")
],
examples=[
(""" XXXXX repo bid YYY USD XS378372 1mio val 9/20 to 9/27 """,
[
{ "TRANSACTION_TYPE":"bid","AMOUNT":"1mio","ISIN_CODE":"XS378372", "VALUE_DATE":"9/20", "END_DATE": "9/27"}
]),

6 other prompts

// now we have a prompt query object
prompt_query= Object(
id="repo_rfq",
description="Pricing query from client to trader for a list of securities",
examples=[
"""
XXXX
09:13:29 hi gm. can i check ur bid 2.2b yyy 6jul22-open?""",
[
{"TIMESTAMP":"09:13:29","PERSON":"XXX"}]),

so, how do i "refactor" this cos its hitting LLM token limit,,

late onyxBOT
#

@snow robin

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

snow robin
#

okay the following is the code structure: init.py, chain.py, prompts.py and utils.py
In prompts.py we have:

from kor.nodes import Object, Text, Number
from langchain_core.prompts.prompt import PromptTemplate

prompt_securities= Object(
id="securities",
descriptions="security query from clients for pricing quote",
attributes=[
Text(id="AMOUNT",description=".."),
Text(id="TRANSACTION_TYPE",description=".."),
Text(id="CURRENCY",description=".."),
Text(id="VALUE_DATE",description=".."),
Text(id="END_DATE",description=".."),
Text(id="ISSUER",description=".."),
Text(id="COUPON",description=".."),
Text(id="MATURITY",description=".."),
Text(id="TENOR",description=".."),
Text(id="ISIN_CODE",description=".."),
Text(id="TICKER",description="consists of issuer, coupon and maturity")
],
examples=[
(""" XXXX repo bid YYY USD XS7374337 1mio val 9/20 to 9/27 """,
[
{ "TRANSACTION_TYPE":"bid","AMOUNT":"1mio","ISIN_CODE":"XS7374337 ", "VALUE_DATE":"9/20", "END_DATE": "9/27"}
]),
#six other prompts

now we have a prompt query object

prompt_query= Object(
id="repo_rfq",
description="Pricing query from client to trader for a list of securities",
examples=[
"""
XXXX
09 13 29 hi gm. can i check ur bid 2.2b yyy 6jul22-open?""",
[
{"TIMESTAMP":"09: 13 :29","PERSON":"xxxxx"}]),

i have to refactor the prompts in a way that they don't hit the LLM token limit,, how do i go about this as im very new to LLM

late onyxBOT
#

@snow robin

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.